pulp / pulp-docs

Python Package to help aggregating Pulp's multirepo ecosystem into a unified doc.
https://pedro-psb.github.io/pulp-docs/
2 stars 4 forks source link

Internal links: Absolute/Custom vs Relative #2

Closed pedro-psb closed 8 months ago

pedro-psb commented 8 months ago

Question:

Should we always use relative paths for internal links or use some custom solution for using absolute links?

This sample illustrates the difference in the usage of those options:

## Given a file structure:
guides/
    overview.md
    rpm/
        guide-1.md
getting-started/
    overview.md

# editing "guides/rpm/guide-1.md"
[link](../../getting-started/overview.md) # relative

# editing "guides/overview.md"
[link](../getting-started/overview.md) # relative (changed relative path)

# regardless of file being edited
[link](getting-started/overview.md) # absolute
[link](site:getting-started/overview.md) # custom (mkdocs-site-urls)
[link]({{base_url}}/getting-started/overview.md) # custom (mkdocs-macros-plugin)

Tradeoffs of using absolute

Cons

When using internal links, mkdocs recommends only using relative paths because absolute links (e.g. [link](/foo.md)) have some issues:

Pros

References

https://www.mkdocs.org/user-guide/writing-your-docs/#linking-to-pages https://github.com/mkdocs/mkdocs/issues/192 https://github.com/mkdocs/mkdocs/issues/1592

pedro-psb commented 8 months ago

After discussing with the workgroup, we've decided to use absolute links because it is easier for contributors.