Jekyll Redirect From screenshot

Jekyll Redirect From

Author Avatar Theme by Jekyll
Updated: 22 Sep 2024
807 Stars

:twisted_rightwards_arrows: Seamlessly specify multiple redirections URLs for your pages and posts.

Overview

The JekyllRedirectFrom gem is a tool that allows users to give Jekyll posts and pages multiple URLs. This is useful when importing posts and pages from platforms like Tumblr, where it would be impractical to create new pages in the proper subdirectories. Instead of manually maintaining pages for redirection, the gem handles the redirects by serving an HTML file with an HTTP-REFRESH metatag pointing to the desired destination.

Features

  • Multiple URLs: The gem allows authors to specify multiple URLs for a page, redirecting alternative URLs to the new Jekyll URL.
  • Automatic HTML Creation: No additional files or configurations are needed as the gem simply creates HTML files for redirection.
  • Customizable Redirect Template: Users have the option to customize the redirect template by creating a layout in the site’s _layouts directory called redirect.html.
  • Prefix Support: If the site.url is set, it can be used as a prefix for the redirect URL along with site.baseurl.
  • Redirect To External Websites: The gem also supports redirecting a site page to a different website using the redirect_to key.

Installation

To install the JekyllRedirectFrom gem, add the following line to your application’s Gemfile:

gem 'jekyll-redirect-from'

Then, execute the command:

bundle install

Alternatively, you can install the gem manually by running:

gem install jekyll-redirect-from

Once installed, add it to your _config.yml file. If you are using Jekyll version less than 3.5.0, use the gems key instead of plugins. If you’re using Jekyll in safe mode, make sure to add jekyll-redirect-from to your whitelist before running jekyll <cmd> --safe.

Summary

Overall, the JekyllRedirectFrom gem is a useful tool for managing redirects in Jekyll. It simplifies the process of creating and maintaining redirects, allowing authors to specify multiple URLs for a page. The gem handles the redirects by serving HTML files with HTTP-REFRESH metatags. It also provides customization options for the redirect template and supports redirecting to external websites.