Commit 0efa2544 authored by Craig Norris's avatar Craig Norris

Merge branch 'docs-update-redirect-inst' into 'master'

Update redirect instructions for clarity

See merge request gitlab-org/gitlab!53754
parents 48747811 ecb97f12
...@@ -161,95 +161,69 @@ Nanoc layout), which is displayed at the top of the page if defined: ...@@ -161,95 +161,69 @@ Nanoc layout), which is displayed at the top of the page if defined:
## Move or rename a page ## Move or rename a page
Moving or renaming a document is the same as changing its location. Moving or renaming a document is the same as changing its location. Be sure to
Be sure to assign a technical writer to any MR that renames or moves a page. Technical assign a technical writer to any merge request that renames or moves a page.
Writers can help with any questions and can review your change. Technical Writers can help with any questions and can review your change.
When moving or renaming a page, you must redirect browsers to the new page. This When moving or renaming a page, you must redirect browsers to the new page.
ensures users find the new page, and have the opportunity to update their bookmarks. This ensures users find the new page, and have the opportunity to update their
bookmarks.
There are two types of redirects: There are two types of redirects:
- Redirect files added into the docs themselves, for users who view the docs in `/help` - Redirect codes added into the documentation files themselves, for users who
on self-managed instances. For example, [`/help` on GitLab.com](https://gitlab.com/help). view the docs in `/help` on self-managed instances. For example,
- Redirects in a [`_redirects`](../../user/project/pages/redirects.md) file, for users [`/help` on GitLab.com](https://gitlab.com/help).
who view the docs on <https://docs.gitlab.com>. - [GitLab Pages redirects](../../user/project/pages/redirects.md),
for users who view the docs on [`docs.gitlab.com`](https://docs.gitlab.com).
The Technical Writing team manages the [process](https://gitlab.com/gitlab-org/technical-writing/-/blob/master/.gitlab/issue_templates/tw-monthly-tasks.md)
to regularly update the [`redirects.yaml`](https://gitlab.com/gitlab-org/gitlab-docs/-/blob/master/content/_data/redirects.yaml)
file.
To add a redirect: To add a redirect:
1. In an MR in one of the internal docs projects (`gitlab`, `gitlab-runner`, `omnibus-gitlab` 1. Create a merge request in one of the internal docs projects (`gitlab`,
or `charts`): `gitlab-runner`, `omnibus-gitlab`, or `charts`), depending on the location of
1. Move or rename the doc, but do not delete the old doc. the file that's being moved, renamed, or removed.
1. In the old doc, add the redirect code for `/help`. Use the following template exactly, 1. To move or rename the documentation file, create a new file with the new
and only change the links and date. Use relative paths and `.md` for a redirect name or location, but don't delete the existing documentation file.
to another docs page. Use the full URL to redirect to a different project or site: 1. In the original documentation file, add the redirect code for
`/help`. Use the following template exactly, and change only the links and
```markdown date. Use relative paths and `.md` for a redirect to another documentation
--- page. Use the full URL (with `https://`) to redirect to a different project or
redirect_to: '../path/to/file/index.md' site:
---
```markdown
This document was moved to [another location](../path/to/file/index.md). ---
redirect_to: '../path/to/file/index.md'
<!-- This redirect file can be deleted after <YYYY-MM-DD>. --> ---
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
``` This document was moved to [another location](../path/to/file/index.md).
Redirect files linking to docs in any of the 4 internal docs projects can be <!-- This redirect file can be deleted after <YYYY-MM-DD>. -->
removed after 3 months. Redirect files linking to external sites can be removed <!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
after 1 year. ```
1. If the document being moved has any Disqus comments on it, follow the steps Redirect files linking to docs in any of the internal documentations projects
described in [Redirections for pages with Disqus comments](#redirections-for-pages-with-disqus-comments). are removed after three months. Redirect files linking to external sites are
1. If a documentation page you're removing includes images that aren't used removed after one year.
with any other documentation pages, be sure to use your MR to delete
those images from the repository. 1. If the documentation page being moved has any Disqus comments, follow the steps
1. Assign the MR to a technical writer for review and merge. described in [Redirections for pages with Disqus comments](#redirections-for-pages-with-disqus-comments).
1. If the redirect is to one of the 4 internal docs projects (not an external URL), 1. If a documentation page you're removing includes images that aren't used
create an MR in [`gitlab-docs`](https://gitlab.com/gitlab-org/gitlab-docs): with any other documentation pages, be sure to use your merge request to delete
1. Update [`content/_data/redirects.yaml`](https://gitlab.com/gitlab-org/gitlab-docs/-/blob/master/content/_data/redirects.yaml) those images from the repository.
with one redirect entry for each renamed or moved file. This code works for 1. Assign the merge request to a technical writer for review and merge.
<https://docs.gitlab.com> links only. Keep them alphabetically sorted: 1. Search for links to the original documentation file. You must find and update all
links that point to the original documentation file:
```yaml
- from: /ee/path/to/old_file.html
to: /ee/path/to/new_file.html
remove_date: YYYY-MM-DD
```
The path must start with the internal project directory `/ee`,
`/runner`, `/omnibus` or `/charts`, and end with either `.html` or `/`
for a clean URL.
If the `from:` redirect is an `index.html` file, add a duplicate entry for
the `/` URL (without `index.html). For example:
```yaml
- from: /ee/user/project/operations/index.html
to: /ee/operations/index.html
remove_date: 2021-11-01
- from: /ee/user/project/operations/
to: /ee/operations/index.html
remove_date: 2021-11-01
```
The `remove_date` should be one year after the redirect is submitted.
1. Run the Rake task in the `gitlab-docs` project to populate the `_redirects` file:
```shell
bundle exec rake redirects
```
1. Add both `content/_redirects` and `content/_data/redirects.yaml` to your MR.
1. Search for links to the old file. You must find and update all links to the old file:
- In <https://gitlab.com/gitlab-com/www-gitlab-com>, search for full URLs: - In <https://gitlab.com/gitlab-com/www-gitlab-com>, search for full URLs:
`grep -r "docs.gitlab.com/ee/path/to/file.html" .` `grep -r "docs.gitlab.com/ee/path/to/file.html" .`
- In <https://gitlab.com/gitlab-org/gitlab-docs/-/tree/master/content/_data>, - In <https://gitlab.com/gitlab-org/gitlab-docs/-/tree/master/content/_data>,
search the navigation bar configuration files for the path with `.html`: search the navigation bar configuration files for the path with `.html`:
`grep -r "path/to/file.html" .` `grep -r "path/to/file.html" .`
- In any of the 4 internal projects. This includes searching for links in the docs - In any of the four internal projects. This includes searching for links in the docs
and codebase. Search for all variations, including full URL and just the path. and codebase. Search for all variations, including full URL and just the path.
In macOS for example, go to the root directory of the `gitlab` project and run: In macOS for example, go to the root directory of the `gitlab` project and run:
...@@ -260,8 +234,8 @@ To add a redirect: ...@@ -260,8 +234,8 @@ To add a redirect:
grep -r "path/to/file" . grep -r "path/to/file" .
``` ```
You may need to try variations of relative links as well, such as `../path/to/file` You may need to try variations of relative links, such as `../path/to/file` or
or even `../file` to find every case. `../file` to find every case.
### Redirections for pages with Disqus comments ### Redirections for pages with Disqus comments
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment