Reputation: 23
When building a site using jekyll-redirect-from
, I am encountering a strange error when redirecting from an old route of a page that includes a file extension (e.g. the-old-route.md
) in the web browser.
Rather than performing the redirect to the new route, the server responds with the HTTP header Content-Type: text/markdown
but an HTML document in the body:
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>Redirecting…</title>
<link rel="canonical" href="http://localhost:4000/the-new-route">
<script>location="http://localhost:4000/the-new-route"</script>
<meta http-equiv="refresh" content="0; url=http://localhost:4000/the-new-route">
<meta name="robots" content="noindex">
<h1>Redirecting…</h1>
<a href="http://localhost:4000/the-new-route">Click here if you are not redirected.</a>
</html>
The browser shows this HTML code as text and doesn't run the redirect.
I see the same behavior locally and when the page is hosted in GitHub Pages.
When redirecting from an old route that does not contain a file extension, everything works as expected. Is this a bug with jekyll-redirect-from
or are routes with file extensions simply not supported?
The page front-matter looks like:
---
layout: some-layout
title: A Page
permalink: /the-new-route
redirect_from: the-old-route.md
---
Upvotes: 0
Views: 107