GitXplorerGitXplorer
l

kirby-seo-og-plugin

public
3 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
bc3cbaeb799617e2cc5a851b53895a198237e9dd

Merge branch 'master' of https://github.com/l4ci/kirby-seo-og-plugin

ll4ci committed 7 years ago
Unverified
fd09e6b280a3807d77e1b2ebf4f8b49a519d87a6

fixed wrong description fields

ll4ci committed 7 years ago
Unverified
8154cec45cd433e37c97182f7186ee1a8e216559

added support for page specific metaindex

ll4ci committed 7 years ago
Unverified
906cd8350a9d587639ec14ed884aae65a41d174d

fixed broken sitemap

ll4ci committed 7 years ago
Unverified
8761bbc52cf51cea484754b3a8f176c9952051ce

added og-title and description fallback

ll4ci committed 7 years ago
Unverified
574c4aa10b37df826b561e0ca4ab83d837fc0a33

added xml sitemap

ll4ci committed 7 years ago

README

The README file for this repository.

Kirby SEO & Open Graph Plugin Readme

Version License Kirby Version

Version 1.0.1

Plugin for Kirby CMS to add seo relevant meta- and open graph data to templates and blueprints, for easy editing these information via the kirby panel. Also adds the option for a robots.txt which can be altered through the config.

Installation

Use one of the alternatives below.

1. Kirby CLI

If you are using the Kirby CLI you can install this plugin by running the following commands in your shell:

$ cd path/to/kirby
$ kirby plugin:install l4ci/kirby-seo-og-plugin

2. Clone or download

  1. Clone or download this repository.
  2. Unzip the archive if needed and rename the folder to seo.

Make sure that the plugin folder structure looks like this:

site/plugins/seo/

3. Git Submodule

If you know your way around Git, you can download this plugin as a submodule:

$ cd path/to/kirby
$ git submodule add https://github.com/l4ci/kirby-seo-og-plugin site/plugins/seo

Setup

1. Blueprint

To make it work as expected, add the following code to your blueprints, where you want the meta and open graph data fields to show up in the panel.

fields:
  metadata:
    extends: metadata
  opengraph:
    extends: opengraph

2. Template

Add prefix="og: http://ogp.me/ns#" to your <html> element. So it will look like this:

<html lang="en" prefix="og: http://ogp.me/ns#"

3. Snippet

Add the following code to your header.php snippet (or the fitting one) within your <head>.

snippet('seo.meta');
snippet('seo.opengraph');

4. Config

Enable the plugin by adding the following to your site/config/config.php:

c::set('seo', true);

Usage

Once the snippets and blueprints are added, and the plugin is enabled in your config.php. You can edit the meta- and open graph data easily via the kirby panel for your enabled pages. The following fields can be edited:

Meta fields:

  • Meta title
  • Meta description
  • Meta robots index/noindex
  • Meta robots follow/nofollow

Open Graph fields:

  • Open Graph title
  • Open Graph description
  • Open Graph image

Options

The following options can be set in your /site/config/config.php file:

// En/disable the whole plugin
//  - Disabled by default
c::set('seo', true);

// Show/hide HTML comments around the added snippets
//  - Disabled by default
c::set('seo.debug', false);

// Only en/disable output of the meta data snippet
//  - Enabled by default
c::set('seo.meta.disable', false);

// Only en/disable output of the open graph snippet
//  - Enabled by default
c::set('seo.opengraph.disable', false);

// You can define the og:type for specific templates here
// e.g. og:type=article for blog/newsposts
// leave it out and the default is used
//  - og:type=website by default
c::set('seo.ogtypes', [
    'newspost' => 'article',
    'blogpost' => 'article',
    'userpage' => 'profile'
]);

// En/disable robots.txt
// - Enabled by default
c::set('seo.robots.txt', true);

// You can even set the content yourself
c::set('seo.robots.txt', '
User-agent: *
Disallow: /
Sitemap: http://url.tld/sitemap.xml
');

Changelog

1.0.1

  • added robots.txt route

1.0.0

  • Initial release

Todo

  • [ ] add XML Sitemap
  • [ ] add support for JSON-LD
  • [x] add robots.txt route
  • [x] Basic Meta Data
  • [x] Open Graph Data

Requirements

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.

License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.