skip to Main Content

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


  1. Chosen as BEST ANSWER

    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:

    1. Create a new directory in the repo at /docs/_layouts.
    2. Download the raw HTML of the default.html file from the Minimal theme, based on these instructions.
    3. Copy that default.html file to /docs/_layouts.
    4. Add this to the _config.yml file in /docs to enable the Jekyll SEO Tag to run on GitHub Pages, based on these instructions:

      gems:
        - jekyll-seo-tag
      
    5. 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.

    6. Add 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.


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search