[go: up one dir, main page]

Skip to content

Support redirecting wiki pages to new URL on renaming them

Release notes

Problem to solve

When pages are renamed, the old page URL becomes a broken link. There is no facility to fix links in the rest of the wiki -- let alone the rest of the internet -- so a better course of action would be to redirect from the old page to the new page.

Similarly, people might look for specific page URLs, like "help" or "roadmap" and not find what they are looking for (e.g. the "roadmap" is in "development#roadmap", not on its own page).

Intended users

User experience goal

Users should be able to rename page and have the old name point to the new one. Users should also be able to point "vanity" URLs to longer page names (e.g. "roadmap" pointing to "development#roadmap").

Proposal

Previous proposal

Support the Gollum redirection system. This works by creating a .redirects.gollum YAML file which lists patterns like so:

---
Home.old.md: Home.md
subdir/Home.md: Home.md
tobemoved.md: wastobemoved.md

i would also add that we should be able to specify URL patterns (as opposed to source page names above), like so:

----
roadmap: development#roadmap

notice, in particular, the "fragment" (#roadmap) in the above.

Ideally, the page should also be automatically edited when a page is renamed.

This was attempted to be solved in !56392 (diffs), but I suggest a different approach to redirections since it was concluded that parsing a big routing table of redirections would cause a significant overload.

Approach:

  1. Each time you change the URL of the page, a file is left on the old path with just front matter in it that includes redirect: new_path.
  2. When the user visits the old path, we read the file on the old path and determine that a redirect needs to happen. We redirect the user to the new path with an alert on the top saying The page at old_path redirects here with two actions: Delete redirect, or Edit page at old_path.
  3. A page can be redirected to another page that is redirected again causing multiple redirects. We limit the number of redirects to say, 10. If the limit is reached, we show an alert saying Redirect limit reached. Same two actions: Delete redirect, or Edit page at old_path.
  4. If multiple pages redirect to each other, say A -> B, B -> C, C -> A, we hit a redirect loop. This can easily be detected. When scanning redirected files, we maintain a list of files that have already been visited. If a file is visited again, we detect a redirect loop and throw an error The page at old_path resulted in a redirect loop with the same options again: Delete redirect, or Edit page at old_path.

Further details

Permissions and Security

No special permission should be required for this.

Documentation

Availability & Testing

What does success look like, and how can we measure that?

What is the type of buyer?

Is this a cross-stage feature?

Links / references

Edited by Himanshu Kapoor