Skip to content

Add support for link redirects #552

Closed
@bmorelli25

Description

@bmorelli25

Summary

@colleenmcginnis has opened two PRs to add cross-repo links to asciidocalypse and docs-content:

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:

  1. A file move or rename in one repo breaks links in other repos.
  2. Those links can't be updated until the file move is complete.
  3. 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:

  1. Instead of immediately breaking cross-repo links when a page is moved, writers can declare the move in a redirects.yml file.
  2. Writers move the file
  3. Merge the PR
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions