middleman-ogp
is an extension for the Middleman static site generator that adds OpenGraph Protocol support.
activate :ogp do |ogp|
#
# register namespace with default options
#
ogp.namespaces = {
fb: data.ogp.fb,
# from data/ogp/fb.yml
og: data.ogp.og
# from data/ogp/og.yml
}
ogp.base_url = 'http://mysite.tld/'
end
Create data/ogp/fb.yml
and data/ogp/og.yml
files.
Example:
image:
"": http://mydomain.tld/path/to/fbimage.png
secure_url: https://secure.mydomain.tld/path/to/fbimage.png
type: image/png
width: 400
height: 300
locale:
"": en_us
source/layout.slim
html
head
meta charset="utf-8"
title= data.page.title
- ogp_tags do|name, value|
meta property=name content=value
body
.container
= yield
Page data overrides default options. (deep merge).
---
ogp:
og:
description: "This is my fixture Middleman site."
image:
"": http://mydomain.tld/path/to/fbimage.png
secure_url: https://secure.mydomain.tld/path/to/fbimage.png
type: image/png
width: 400
height: 300
locale:
"": en_us
alternate:
- ja_jp
- zh_tw
fb:
description: "This is my fixture Middleman site."
image:
"": http://mydomain.tld/path/to/fbimage.png
secure_url: https://secure.mydomain.tld/path/to/fbimage.png
type: image/png
width: 400
height: 300
---
# Hello
This is the **content**
middleman-ogp
supports adding article properties like article:published_time
, article:tag
automatically for middleman-blog articles.
Set ogp.blog
to true
in your configuration. (Defaults to false
)
activate :ogp do |ogp|
#
# register namespace with default options
#
ogp.namespaces = {
fb: data.ogp.fb,
# from data/ogp/fb.yml
og: data.ogp.og
# from data/ogp/og.yml
}
ogp.blog = true
end
Copyright (c) 2014-2020 Atsushi Nagase. MIT Licensed, see LICENSE for details.