A Jekyll layout that redirects to a new page without using jekyll-redirect-from
plugin.
For some Jekyll sites, setting up URL re-writes or HTTP 301 Moved Permanently response codes on HTTP web servers (such as Apache or NGINX) is not possible. If you reorganise your site, external links to your original pages will be broken, which is not a great web experience.
The redirect layout creates an HTML redirection page from the original page URL to its new location.
_layouts/redirection.html
file to your Jekyll _layouts
folder._redirects
folder, adding it to the include:
section of your _config.yml
.permalink
and redirect
front matter settings.---
layout: redirection
permalink: /path/to/original/page/
redirect: /path/to/correct/page/
---
NB: The layout has been renamed from redirect.html
to redirection.html
to avoid interference with jekyll-redirect-from plugin.