Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more detail and examples to redirect guidance #1071

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions src/contributing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,27 @@ There are two approaches to redirects in the playbook and they solve different i

#### jekyll-redirect-from gem

A redirect_from entry can be added to a page's front matter - this works for redirecting
one page to another, and includes keeping the same hash fragment. This is powered by the
jekyll-redirect-from gem and requires developer assistance. This is the preferred approach
as it keep redirects tied coupled closely to the content.
A `redirect_from` entry can be added to a page's front matter - this works for redirecting
one page to another and retaining section-specific linking via the hash fragment (if present).

This is powered by the `jekyll-redirect-from` gem (with section/hash support via the
`redirect.html` template), and requires developer assistance. This is the preferred approach
as it keeps redirect information tightly coupled to the content.

Example situations:

- `old_page` → `new_page`
- `old_page#section` → `new_page#section`

#### Redirect manager

There is a redirect manager in the Netlify CMS. Within this admin section you can enter
a `redirect from` and a `redirect to` value. This currently enables redirecting on some
pages which do not support the jekyll-redirect-from gem. If you create an entry in this section please test it once the build has completed.
a `redirect from` and a `redirect to` value. This enables redirects (powered by
`redirect.js`) which are not supported by the `jekyll-redirect-from` gem, such as
redirecting what was previously a single section of a page to a new dedicated page. If
you create an entry in this section please test it once the build has completed.

Example situations:

- `old_page#section_one` → `new_page_one`
- `old_page#section_two` → `new_page_two`