Cecil logo Cecil
What's on this page

Redirect old URLs

When a page moves or is renamed, its old URL should not lead to a 404 error. Cecil provides two front matter variables to handle this: alias and redirect.

Redirect old URLs to a page

The alias variable lists the old paths of the current page. Each of them redirects to the page:

---
title: About
alias:
  - contact
  - about-us
---

In this example, /contact/ and /about-us/ redirect to /about/.

Redirect a page to another URL

The redirect variable turns a page into a redirection to the given URL, internal or external:

---
title: Old documentation
redirect: "https://cecil.app/documentation/"
---

Without a Markdown file

If the old page has no content anymore, declare it as a virtual page in cecil.yml:

pages:
  virtual:
    - path: code
      redirect: https://github.com/Cecilapp/Cecil

Generated pages

For each alias and each redirection, Cecil renders a page with the built-in redirect.html.twig template. It contains:

  • a <link rel="canonical"> to the target URL
  • a <meta name="robots" content="noindex"> tag, so search engines don’t index it
  • a <meta http-equiv="refresh"> tag and a JavaScript redirection
  • a fallback link for visitors