Skip to content
Discussion options

You must be logged in to vote

There is the site_url MkDocs config option that helps to set the same URL root on localhost and when deployed.
https://www.mkdocs.org/user-guide/configuration/#site_url

Thanks to that in our docs we create the links via absolute paths like this /root-dir-repository-name/path/to/asset.
Notice there is no ./ at the beginning just the / and the root part is the same as in site_url
https://github.com/Gothic-Modding-Community/gmc/blob/8e15b7922228dc961557c9f1570eba14ffb47e32/overrides/main.html#L38


Additionally there is the Jinja2 url filter function provided by MkDocs, it's used in the theme together with the assets:
{{ "relative_path_from_the_docs_directory" | url }}

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by akutz
Comment options

alexvoss
Sep 28, 2023
Collaborator Sponsor

You must be logged in to vote
4 replies
@squidfunk
Comment options

@akutz
Comment options

akutz Sep 28, 2023
Author Sponsor

@akutz
Comment options

akutz Sep 28, 2023
Author Sponsor

@squidfunk
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants