redirects same line, use in example post
This commit is contained in:
parent
5b73810bb3
commit
cada101891
2 changed files with 8 additions and 9 deletions
|
|
@ -3,12 +3,10 @@ permalink: /_redirects
|
|||
eleventyExcludeFromCollections: true
|
||||
excludeFromSitemap: true
|
||||
---
|
||||
|
||||
{% for page in collections.all %}
|
||||
{% if page.url and page.data.redirectFrom %}
|
||||
{% for oldUrl in page.data.redirectFrom %}
|
||||
{{ oldUrl }}
|
||||
{{ page.url }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{%- for page in collections.all -%}
|
||||
{%- if page.url and page.data.redirectFrom -%}
|
||||
{%- for oldUrl in page.data.redirectFrom %}
|
||||
{{ oldUrl }} {{ page.url }}
|
||||
{%- endfor %}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
|
@ -3,6 +3,7 @@ title: 'Post with 301 redirects'
|
|||
description: 'A 301 is used when a page has permanently changed location. Informing about this change is indispensable if you want to keep a positioning. Aleksandr Hovhannisyan came up with an elegant solution for Eleventy and Netlify.'
|
||||
date: 2022-08-28
|
||||
tags: ['redirects', 'feature']
|
||||
redirectFrom: ['/old-route/', '/optionally-another-old-route/']
|
||||
---
|
||||
|
||||
URLs usually change over time, as you use another CMS or optimize your file structure.
|
||||
|
|
|
|||
Loading…
Reference in a new issue