Redirect Posts and Pages using Jekyll on GitHub Pages

Learn how to redirect posts and pages on Jekyll to another URL. Use jekyll-redirect-from gem locally & add redirect_to to your front matter 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.


For example:

layout: post
category: trivia
title: My Blog
excerpt: I've created a 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.

Share on Facebook Tweet Share on Google+

Post a Comment