Clever redirects
Instead of relying on https://docs.gitlab.com/ce/development/doc_styleguide.html#changing-document-location and https://gitlab.com/gitlab-com/gitlab-docs/blob/9dd5d4a7017ae2e430d5bb5c18b30a418bc3c8da/Rules#L6-12 to create the redirect pages, we should be more clever.
There are two ways to implement this.
First way
Source: https://gist.github.com/axilleas/f7236be8f1be84664e18035bec4a7971
Create a redirects.yml
or redirects.csv
(like Docker does).
- Under each project's doc dir a
redirects.yml
will contain the redirects (all relative to the doc dir) - Nanoc will use the
redirect.html
template https://gitlab.com/gitlab-com/gitlab-docs/blob/master/layouts/redirect.html and turn those links into HTML files
With this, we will be able to finally remove moved files that live under each project's doc dir, so this is also good for cleanup reasons as well.
Below is how an example yaml:
- source: hooks/custom_hooks.md
dest:
- source: monitoring/health_check.md
dest:
- source: monitoring/performance/grafana_configuration.md
dest:
- source: monitoring/performance/introduction.md
dest:
Second way
Source: https://github.com/gjtorikian/nanoc-redirector
That's more efficient and works like Jekyll's redirect plugin.