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!

Max Chadwick Hi, I'm Max!

I'm a software developer who mainly works in PHP, but loves dabbling in other languages like Go and Ruby. Technical topics that interest me are monitoring, security and performance. I'm also a stickler for good documentation and clear technical writing.

During the day I lead a team of developers and solve challenging technical problems at Rightpoint where I mainly work with the Magento platform. I've also spoken at a number of events.

In my spare time I blog about tech, work on open source and participate in bug bounty programs.

If you'd like to get in contact, you can find me on Twitter and LinkedIn.