Description
Summary
@colleenmcginnis has opened two PRs to add cross-repo links to asciidocalypse and docs-content:
- https://github.com/elastic/asciidocalypse/pull/75
- Use cross-repo links, update recently available local links docs-content#510
However, after discussion with @lcawl, @shainaraskas, and @KOTungseth, it's become clear that merging these cross-repo link updates will make moving or renaming documentation files significantly more difficult. We’re introducing a chicken-and-egg problem where:
- A file move or rename in one repo breaks links in other repos.
- Those links can't be updated until the file move is complete.
- But the file move can't be completed without updating the links.
This creates means writers will have to coordinate multiple PRs, merged in a specific order, across multiple repos just to move or rename a file.
Proposed solution
We need a way for writers to indicate when a page has moved so that the link checker can resolve links to a different file at build time.
To do this, we could add a redirect mapping file to all repositories. This file would be uploaded to AWS as a part of our links.json process, and would allow the link checker to interpret and resolve moved pages dynamically. By 9.0, this should also include redirect generation, but for now, resolving links at build time is the primary goal.
Writer process
This solution would lead to the following workflow:
- Instead of immediately breaking cross-repo links when a page is moved, writers can declare the move in a redirects.yml file.
- Writers move the file
- Merge the PR
- Go to other repos and merge PRs updating the now outdated links
There is no chicken/egg scenario and no rush to ensure PRs are merged quickly (thus preventing duplicate content in repos).
Example implementation
A YAML file that tracks moved pages:
redirects:
- moved_page:
old_page: /docs/kibana/page.md*
new_page: /docs/kibana/guide/page.md*
Anchors
Writers need a way to specify whether all anchors on the page move (redirect) or only specific ones. This is required as moving pages sometimes means splitting content into multiple files.