Giter Site home page Giter Site logo

ethercreative / seo Goto Github PK

View Code? Open in Web Editor NEW
266.0 18.0 96.0 11.48 MB

SEO utilities including a unique field type, sitemap & redirect manager

License: MIT License

JavaScript 36.00% PHP 37.73% Less 7.01% Twig 19.25%
craft seo sitemap redirects field-type craftcms craft-plugin craftcms-plugin craft2 craft3

seo's Introduction

SEO for Craft CMS

SEO for Craft CMS

SEO for Craft does three things that will help your sites SEO, and does them really damn well:

  1. Optimisation Field Type - Helps your clients write better optimised copy, and manage other SEO meta.
  2. Sitemap - Generates an always up-to-date XML sitemap automatically, with controls for customisation.
  3. Redirects - Quickly and easily manage 301 & 302 redirects. Especially useful when migrating from an old site.

Click here for the Craft 2 version.

The Field Type

The SEO field type helps give users an idea of how their page will look in Google, and how their pages content scores when compared to a specific keyword.

The field type allows users to manage the meta of their page in one simple and easy to use input that has the added bonus of giving them an idea of how their page will show up in a Google search.

The field also contains a Focus Keyword input and Page Score. This is used to workout how relevant a keyword or phrase is to your entry and how well the page is likely to do in a search for that keyword.

The Page Score also contains a breakdown of your entries score, and tips on where it can be improved.

SEO for Craft CMS

SEO Social

SEO Advanced

The Sitemap

SEO for Craft boasts an extremely powerful, yet simple to use Sitemap manager. With automatic support for all your site’s sections and categories (with localisations taken into account), and the ability to easily add custom URLs (useful for public templates that aren’t content managed), keeping your sitemap up-to-date has never been easier.

With SEO for Craft’s sitemap manager you have complete control over what content you want to have appear on your sitemap as well as managing its change frequency and priority in your site.

SEO Sitemap

The Redirects

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 .htaccess style regex support!

Redirects support PCRE regex syntax. By default, all / and ? not inside parenthesis are escaped. To prevent any escaping include the opening and closing forward slashes and flags: /^blog$/i. All redirects are given the insensitive flag, unless overwritten.

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

SEO Redirects

Installation & Usage

Clone this repo into craft/plugins/seo.

Using Composer

Easy way

composer require ether/seo

Alternative way

  1. Append "ether/seo": "^3.1.0" to the require hash of composer.json
  2. composer update
  3. Install via CP in /admin/settings/plugins

Before using the SEO field type, you’ll need to ensure all the settings are correct. You can find the settings under the SEO plugin menu in the sidebar, or via the plugin menu.

Environment Setup

Ensure that your Production environment’s name is production (going with Craft’s convention). All other environments will get X-Robots-Tag: none, noimageindex headers added to every web response, to prevent search engines from indexing duplicate content.

Environment names are typically defined by an ENVIRONMENT environment variable.

Fieldtype Usage

Replace your title tag, and any other SEO related meta tags with {% hook "seo" %}. That's it!

This assumes that you will be creating a variable call seo in your templates that will return either the SEO field or a custom SEO object (see below). You can modify the output of this hook by setting your own SEO Meta Template in the SEO Settings. You can view the default template here.

Custom SEO Object

In some cases, you will not have access to an SEO field, but will want to set the page title, description, & socials. You can do this by creating a custom SEO object using the function below:

craft.seo.custom(
    'The Page Title',
    'The page description',
    null,

    // Social media - Any missing fields (excluding images) will be populated by the values above
    {
        twitter: { image: myImageField.first() },
        facebook: { title: '', description: '', image: myImageField.first() },
    }
)

alternatively pass an object as the first parameter. This will be used in place of an element.

craft.seo.custom(
    {
        title: 'The Page Title',
        someField: 'Hello world!',
    },
    'The page description'
)

All parameters are optional.

Upcoming Features

If you have a feature suggestion, leave an issue with the prefix [FR].


