2017 © Pedro Peláez
 

silverstripe-module silverstripe-seo-hero-tool

SEO Hero Tool helps in optimizing websites for search engines

image

nomidi/silverstripe-seo-hero-tool

SEO Hero Tool helps in optimizing websites for search engines

  • Tuesday, January 16, 2018
  • by bastianfritsch
  • Repository
  • 5 Watchers
  • 5 Stars
  • 108 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 6 % Grown

The README.md

SeoHeroTool

Build Status License, (*1)

The SeoHeroTool offers options to control the Meta Information of a Website. The SeoHeroTool offers on the hand to change settings on a per page basis (like the MetaTitle, OpenGraph- or Twitterinformation) and to enter general information (like Google Analytics, links to Facebook, Twitter or for example to enter Redirects). While the page settings are entered on each page, the general settings can be accessed via the SeoHeroTool-Icon., (*2)

As many Pages of the same type (for example all DummyPages) have the same MetaTitle structure in common it is possible to define for those the structure via the config.yml file., (*3)

Requirements

  • SilverStripe CMS ~3.2

Installation

composer require nomidi/silverstripe-seo-hero-tool

Alternatively simply download the zip file from github. After installation run a run dev/build?flush=1 on your project., (*4)

Seo Hero Tool

Once the SeoHeroTool is installed each page has a tab called SeoHeroTool will appear., (*5)

, (*6)

The SeoHeroTool-Tab offers the following information: - Snippet Preview - SEO Title - Keywords - Meta Data - Facebook - Twitter, (*7)

Snippet Preview

The Snippet Preview is a preview on how this webpage will appear in a search result. If you update any site information it is necessary to save the site to get an updated Preview., (*8)

, (*9)

SEO Title

The SEO Title is the part which appears in the of each website within the -tag. By default this is the Title of the Website., (*10)

, (*11)

It is possible to define the SEO Title via the config.yml-file. This is explained in the part Creating default settings in the configuration. But it is also possible to set the SEO Title manually. The order of appearance if the following: - default Title - Title from configuration - Title entered via the SeoHeroTool, (*12)

The SEO Title which is actually used is entered as placeholder. If this Page Type has a Title configuration then the Title from the configuration will be displayed below the SEO Title., (*13)

Keywords

The Keywords section is just used in the Pro Version of the SeoHeroTools. The entered Keywords are used in the Analysis of the page. The W-Questions are right now just available in german in the Pro Version of the SeoHeroTools., (*14)

Meta Data

Meta Data contains information regarding Meta Informations: - Index - Canonincal URL - MetaDescription - Google Schema Org Data, (*15)

, (*16)

The MetaDescription is by default the first 140 Characters from the Content. From that everything until the last space will be removed so that no incomplete word will be shown. The Meta Description can be overwritten., (*17)

It is also possible to configure the MetaDescription via the config.yml-file. This works the same as it does for Title or Canonical URL., (*18)

The Canonical URL can also be configured via the config.yml-file., (*19)

If there is any Schema Data for this page type defined this will be displayed under Google Schema Org Data. The preview will also show any errors in case that a field can not be resolved (for example missing field)., (*20)

Facebook

Under Facebook you will find all information regarding the sharing of this site on Facebook. This information will be parsed in the OpenGraph Format on the Website., (*21)

The Facebook Title is by default the same as the SEO Title. The MetaDescription is by default the MetaDescription. The Type of Site is by default website. This can be configured via the SeoHeroToolDataObject. If the Type of Site is set via the configuration it can be overwritten for a specific page. In order to so please select a different Type and check the box overturn config setting., (*22)

It is possible to define the Facebook Image via the Configuration. To do so simply add the following to your SeoHeroToolDataObject: ``` yml FBImage: $functionname(), (*23)

Replace functionname with the real name of the function. Keep in mind that this function needs to return an absolute Path.
An Example for a has_one Image with the name of Photo would look like:
``` php
public function returnMyImage()
{
    return $this->Photo()->AbsoluteURL;
}

