Skip to content

Commit

Permalink
Merge pull request #27 from ethercreative/dev
Browse files Browse the repository at this point in the history
v1.3.0
  • Loading branch information
Tam authored Nov 9, 2016
2 parents 1bd69db + 58f3b49 commit 7cd5e9f
Show file tree
Hide file tree
Showing 38 changed files with 89 additions and 22 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ With SEO for Craft’s sitemap manager you have complete control over what conte

When moving from your old, awful site to your shiny new Craft one, you’ll want to make sure that all your old pages are redirected to their new counterparts. Redirects are easy to manage with SEO for Craft.

SEO for Crafts redirect manager lets you easily add 301 & 302 redirects, with full regex support!
SEO for Crafts redirect manager lets you easily add 301 & 302 redirects, with full .htaccess style regex support!

**Redirect Regex Example**
To redirect from `blog/2016/my-post` to `news/my-post` you would add the following redirect:

URI: `blog/([0-9]{4})/(.*)` To: `news/$2`

## Installation & Usage

Expand Down Expand Up @@ -89,6 +94,15 @@ All parameters are optional.

## Changelog

### 1.3.0
- Singles snippet title field now auto-populates.
- Made redirects regex support clearer (even I forgot).
- Field no longer throws "One SEO field only" error when using quick-edit modal thingies.
- Moved plugin files into `SEO/` directory, moved superfluous files out of plugin directory.
- Added fix for #26
- Added fix for #21
- Added @PetterRuud's fix for #20

### 1.2.3
- Added Craft Commerce product types to Sitemap.
- Sitemap and Redirects are now stored in their own database tables, fixing the issue with the ~194 limit.
Expand Down
16 changes: 16 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,21 @@
"[Added] Added Craft Commerce product types to Sitemap.",
"[Improved] Sitemap and Redirects are now stored in their own database tables, fixing the issue with the ~194 limit."
]
},

{
"version": "1.3.0",
"downloadUrl": "https://github.com/ethercreative/seo/archive/v1.3.0.zip",
"date": "2016-11-09T15:00:00-08:00",
"notes": [
"[Fixed] Fixed a bug where a PHP warning appear at the top of error pages, breaking the HTTP response status code.",
"[Fixed] Added @PetterRuud's fix for #20",
"[Fixed] Added fix for #21",
"[Fixed] Added fix for #26",
"[Fixed] Field no longer throws 'One SEO field only' error when using quick-edit modal thingies.",
"[Fixed] Singles snippet title field now auto-populates.",
"[Improved] Moved plugin files into `SEO/` directory, moved superfluous files out of plugin directory.",
"[Improved] Made redirects regex support clearer (even I forgot)."
]
}
]
1 change: 0 additions & 1 deletion resources/css/redirects.css

This file was deleted.

1 change: 0 additions & 1 deletion resources/css/seo.css

This file was deleted.

4 changes: 2 additions & 2 deletions resources/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gulp.task('js', function () {
.pipe(jshint.reporter())
.pipe(uglify().on('error', function(err){ console.log(err.message); }))
.pipe(rename({ suffix: ".min" }))
.pipe(gulp.dest('js'));
.pipe(gulp.dest('../seo/resources/js'));
});

// Less
Expand All @@ -24,7 +24,7 @@ gulp.task('less', function () {
.pipe(less({
plugins: [autoprefixer, cleancss]
}).on('error', function(err){ console.log(err.message); }))
.pipe(gulp.dest('./css'));
.pipe(gulp.dest('../seo/resources/css'));
});

// Watchers
Expand Down
16 changes: 11 additions & 5 deletions resources/js/seo-field.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
var SeoField = function (namespace, hasSection) {
if (window.hasSeoField) {
SeoField.Fail("One SEO field only");
document.getElementById(namespace + '-field').classList.add('seo--disabled');
return;
}
if (window.hasSeoField) return;

var self = this;
window.hasSeoField = true;

this.namespace = namespace;

// Field
document.getElementById(namespace + '-field').addEventListener('DOMNodeRemoved', function () {
window.hasSeoField = false;
});

// Snippet
this.title();
this.slug();
Expand Down Expand Up @@ -496,6 +497,11 @@ SeoField.GetEntryHTML.prototype.update = function (cb) {
var self = this,
postData = Garnish.getPostData(document.getElementById('container'));

if (typeof Craft.livePreview === typeof undefined) {
this.score.previousElementSibling.classList.add('hide');
return;
}

if (!this.lastPostData || !Craft.compare(postData, this.lastPostData)) {
this.lastPostData = postData;

Expand Down
1 change: 0 additions & 1 deletion resources/js/seo-field.min.js

This file was deleted.

20 changes: 19 additions & 1 deletion resources/less/seo.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
}

&--field {
position: relative;

padding: 20px;

border: 1px solid #e3e5e8;
Expand Down Expand Up @@ -216,7 +218,7 @@
}

&.disabled {
opacity: 0.25;
opacity: 0.1;
pointer-events: none;
}

Expand All @@ -234,6 +236,22 @@
.close { display: inline; }
}
}

