Is there a way to use cross references instead of links? #8281
-
AsciiDoc uses Does anything like this exist in the MkDocs/MkDocs Material ecosystem? If not, how are large projects managing internal linking and avoiding breakage? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @stoobie, One could be the plugin which will generate the relative paths for you, assuming the Markdown file name is unique. This approach is sort of hands-off, which I think is what you want. Another approach would be to use some sort of semi-automatic redirect creation for pages that have been moved:
I once took this approach and adjusted it to work with git history, so it would detect Rename / Move actions in git and configure the redirects. However, this too wasn't perfect as it required to take care to properly commit changes as Rename / Move type, so not completely hands-off, also the same cons apply as above apart of being more automatic: MkDocs process pages sequentially, one after the other, so any solution where you store references* to pages and allow to cross-link them in Markdown would require some custom solution. Maybe there is already one, but I missed it in the catalog. * Other than their filename (used in the plugin above), like some kind of short handle / ID |
Beta Was this translation helpful? Give feedback.
Hi @stoobie,
there is no built-in way to do that, but there were multiple attempts in the community to help with that and partially solve the issue.
One could be the plugin which will generate the relative paths for you, assuming the Markdown file name is unique. This approach is sort of hands-off, which I think is what you want.
https://github.com/zachhannum/mkdocs-autolinks-plugin
Another approach would be to use some sort of semi-automatic redirect creation for pages that have been moved:
The approach adds some overhead, and isn't perfect since the redirects would be static pages with a redirect link, so no a true 404/403 HTTP status code.
I once took this approach and adjusted…