Redirect Posts and Pages using Jekyll on GitHub Pages

Jekyll is a widely popular Ruby gem among developers as a static GitHub Pages platform hosted on platforms like GitHub Pages. Jekyll is indeed a powerful yet easy-to-use tool to create websites and personal blogs.

Ever wanted to create link posts in Jekyll? Or just list links as blog posts in Jekyll? To redirect Jekyll pages or posts to another URL, you’ll need jekyll-redirect-from gem. You can install this gem with the following command:

gem install jekyll-redirect-from

Now, add the following lines to your _config.yml file as list of your gems or plugins.

 - jekyll-redirect-from

Now, in the front matter of the Jekyll post or page you would like to redirect, add the URL to redirect using following syntax.

 - https://db.fyi

For example:

layout: post
category: trivia
title: My Medium.com Blog
excerpt: I've created a medium.com account and some of my serious thoghts will reside there. You can follow me on Medium at [email protected]
 - https:[email protected]

On GitHub pages, you’ll have the plugin┬ájekyll-redirect-from already installed. The only thing you need to do is list the gem in the configuration file and add redirection URL in the front matter of the post or page you would like to redirect.

Leave a Reply