CyberDuck\SEO\Model\Extension\SeoPageExtension
- Author: <andrewm@cyber-duck.co.uk> SeoPageExtension Core extension to add detailed SEO configuration. Attaches by default to the Page object. Maps all properties in HeadTags.ss to methods within this class. e.g $PageMetaTitle => getPageMetaTitle() The mapped methods handle a class property and return a value based on conditions within the configuration such as returning a default value when no value is set. Whether attaching the extension to existing or new page no manual setting of properties in the CMS should be required if you want to go with a standard config. Standard config is: Canonical => The current full page URL Robots => 'index,follow' Priority => '0.5' ChangeFrequency => 'weekly' SitemapHide => false HideSocial => false OGtype => 'website' OGlocale => The current website locale TwitterCard => 'summary' Class properties in the $db array here should not be called directly, rather the class methods should be called to take advantage of SubSite detection, Blog related DataObject detection and other features. You can subclass, override, or use YML config to compliment this class and create your own detailed Meta strategies.
- License: MIT License https://github.com/cyber-duck/silverstripe-seo/blob/master/LICENSE
Synopsis
class SeoPageExtension
extends DataExtension
{
- // members
- private static array $db = ;
- private static array $has_one = ;
- private static array $many_many = ;
- private static array $defaults = ;
- private PaginatedList $pagination;
- // methods
- public FieldList updateCMSFields()
- public void updateSummaryFields()
- public array getSummaryFields()
- public array getSitemapChangeFrequency()
- public array getRobotsIndexingRules()
- public array getOGtypes()
- public array getOGlocales()
- public array getTwitterCardTypes()
- public string getPageMetaTitle()
- public string getPageMetaDescription()
- public string getPageCanonical()
- public string getPageRobots()
- public string getPageURL()
- public string getPageOgType()
- public string getPageOgLocale()
- public string getPageTwitterCard()
- public string getPageSocialImage()
- public string getSiteFacebookAppID()
- public string getSiteOgSiteName()
- public string getSiteTwitterHandle()
- public string getSiteCreatorTwitterHandle()
- public string getPageCharset()
- public boolean isCMSPreviewPage()
- public int getCMSPageID()
- public string getCMSPageEditLink()
- public string getPublishedIcon()
- public string getSitemapDate()
- public string|404 setPaginationTags()
- public string getPaginationPrevTag()
- public string getPaginationNextTag()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Members
private
-
$db
Our page fields -
$defaults
Sitemap defaults -
$has_one
Social image and other has_one relations -
$many_many
Has many extra Meta tags - $pagination
—
SilverStripe\ORM\PaginatedList
A PaginatedList instance used for rel Meta tags
Methods
public
- getCMSPageEditLink() — Get the current page edit link
- getCMSPageID() — Get the current page ID
- getOGlocales() — Return an array of Facebook Open Graph locales used in Meta tags
- getOGtypes() — Return an array of Facebook Open Graph Types used in Meta tags
- getPageCanonical() — Get the current page canonical tag URL
- getPageCharset() — Get the current page Meta charset value
- getPageMetaDescription() — Get the current page Meta description
- getPageMetaTitle() — Get the current page Meta title
- getPageOgLocale() — Get the current page Meta open graph locale
- getPageOgType() — Get the current page Meta open graph type
- getPageRobots() — Get the current page Meta robots rules
- getPageSocialImage() — Get the current page Meta social sharing image
- getPageTwitterCard() — Get the current page Meta Twitter card type
- getPageURL() — Get the current page URL // todo getAbsoluteURL()?
- getPaginationNextTag() — Get the current page next pagination link
- getPaginationPrevTag() — Get the current page prev pagination link
- getPublishedIcon() — Get the current page published status icon
- getRobotsIndexingRules() — Returns an array of robots crawling rules used in a robots Meta tag
- getSiteCreatorTwitterHandle() — Get the current site Twitter creator handle
- getSiteFacebookAppID() — Get the current site Facebook app ID
- getSiteOgSiteName() — Get the current site open graph site name
- getSiteTwitterHandle() — Get the current site Twitter handle
- getSitemapChangeFrequency() — Returns an array of sitemap change frequencies used in a sitemap.xml file
- getSitemapDate() — Get the LastEdited object property as an ISO foramtted date for XML sitemap
- getSummaryFields() — Returns an array of summary fields used in the SEO Admin section of the CMS
- getTwitterCardTypes() — Returns an array of Twitter card types used in Meta tags
- isCMSPreviewPage() — Returns true when the current page is a CMS preview
- setPaginationTags() — Sets a Paginated list object which the prev and next rel tags will be calculated off. This method validates the current $_GET param used for pagination and will return a 404 response if the $_GET var is outside of the expected range. e.g start=100 but only 99 items in the list
- updateCMSFields() — Adds our SEO Meta fields to the page field list. The tab is divided into logical sections controlling various aspects of page SEO.
- updateSummaryFields() — Change the grid summary field structure is currently in SEO admin