Twitter

Under Twitter you will find all information regarding the sharing of this site on Twitter. This information will be parsed in Twitters own format., (*24)

, (*25)

The Twitter Title is by default the same as the SEO Title. The MetaDescription is by default the MetaDescription., (*26)

It is possible to define the Twitter Image via the Configuration. To do so simply add the following to your SeoHeroToolDataObject:, (*27)

TWImage: $functionname()

Replace functionname with the real name of the function. Keep in mind that this function needs to return an absolute Path. An Example for a has_one Image with the name of Photo would look like: ``` php public function returnMyImage() { return $this->Photo()->AbsoluteURL; }, (*28)


## Creating default settings in the configuration ### Define Title for Page Types This defination takes place in the `mysite/_config/config.yml'. ``` yml SeoHeroToolDataObject: Page: Title: - $Title # reads the field Title - $LastEdited # reads the date from the field LastEdited WithoutSpace: false # defines that all entries above are separated by a space TestPage: Title: - $Title # reads the field Title - " at " # just the string " at " - $LastEdited # the date from the field LastEdited - $MyTest() # the value of the method MyTest within the class TestPage - $TestObject.Title # The title of the Has_One Connection with TestObject DateFormat: SpecialFormat # Each Datefield shall be formated in a special format DateFormatting: d/m # each datefield will be output just by date and month (you can use here the normal php date values) WithoutSpace: true # no space between entries SiteConfigTitle: true # the title from the SiteConfig will be attached ( default false) FBType: article # The og:type for this site will be article (default website) FBImage: $myFBImage() # needs to return an absolute path , value of the method myFBImage() within the class TestPage TWImage: $myTWImage() # needs to return an absolute path , value of the method myTWImage() within the class TestPage

This configuration will result in the following: All Pages with the Type of Page will have a MetaTitle which consist of the Titleof the Page followed by a blank followed by the date of the lastEdit of the Page. If the title of this page is Home and the date of the last edit is 2017-04-30 10:13:12 this will result in the MetaTitle Home 30/04/2017. By default all datefields will be output by the Silverstripe date()-function., (*29)

All Pages with the Type of TestPage will have a more complex MetaTitle. These Pages have no blank character between each entry. $Title works as in the example above. " at " adds just these characters directly after the value of $Title. $MyTest runs the method MyTest in the class TestPage. Keep in mind that this method needs a return value. $TestObject.Title returns the Titlefrom the has_one connection with TestObject. DateFormat can have the following values: Nice, Year, Nice24 and SpecialFormat. Except SpecialFormat the other values uses the default Silverstripe functions to format the date. If the DateFormat is SpecialFormat, then the field DateFormatting will be used. Here the configuration which would be used for the Silverstripe Date Format method is allowed. d/m will result in the day followed by the month. WithoutSpace: true defines that no blank will be entered between each entry. SiteConfigTitle: true defines that the Title from the SiteConfig will be added at the end. FBType: artice defines, that all sites of the type TestPage will have as og:type the value of article. The default value here is website. FBImage: $myFBImage defines, that all sites of the type TestPage will have an og:image with the URL of the return from the method$myFBImage. TWImage: $myTWImage defines, that all sites of the type TestPage will have an twitter:image with the URL of the return from the method $myTWImage., (*30)

Important to know

  • It is not possible to define has-many or many-many connections directly. To do so please create a method in your class which returns the wanted value and use then the method via $myMethodName().
  • When a page type is configured via the config.yml it can be overwritten in the backend. Information in the backend always overwrites the configuration setting.
  • When you do a change to the config.yml remember to do a dev/build?flush=1 afterwards to apply the new settings.

Define schema data for Page Types

With the SeoHeroTool it is possible to define for page types a json schema which will always be part of the website. This defination takes place in the `mysite/_config/config.yml'., (*31)

SeoHeroToolSchemaDataObject:
  LocationPage:
    @type: "Test"
    address:
      @type: "PostalAddress"
      addressLocality: $DummyObject.Title
      postalCode: "12345"
      streetAddress: $getStreet()
    name: $Title
    telephone: "XXX XXX"
    email: "mail@example.com"

The above configuration will result in the following output. ``` json , (*32)


