Global

Methods

# AuthorTags(seoConfig, …params)

AuthorTags adds the twitter:creator tag for story pages

Parameters:
Name Type Attributes Description
seoConfig *
params * <repeatable>

See Generator for other Parameters

View Source src/author-tags.js, line 11

# abstract Generator(seoConfig, config, pageType, data, opts) → {Object}

This is the signature of a generator, though this sample generator is unused

Please see the following list of generators

Parameters:
Name Type Description
seoConfig Object

The configuration passed into SEO class. Please see the individual generators for which properties are used

config Object

The configuration object. Please see the Config API

pageType string

The page type currently being rendered. Usually something like 'home-page'

data Object

The data returned by the loadData function

opts Object

Option

url string

The current URL being served

View Source Generator.js, line 21

A map of all tags. ex: {"og:image": "https://my.domain/image.png"}

Object

# ImageTags(seoConfig, …params)

ImageTags adds the og and twitter images

For a story page, this comes from the hero image. For a collection page (including home and section pages), the image will come from the collection hero image.

If the current story URL contains a cardId in the query parameters, then the title and description will come from card["social-share"]

Parameters:
Name Type Attributes Description
seoConfig *
enableOgTags boolean

Add og tags for Facebook

enableTwitterCards boolean

Add twitter tags

fallbackSocialImage string

Optional. Should be full URL (i.e. include https://). This image will be shown in og:image and twitter:image meta tags for stories having no hero image or alternate hero/social images

params * <repeatable>

See Generator for other Parameters

View Source src/image-tags.js, line 116

# pickImageFromStory()

priority:

  1. alternate social image
  2. alternate hero image
  3. hero image
  4. "fallbackSocialImage" from seo config
  5. logo_url from /api/v1/config > theme-attributes
  6. logo from /api/v1/config > theme-attributes
  7. undefined (meta tag won't get created)

View Source src/image-tags.js, line 40

# StaticTags(seoConfig, …params)

StaticTags puts whatever tags you've passed to it

Parameters:
Name Type Attributes Description
seoConfig *
staticTags Object

List of tags to be added. ex: {"viewport": "width=device-width,initial-scale=1.0"}

params * <repeatable>

See Generator for other Parameters

View Source src/static-tags.js, line 12

# StoryAmpTags(seoConfig, …params)

StoryAmpTags adds the amphref to stories which support amp.

To disable adding amphref for a specific story, you need to create a story attribute in bold with the slug {disable-amp-for-single-story} and values {true} and {false}. Set its value to "true" in the story which you want to disable amp. Please make sure to name the attributes and values in the exact same way as mentioned attribute slug: "disable-amp-for-single-story" values: "true" , "false"

Parameters:
Name Type Attributes Description
seoConfig *
ampStoryPages boolean | "public"

Should amp story pages be shown for all stories (true), not shown (false), or only be shown for public stories ("public"). Default: true

appendHostToAmpUrl boolean

If set to true, the url to be appended to the slug is computed based on the currentHostUrl and the domain slug, else the url is taken as the sketches host. Default: false

decodeAmpUrl boolean

If set to true, the storySlug that goes as the amp href url is decoded, else the storyslug is encoded. Default: false

ignoreAmpHtmlStoryTemplates boolean

pass all the story templates you want to ignore from add rel="amphtml" tag. Default: ["visual story"]

params * <repeatable>

See Generator for other Parameters

View Source src/amp-tags.js, line 45

# StructuredDataTags(seoConfig, …params)

StructuredData adds tags for schema.org's structured data

Parameters:
Name Type Attributes Description
seoConfig *
structuredData StructuredDataConfig

Please see StructuredDataConfig for a full list of supported options

params * <repeatable>

See Generator for other Parameters

View Source src/structured-data/structured-data-tags.js, line 466

# TextTags(seoConfig, …params)

TextTags adds the majority of basic tags, such as

  • Canonical URLs
  • Title and Description
  • Keywords

If the current URL contains a cardId in the query parameters, then the title and description will come from card["social-share"]

Parameters:
Name Type Attributes Description
seoConfig *
enableOgTags boolean

Add og tags for Facebook

enableTwitterCards boolean

Add twitter tags

enableNews boolean

Add tags for Google News, like news_keywords

customTags Object

Add tags for a custom page type. Usually looks like {"custom-page": {"title": "value", "canonicalUrl": "value"}}

params * <repeatable>

See Generator for other Parameters

View Source src/text-tags.js, line 305

Type Definitions

# Organization

Options for a schema.org Organization Example

{
  name: "Quintype",
  url: "http://www.quintype.com/",
  logo: "https://quintype.com/logo.png",
  sameAs: ["https://www.facebook.com/quintype","https://twitter.com/quintype_in","https://plus.google.com/+quintype","https://www.youtube.com/user/Quintype"]
}

View Source src/structured-data/structured-data-tags.js, line 402

# StructuredDataConfig

Options to StructuredDataTags

Properties:
Name Type Description
enableBreadcrumbList boolean

Should breadcrumbs be enabled (default true)

enableLiveBlog boolean

Should LiveBlog schema be implemented for live blogs (default false)

enableVideo boolean

Should VideoObject be enabled for video stories (default false)

enableNewsArticle boolean | "withoutArticleSchema"

If set to true, then both Article and NewsArticle schema are implemented. If set to "withoutArticleSchema", then only NewsArticle is implemented

organization Organization

The organization to put on the homepage. See Organization for an example

website Website

The website and search urls. See Website for an example

header Object

Enable WPHeader tag. ex: {cssSelector: ".header"}

footer Object

Enable WPFooter tag. ex: {cssSelector: ".footer"}

structuredDataTags Array

An array of tags describing the publisher. eg: {structuredDataTags: ["section-page", "tag-page"]}

isSubscriptionsEnabled boolean

Enable subscription based schema (default false)

isShowcaseProduct boolean

Should product type be showcase (default false, fallback: basic)

authorSchema function

Should override author-url in Person schema. We have to pass an array of authors with name and URL Eg: "authorSchema" : (story)=> getAuthorWithUrl(story, config); const getAuthorWithUrl = (story, config) => { return story.authors.map((author)=>{ return { name: author.name, url: ${config['sketches-host']}/author/${author.id} } }) }

View Source src/structured-data/structured-data-tags.js, line 432

# Website

Options for a schema.org Website Example

{
  url: 'https://www.quintype.com/',
  searchpath: 'search?q={q}',
  queryinput: 'required name=q',
  name: 'Quintype',
  headline: 'Quintype - Discover news',
  keywords: 'news,quintype'
}

View Source src/structured-data/structured-data-tags.js, line 416