Copyright © 2016 Ether Creative [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

seo's People

Contributors

alexjcollins avatar andris-sevcenko avatar arnedem avatar boboldehampsink avatar caleuanhopkins avatar dependabot[bot] avatar domstubbs avatar dyerc avatar frankzwiers avatar freekvr avatar icreatestuff avatar jamesedmonston avatar jesuismaxime avatar jorgeanzola avatar matthiaswh avatar mdxdave avatar monachilada avatar niektenhoopen avatar nstcactus avatar roelvanhintum avatar saboteur777 avatar saylateam avatar spekulatius avatar tam avatar therealpecus avatar thomascoppein avatar tschoffelen avatar ttempleton avatar urbantrout avatar zae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seo's Issues

URL for alternate locale is invalid

When looking at the URLs for alternate locales in a multi-locale site we observed incorrect (non-existing) URLs being generated.

Example:

  <url>
    <loc>http://localhost:9000/0002_0015_heardis-website/de/work/deutsche-bundesbank/ein-lernort-zum-thema-geld</loc>
    <lastmod>2017-09-25</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.9</priority>
    <xhtml:link rel="alternate" hreflang="en" href="http://localhost:9000/0002_0015_heardis-website/en/work/deutsche-bundesbank/ein-lernort-zum-thema-geld"/>
  </url>

The correct URL for the english version of the page is http://localhost:9000/0002_0015_heardis-website/en/work/deutsche-bundesbank/a-learning-experience-on-money instead.

Take a look at the pull-request I'm going to push. It correctly works for entries and categories but I'm unsure in the context of craft-commerce.

[FR] Yoast Import

Would love the ability to import focus keywords (and perhaps other meta) from Yoast.

I recently pulled out all the focus keywords from our posts/pages in wordpress via the following mysql query:

SELECT wp_posts.post_title, wp_posts.ID, wp_posts.guid, mt1.meta_value as focus_keyword
FROM wp_posts 
LEFT JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id AND mt1.meta_key='_yoast_wpseo_focuskw')
WHERE wp_posts.post_type = 'page' OR wp_posts.post_type = 'post' 
AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') 
GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC

This will give me a good list to import into Craft, but I'd love the opportunity to have this be a little bit more straight forward. In fact, even if this were part of the README, where you could give mysql statements that would give an example way to import these, that would be amazing.

[FR] Auto-expand SEO score detail

As a user, I want to see the details of my score without having to click, so that I have a more immediate understanding of my score.

Unless this is saving a significant amount of resources to hide this by default, I'm not sure it makes sense to hide this information behind a click.

5_apps_that_make_you_a_smarter_sales_rep_-_badger_website

[FR] Locale support when generating sitemap

The sitemap feature is great, but it would be even better if the sitemaps automatically didn't include pages that are turned off, especially pages that are turned off for certain locales. Or, allow the user the option to not include pages that are currently turned off when generating the sitemap. Google Search Console is lit up right now with loads of 404s for pages that are in the sitemap but only turned on for one locale and not the others. Thank you!!!!

CSRF Javascript issue

SEO: v1.4.2
Craft: v2.6.2983

Javascript error. Happens as soon as I log in and head into the SEO menu panel from the left hand menu.

screen shot 2017-06-21 at 10 51 01
screen shot 2017-06-21 at 10 51 08

[FR] Show SEO score in entry sidebar

As a user, I want the ability to see a post SEO score in the sidebar, without going to the SEO tab, so that I can quickly see things at a glance.

OR

As a user, I want the ability to see a post SEO score in the SEO tab, without actually going to the SEO tab, so that I can quickly check performance at a glance.

While it's just one more click to see the SEO, if you are bulk checking things, those clicks add up. Further, it'd be nice if I clicked this button, it led me to the SEO tab being opened.

There seems to be an ability to do this documented by Brad Bell: https://craftcms.stackexchange.com/questions/14516/how-to-add-a-custom-button-at-the-right-section-of-an-entry/14526

5_apps_that_make_you_a_smarter_sales_rep_-_badger_website

sitemap.xml broken with error "Trying to get property of non-object"

When I load my site's sitemap.xml I am getting the following error: "Trying to get property of non-object"

screenshot - 11-jul-17 10_39_31 am

I can't seem to work out why, since $criteria->first() does appear to return an object, although I'm not sure if it's the right kind.

(Using latest version of Craft: 2.6.2986)

[FR] Support Focus Keywords on Category Entries

I have a site that has a landing page for each category, and I'd love to use the Focus Keywords feature, but when I edit a category in the CP I see "This feature is not available" in the Focus Keywords section. It seems to be working fine if I use this fieldtype in a section entry. Thanks!

Fieldsettings & plugin settings

When you change the plugin settings(or at least the titleSuffix) and then view the fieldsettings I noticed that the titleSuffix setting seemed to also be updated. However when I viewed the field record in the database it still contained the old value.

When I saved the field afterwards the settings where written in the correct field record.

Customize Snipplet

First of: Awesome plugin mate!

