Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
240 lines (160 sloc) 7.44 KB

Social & SEO Meta-Tags Plugin

The Social & SEO Meta-Tags Plugin is for Grav CMS.


Add and manage the SEO meta-tags:

  • Description
  • Robots
  • Keywords

Add all Meta-Tags that need Facebook Open Graph, and Twitter Cards.

Note: keyword meta-tag is deprecated for the most bots but this plugin allow management of it for the other bots.



Using GPM (preferred):

The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's Terminal (also called the command line). From the root of your Grav install type:

$ bin/gpm install social-seo-metatags

This will install the Social & SEO Meta-Tags plugin into your /user/plugins directory within Grav. Its files can be found under /user/plugins/social-seo-metatags.

Manual Installation:

In /user/plugins folder, apply the following command:

git clone social-seo-metatags

This will clone this repository into the social-seo-metatags folder.


After enabling plugin and options, 2 solutions:

  • Nothing to do: Items are determined from your page (Description, Keywords...)
  • Overwrite meta-tags from your frontmatter header page configuration.

You have possibility to customize meta-tag from your page header metadata:

    description: 'Your page description'
    robots: noindex, nofollow, ...
    keywords: key1, key2, key3, ...
    'og:title': 'The title for OpenGraph'
    'twitter:description': 'The description for Twitter'
Page content

To define a global description for all meta-tags, configure your page header as follow:

description: 'Global description'
    robots: noindex, nofollow, ...
    keywords: key1, key2, key3, ...
    'og:title': 'The title for OpenGraph'
Page content

This configuration set up description for tag description, og:description and twitter:description.

Strategy for Description set-up

Description is defined as follow:

  1. Define description from Summary.
  2. If Summary not defined, define description from site metadata configuration.
  3. If description from frontmatter header is defined, use it.
  4. If description from frontmatter header metadata (for each meta-tag) is defined, use it.

Antimatter theme

This plugin support the field header_image_file of Antimatter theme.
This configuration is choose first, then first media image and last default image from plugin configuration.

header_image_file: 'Relative image path'


Common SEO

For SEO, you have the following default configuration:

  robots: without
  length: 20
    enabled: true
    enabled: false

robots e.g. "Default Robots Meta-Tag" allow you to define default rules for bots. You have the following possibilities:

  • noindex: prevents the page from being indexed
  • nofollow: don't follow links from this page when looking for new pages to crawl
  • nosnippet: don't show a snippet of this page when displaying it in the search results
  • noodp: don't use text from ODP (The Open Directory Project a.k.a. to generate a title or snippet for this page
  • noarchive: don't display a "Cached" link for this page in the search results

length e.g. "Number of keywords" allow you to define maximum number of keywords to display in meta-tag.

taxonomy.enabled e.g. "Use Taxonomy Keywords" allow you to use Keywords of Taxonomy for Meta-Tags.

page_content.enabled e.g. "Use Page Content Keywords" allow you to use Keywords of page content (<strong> and <em>) for Meta-Tags.

Associate Twitter account

For Twitter, you have the following default configuration:

      enabled: true
      type: summary
      username: ''

enabled e.g. "Twitter Cards active" enable integration of Twitter Cards meta-tags.

type e.g. "Card Type" define the typê of card used by meta-tag. Accepted values are: summary, summary_large_image.

username e.g. "Twitter Username" is your twitter account reachable by https://twitter/username.

Associate Open Graph and Facebook

Open Graph can work without a strong integration to Facebook. This plugin gives you the opportunity to use both and add an app_id to use Facebook Statistics with your website.

Namespace configuration

OpenGraph requires to use a namespace on the <html> tag.

In your base template, add the following line in the html tag:

    {{- (
        ? 'xmlns:og=""'
        : ''

Plugin configuration

For Facebook, you have the following default configuration:

        enabled: true
        enabled: false
        appid: '1234567890'

facebook.opengraph.enabled toggles the integration of Facebook Open Graph meta-tags.

facebook.insights.enabled toggles the integration of Facebook Insights meta-tag, which needs an app_id to identify you as the owner of the document. You can find this app_id from the Facebook App Dashboard.

Gzip activation

It could be that content sharing on facebook require the Gzip activation. The Facebook debugger will display no data or incomprehensible errors in this case.

To resolve it, set the cache.gzip to true in system.yaml configuration file.

This behavior is discussed here.

Other configuration

Single quote escaping

With the following configuration, the plugin allows the conversion of simple quote ('), which can be an issue for Twitter sharing, into html entity (#039;):

  convert_simple: true

Default image

The following defines a default image to use if no image is present in the current Page.

This avoids having to set an image for each Page; useful with repetitive Pages like events or such.

      name: ZOqdm0x1rzP6iLp.png
      type: image/png
      size: 27269
      path: user/assets/images/ZOqdm0x1rzP6iLp.png


Check source of the following link:


If you think any implementation are just not the best, feel free to submit ideas and pull requests. All your comments and suggestion are welcome.


Some features based on Social Meta Tags Plugin