Add docs redirect raketask
What does this MR do?
Automate the process defined under https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page
Given two arguments, oldpath and newpath, replaces the contents of oldpath with the following template:
---
redirect_to: 'newpath'
---
This document was moved to [another location](newpath).
<!-- 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 -->
-
Since we're removing redirects older than 3 months or 1 year (relative and external URLs respectively), add a check to add the date YYYY-MM-DDautomatically. -
Given both paths are relative, calculate the relative path between them. -
Given the new path is an external URL, use that in the template. -
Redirecting to anchored URLs works. -
If the old path doesn't exist, the Rake task fails.
Real example to test:
cp doc/integration/azure.md doc/administration/auth/azure.md
bin/rake "gitlab:docs:redirect[doc/integration/azure.md,doc/administration/auth/azure.md]"
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because it's a development change.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Edited by Achilleas Pipinellis