/grav-plugin-social-seo-metatags

Plugin for Grav CMS embed metatags management for Social and SEO

Primary LanguagePHPMIT LicenseMIT

Social & SEO Meta-Tags Plugin

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

Description

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.

Features

Installation

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 https://github.com/clemdesign/grav-plugin-social-seo-metatags social-seo-metatags

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

Usage

Plugin no need to edit any template :)

After enabling plugin and options, no action to do !
Items are determined from your page (Description, Image...)

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

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

Configuration

Common SEO

For SEO, you have the following default configuration:

seo:
  robots: without
  length: 20
  taxonomy:
    enabled: true
  page_content:
    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. dmoz.org) 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:

social_pages:
  pages:
    twitter:
      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 Facebook App Id

Namespace configuration

Facebook uses OpenGraph metatags that requires to use a namespace on html tag.

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

<html {{
  (config.plugins['social-seo-metatags'].enabled and config.plugins['social-seo-metatags'].social_pages.pages.facebook.enabled) ? 'xmlns:og="http://ogp.me/ns#"' : ''
}}>

Plugin configuration

For Facebook, you have the following default configuration:

social_pages:
  pages:
    facebook:
      enabled: false
      appid: '1234567890'

enabled e.g. "Facebook active" enable integration of Facebook Open Graph meta-tags.

You need to generate an app_id. Without this property you will lose admin right on the Open Graph Facebook Page.

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.

Demo

Check source of the following link: http://www.clemdesign.fr/blog/grav-un-nouveau-plugin-pour-gerer-les-meta-tags

Contributing

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.

Credits

Some features based on Social Meta Tags Plugin