Dealing with Jekyll Tags and Case Sensitivity

Published: July 24, 2017

Tags:

To the chagrin of some, tags in Jekyll are case sensitive. This means that “MySQL” and “mysql” are not the same tag.

No matter whether you’re using jekyll-archives for your tag archives pages, or a custom solution, it’s likely that you’ve felt some pain as a result of case sensitivity. I recently went through every post on this blog and to add consistent casing to my tags.

Here I’ll outline a solution I’ve developed to help alleviate the pain of dealing with case sensitivity and tags in Jekyll.

Introducing jekyll-pre-commit

In January of 2017, I published v0.1.0 of jekyll-pre-commit. The tagline…

A Jekyll plugin to make sure your post is _really_ ready for publishing

jekyll-pre-commit is a tool that uses git pre-commit hooks to run checks before allowing you to commit changes. For example, you can make sure that your post’s meta description meets best practice SEO length requirements.

Now, I’ve updated the gem to v0.2.1 and added a new check “NoDuplicateTags” to help make sure you case sensitivity doesn’t cause any issues when you’re tagging posts.

When enabled this check will run through the all tags in any post that’s staged for commit and confirm that there are no duplicates in other posts throughout your site. If it does find any duplicates, it will tell you about them and prevent you from committing.

jekyll-pre-commit feedback when NoDuplicateTags fails

Follow the installation instructions to get started with jekyll-pre-commit. The project is 100% free and open source.

I hope you find it useful!

Hi, I'm Max!

I'm a software developer who mainly works in PHP, but also dabbles in Ruby and Go. Technical topics that interest me are monitoring, security and performance.

During the day I solve challenging technical problems at Something Digital where I mainly work with the Magento platform. I also blog about tech, work on open source and hunt for bugs.

I built a tool called Domain Clamp which monitors and alerts about expiring domains and SSL certificates.

If you'd like to get in touch with me the best way is on Twitter.