Add Redirect Feature #81
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds redirect functionality to the website through the following
redirectshas been created. The data for this collection is generated by the.config/collections/redirect.jsmodule. In here, you can manually add redirects if needed for any future reasons./article/**/*.mddocuments so that the old style links will redirect to the new style links and SEO isn't lost._includes/layouts/redirect.layout.njk<meta>refresh method to redirect the user to the correct url.<meta name="robots" content="noindex""/>tag for robots/crawlers to inform them to not index the old page<link rel="canonical">tag which informs search engines such as Google that thehrefbeing redirected to should be the canonical url for that page so that search engines will update over time.content/redirects.mdpermalinkfrontmatter to specify where the redirect page will be output to which is the old page url.With these files, when the site is built, the
redirectscollection is autogenerated and handled by thecontents/redirect.md` file to generate the individual redirect pages for all urls that require redirects.Note
Typically for redirects you would want the HTTP Response to be an HTTP 301: Permanent Redirect response. However, since this is a static website served from GitHub pages, we don't have control over the HTTP response that is sent, so this is the closest we can get to redirecting while also including tags to tell search engines to update over time.
Related Issues
This is a feature implementation for Issue #78