Andy Crouch - Code, Technology & Obfuscation ...

Improving SEO For Your Jekyll Site

Photo: Victor Hughes - unsplash.com

Search Engine Optimisation (SEO) refers to how you increase the quality and quantity of organic traffic to your web site. There are many articles and tools available covering best practices. I would suggest this article to start with and then research the various points. Getting your sites SEO right is critical. It will increase your chances of people finding your content in search engines.

Working on a new site for Open Energy Market has made me investigate how well this blog is optimised. One of the first things I wanted to improve was its SEO score on web.dev. Before making the changes in this post the score started at 49.

I have written before about how I build this site with Jekyll. After a little Jekyll SEO optimisation research, I discovered the Jekyll SEO Tag gem. The gem automatically generates recommended SEO meta tags for each page and post in your site. The following are some of the tags created as part of the configuration and content of the site:

  • Page title. This will be generated with the site title and/or description appended.
  • Page description. If you use a description tag in your forward matter this will be generated otherwise it will be skipped.
  • Canonical URL. The fully qualified URL to your post or page.
  • Next and previous URLs on paginated pages. When generated on a paginated page, the gem will include the URLs for the next and previous pages.
  • JSON-LD Site and post metadata for richer indexing. This moz.com article covers the use of this tag,

See the Github documentation for a full list of tags that can be configured and generated.

To install jekyll-seo-tag you need to add the following to your Gemfile:

$ gem 'jekyll-seo-tag'

Next, you need to add the plugin in your sites _config.yml:

plugins:
  - jekyll-seo-tag

And finally you need to add the following on the line before your </head> tag:

{ % seo % }

(Without the spaces between the brackets and the % character. Shown as such here to prevent Jekyll from compilling the command) e.classList.remove(“lazy”); Once these settings are added you can run:

$ gem install jekyll-seo-tag

That will install the plugin. Once you start your site back up and view the page source you will see the tags and the content generated by the plugin. On re-running web.dev my SEO score had increased to 92. This is without adding specific keywords or any other changes.

I will write up in a future post other optimisations for SEO as I decide on the ones to implement. For now, the little work it took to add this useful plugin is well worth it.

If you have any suggestions or questions about this post then please contact me via twitter or email.