Last active
March 20, 2025 09:04
-
-
Save davidensinger/5431869 to your computer and use it in GitHub Desktop.
Adding Open Graph Tags to Jekyll
Couldn't this fit in nicely with Jekyll core? Any particular reason why you haven't made a pull request? Would be very nice for places like talk.jekyllrb.com as well, since then the Discourse forum would be able to OneBox Jekyll news posts automatically.
Can we modify this to support a post instead of a page?
For some of these fields, should they use | escape
?
Line 18:
<meta content="{{ site.url }}{{ page.url }}" property="og:url">
Jekyll sites can be hosted at a path deeper than the domain root (e.g. GitHub Project Pages are at <username>.github.io/<projectname>
), which is usually indicated with site.baseurl
. For maximum generality, I would recommend, for Jekyll 3.3 and later, that this line be changed to:
<meta content="{{ page.url | absolute_url }}" property="og:url">
and for earlier versions of Jekyll that don't support the absolute_url
filter,
<meta content="{{ site.url | append: site.baseurl | append: page.url }}" property="og:url">
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For more information, please see my post on Adding Open Graph Tags to Jekyll.