From bf122da77152d3a0db08dcf1a1f2402e8d8d2324 Mon Sep 17 00:00:00 2001 From: "Eric A. Meyer" Date: Fri, 15 Sep 2023 12:20:35 -0400 Subject: [PATCH 1/2] Added redirect capability; see redirects.md for more, including limitations --- _includes/redirect.njk | 14 ++++++++++++++ redirects.md | 27 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 _includes/redirect.njk create mode 100644 redirects.md diff --git a/_includes/redirect.njk b/_includes/redirect.njk new file mode 100644 index 000000000..d18fcfa78 --- /dev/null +++ b/_includes/redirect.njk @@ -0,0 +1,14 @@ + + + + + + + + +

If you can see this, you should be redirecting this URL to {{ redirect.to }}.

+ + \ No newline at end of file diff --git a/redirects.md b/redirects.md new file mode 100644 index 000000000..b12f3f01d --- /dev/null +++ b/redirects.md @@ -0,0 +1,27 @@ +--- +# SOURCE: https://github.com/11ty/eleventy/issues/510#issuecomment-824104799 +# See also: _includes/redirect.njk +# +# This file does hijinx with the "pagingation" system to generate many small pages from one set of data... +# and uses that do to redirects from some URLs to others. +# We use this to try to keep old links working. +# +# There's limited power to this approach (it only works for specific pages listed; it can't glob), +# but those are limitations inherent to an approach that works via static site gen, rather than via server configuration. +# The related upside of an approach that works via static site gen is the portability. +pagination: + data: redirects + size: 1 + alias: redirect + +# Add your redirection tuples to this list! +redirects: + - {"from": "/about/get-started.html", "to": "/about/get-wpe.html"} + - {"from": "/code/", "to": "/about/get-wpe.html"} + +# The "permalink" attribute determines where the output page will be located. +permalink: "{{ redirect.from }}" + +# The "redirect" layout just has a small html header with the meta tags that do redirection. +layout: redirect +--- \ No newline at end of file From b89dc85e49d6f296d6272209cfdd351ab7034a5b Mon Sep 17 00:00:00 2001 From: "Eric A. Meyer" Date: Fri, 15 Sep 2023 13:01:46 -0400 Subject: [PATCH 2/2] Added another redirect --- redirects.md | 1 + 1 file changed, 1 insertion(+) diff --git a/redirects.md b/redirects.md index b12f3f01d..355d02735 100644 --- a/redirects.md +++ b/redirects.md @@ -17,6 +17,7 @@ pagination: # Add your redirection tuples to this list! redirects: - {"from": "/about/get-started.html", "to": "/about/get-wpe.html"} + - {"from": "/about/explore-wpe.html", "to": "/about/get-wpe.html"} - {"from": "/code/", "to": "/about/get-wpe.html"} # The "permalink" attribute determines where the output page will be located.