&-disabled {
position: absolute;
z-index: 2;
bottom: 35px;
left: 17.5%;

display: block;
width: 65%;

text-align: center;

&.hide {
display: none;
}
}
}

}
4 changes: 2 additions & 2 deletions SeoPlugin.php → seo/SeoPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function getDescription()

public function getVersion()
{
return '1.2.3';
return '1.3.0';
}

public function getSchemaVersion()
Expand Down Expand Up @@ -120,7 +120,7 @@ public function init()
{
craft()->onException = function(\CExceptionEvent $event)
{
if($event->exception->statusCode)
if(property_exists($event->exception, 'statusCode') && $event->exception->statusCode)
{
if ($event->exception->statusCode == 404) {
$path = craft()->request->getPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function actionSitemapPage ()

$namespace = 'data';

craft()->templates->includeJsResource('seo/js/seo-settings.js');
craft()->templates->includeJsResource('seo/js/seo-settings.min.js');
craft()->templates->includeJs("new SeoSettings('{$namespace}', 'sitemap');");

$this->renderTemplate('seo/sitemap', array(
Expand Down Expand Up @@ -90,7 +90,7 @@ public function actionRedirectsPage ()
$namespace = 'data';

craft()->templates->includeCssResource('seo/css/redirects.css');
craft()->templates->includeJsResource('seo/js/seo-settings.js');
craft()->templates->includeJsResource('seo/js/seo-settings.min.js');
craft()->templates->includeJs("new SeoSettings('{$namespace}', 'redirects');");

$this->renderTemplate('seo/redirects', array(
Expand All @@ -115,7 +115,7 @@ public function actionSettings ()

$settings = craft()->seo->settings();

craft()->templates->includeJsResource('seo/js/seo-settings.js');
craft()->templates->includeJsResource('seo/js/seo-settings.min.js');
craft()->templates->includeJs("new SeoSettings('{$namespace}', 'settings');");

$this->renderTemplate('seo/settings', array(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ private function _generateUrls ($id, $section, $elemType)

$sect = craft()->elements->getCriteria($elemType);
$sect->sectionId = $id;
$sect->limit = null;

foreach ($sect->find() as $elem) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ public function getInputHtml($name, $value)
if ($hasSection && $isEntry && $this->element->uri != '__home__' && $this->element->section->type != 'single')
$url = substr($url, 0, strrpos( $url, '/')) . '/';

$titleSuffix = $settings->titleSuffix ?: $settingsGlobal->titleSuffix;

if ($hasSection && $isEntry && $value['title'] == null && $this->element->section->type == 'single')
$titleSuffix = $this->element->title . ' ' . $titleSuffix;

return craft()->templates->render('seo/_seo-fieldtype', array(
'id' => $id,
'name' => $name,
'value' => $value,
'titleSuffix' => $settings->titleSuffix ?: $settingsGlobal->titleSuffix,
'titleSuffix' => $titleSuffix,
'hasSection' => $hasSection,
'isNew' => $this->element->title === null,
'isHome' => $this->element->uri == '__home__',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions seo/resources/css/redirects.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions seo/resources/css/seo.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions seo/resources/js/seo-field.min.js

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function saveSitemap ($data)

foreach ($newSitemap as $group => $rows)
{
foreach ($rows as $new)
foreach ((array)$rows as $new)
{
$new['group'] = $group;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<label>Page Score</label>
<div class="instructions">Use this progress bar and detail view to discover the best ways of optimising your page.</div>

<div class="seo--score-disabled hide">Sorry, the Page Score feature does not work when there is no Live Preview available.</div>
<div class="seo--score disabled" id="{{ id }}-score">
<div class="content">
<div class="bar" id="{{ id }}-bar">
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 9 additions & 3 deletions templates/redirects.twig → seo/templates/redirects.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@
{% block content %}
{% namespace namespace %}
<div class="field">
{#<div class="heading">
<label>Redirects</label>
</div>#}
<div class="heading">
<div class="instructions">
Redirects support regex.
To redirect from <code>blog/2016/my-post</code> to <code>news/my-post</code> you would add the following redirect:
URI: <code>blog/([0-9]{4})/(.*)</code> To: <code>news/$2</code>
</div>
</div>

<br>

<div class="input">
<input type="hidden" name="redirects" id="redirects-field">
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7cd5e9f

Please sign in to comment.