I have a simple index.md
page in a GitHub repo and I’m publishing it via the GitHub Pages “Minimal” theme. I am not using Jekyll locally at all; I’m relying on Pages to render the Markdown to HTML. I’d like to add some Open Graph metadata in the head to improve the SEO and sharing utility of the page.
Looking at the Minimal theme’s code, it would appear that there’s no way to add anything to the <head>
. Am I missing something, or are the GitHub themes limited in that way? It seems like overkill to install Jekyll just to create a single page, so I’m trying to avoid that.
2
Answers
Thanks to marcanuy's answer above, I was able to get the Open Graph metadata added to the page. Here are the steps I followed:
/docs/_layouts
.default.html
file from the Minimal theme, based on these instructions.default.html
file to/docs/_layouts
.Add this to the
_config.yml
file in/docs
to enable the Jekyll SEO Tag to run on GitHub Pages, based on these instructions:Edit
default.html
to include{% seo %}
in the<head>
, in order to trigger the SEO gem when the page is published. I also removed the existing<title>
tag from the Minimal template, since the plugin inserts its own title.description:
,logo:
,author:
, etc. to the_config.yml
file, based on the SEO tag instructions. These could also be added to individual.md
files, but I have just one in this case.After pushing these changes to GitHub, the Open Graph and other metadata started appearing in the
<head>
of the rendered page.Yes it is possible, just copy theme files to the jekyll instance at root and edit them as you wish, Jekyll will use these files before looking for theme ones.
Or you can use the jekyll-seo-tag plugin that will add OpenGraph metadata automatically for you based on your pages description, title, etc and is used by github-pages gem.