The Configuration of the SeoHeroToolSchemaDataObject is quite similar to the configuration of the SeoHeroToolDataObject. You can use normal strings by entering them simply. To use variables of a class just enter them with a starting *$*. A Has-One connection can be represented by a starting *$* followed by the name of the Has-One connection. Add then the Variabe separated by a dot. Methods of the class can be accessed a starting *$* and an ending *()*. To access the public Method *getStreet()* from the class LocationPage simply enter `$getStreet()`. #### Important to know - It is not possible to define has-many, many-many and similar relationships directly. For this please write a method which returns the correct value. - The output of the json configuration of this website can be viewed in the backend. Simply on a page which has a configuration switch to the SeoHeroTool-tab and open the MetaData. - If there is *any* error in the configuration you will also see this in the backend. - After a change in the `config.yml` please do not forget to run a `dev/build?flush=1`. # General settings Under General Settings the following options can be configured: - Google Analytics - Schema.org Company - Robots and .htaccess Editor ## Google Analytics Google Analytics allows an easy integration of Google Analytics into the website. ![](docs/images/googleanalytics.png) *Activate when Site is in Mode* defines in which environment mode Google Analytics should be active. The possible values are *dev*, *live*, *test*, *All*. *All* covers all environment modes. Directly above the field you will see if the current environment mode matches the choosen selection. Keep in mind that this setting just updates after you hit save. ## Schema Org Company Schema Org Company allows to enter directly in the backend some information about the company. This information is meant mainly for search engines and will be used by them. It is also possible in the Tab *Opening Hours* to define the Opening Hours. This is especially useful for buisnesses which have stores like restaurants or shops. In the last Tab *Social Links* information about the used Social Networks can be entered (see Social Media channels). This information will be used in the Schema Org JSON Object but will also be used for example in the Social Loop. ### Social Media channels ![](docs/images/sociallinks.png) Each Social Link contains of the following Information: - Name - Link - Username - Iconname - Display in Social Loop - Sorting The *Name* can either be choosen from the selection or entered manually if the Network is not in the list. The *Link* should be the complete http-Link. *Username* is necessary for example for Twitter as this will also be displayed in the Twitter Meta Data. *Iconname* is useful if in the Social Loop there should be the possiblity to add this as classname. *Make available in Social Loop Function* defines if this Network will be displayed in the `$SocialLoop` Function. *Sorting in Social Loop* defines the position in the Social Loop. See for more on this *Social Media Loop*. #### Social Media Loop If you want to loop all Social Media Channels which are entered and have the option do be displayed in a loop this can be achieved by looping `$SocialLoop`. By default it will return the Social Media Channel in order of their *Sort*-value ascending. But this can easily be changed with the Silverstripe methods. To loop the Social Media Channel in ascending Order by Name simply do the following loop:

$Titlebr/ ``` This will display all Social Media Channel-Titles with the option Make available in Social Loop Function in ascending order sorted by the Name., (*33)

Robots and .htaccess Editor

The Robots and .htaccess Editor allows right now just the insertion of 301-Redirect Links. New 301-Redirects will be tested for reasonabless but keep in mind that it is possible to break the website with this tool. So just experienced Users should use this., (*34)

Todo

  • add own icon for SeoHeroTool Settings
  • Beautify General Settings structure so that it needs less clicks
  • add more functionality to the Robots and .htaccess Editor
  • add configuration setting to enable/disable Robots and .htaccess Editor
  • update README.md to reflect changes on CanonicalURL and BetterMetaDescription

To add your own Feature Request please use the Github Issues for this project, (*35)

The Versions

16/01 2018

dev-master

9999999-dev

SEO Hero Tool helps in optimizing websites for search engines

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe seo search engine optimization