Is there an option (or how) does one define "standart" text for the snipplets? Title, description etc?

Internal Server Error

Using version 1.4.7, clicking on Sitemap from the sidebar gives this error message:

Internal Server Error
Craft\Seo_SitemapRecord and its behaviors do not have a method or closure named "enabled".

redirects with parameters

redirect with parameters in de url don't work
for example blabla.com/redirectme?par=1 goes to a 404 and blabla.com/redirectme goed to a page

The idea of rendering the template manually seems wrong

Hello,

I love this plugin but the idea that it takes the content, and renders it manually rather then just doing like a curl call to /uri and read that seems wrong to me.

In order to accurately determine SEO it should follow the same flow as Google Bot or anything else uses, and do something like file_get_contents('/URI'); to get the entire HTML source (or get it from Live Preview somehow) and use that in the SEO determination. Rather then manually rendering each field.

This would also remove all of the readability, and field template settings. Which just seem to add a layer of complexity that provides no benefit. Google doesn't selectively read your fields a certain way and not some. It reads the entire page, and this plugin should do the same.

Basically my proposal is to change _showEntry to something like

private function _showEntry (EntryModel $entry) {
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $entry->url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);

    $output = curl_exec($ch);
    curl_close($ch);

    HeaderHelper::setContentTypeByExtension('html');
    HeaderHelper::setHeader(array('charset' => 'utf-8'));
    ob_start();
    echo strip_tags($output, '<p><h1><h2><h3><h4><h5><h6><a><img><b><strong>');
    craft()->end();
}

Thoughts?

Ability to paste multiple redirects

Ability to select from either a spreadsheet (or plain text) a list of redirects, paste into an empty table row and it create a new table row for each of the pasted new lines.

To help speed up the redirect management process.

Working on Entries?

Checked through the issues but couldn't find anything on this.

The SEO plugin seems to be not loading 'Page Score' / 'Keywords' on Entries page? (Plugin is working but not displaying everything)

Variable "globalSettings" does not exist

On version 1.1.2 when opening /admin/seo/settings

Template Error
Variable "globalSettings" does not exist
/var/www/craft/plugins/seo/templates/_seo-fieldtype-settings.twig(8)

1 {% import "_includes/forms" as forms %}
2 
3 {{ forms.textField({
4     label: 'Title Suffix',
5     instructions: 'A string appended, after a space, to the page title. This can be removed on a per-entry basis.',
6     name: 'titleSuffix',
7     id: 'titleSuffix',
8     value: settings.titleSuffix is defined and settings.titleSuffix != "" ? settings.titleSuffix : globalSettings.titleSuffix
9 }) }}

Disable social tab

I think the introduction of the social tab is brilliant and I will use this feature on new sites.

Despite that the addition of the social tab is confusing the clients with the plugin already on their site (now that I've updated the plugin), as I'm already populating the social meta tags automatically.

For example I have a client trying to change the Facebook image but this isn't being reflected.

Could you provide the ability to disable this tab until I get chance to update how the social meta's are handled?

Redirects disappear from database

Hi there, is there a limit to the amount of redirects? When we get to approx 194 ish, all redirects disappear from the database so we have to import them from the daily backup.

Block Search Indexing

Ability to block search indexing on a per-entry basis. Presumably facilitated as an option within the SEO field type.

This would add <meta name="robots" content="noindex"> to the snippet and also remove that entry from the sitemap.

Not Seeing Entry Breakdown/Page Score

Hey There

Newbie to Craft here but I have installed the plugin and not seeing the entry breakdown/page score/google snippet when editing an entry.

What am I missing?

Do I need to create any specific fields for this to work (I have already setup all my meta fields before installing this plugin)?

Thanks :)

Error while saving sitemap

In the SEO -> Sitemap plugin settings, while saving the sitemap an error occurred:

Invalid argument supplied for foreach()

/var/www/craft/plugins/seo/services/Seo_SitemapService.php(40)

$oldSitemap = $this->getSitemap();
$newSitemap = $data;

 // Delete removed rows
 $newById = [];
 $oldById = [];

 $newRecordsRaw = [];

 foreach ($newSitemap as $group => $rows) {
     foreach ($rows as $new) {  // This is the affected row (40)
         $new['group'] = $group;
         if ($new['id'] != "-1") {
             $newById[$new['id']] = $new;
         } else {
             $newRecordsRaw[] = $new;
         }
     }
 }

 $idsToDelete = [];
 foreach ($oldSitemap as $group => $rows) {
     foreach ($rows as $old)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.