You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clarify side effects of not setting site_url #1783
Do you have external links in your nav config? If so, then this is a duplicate of #1742, which was fixed in #1748 and will be available in the next release.
Sorry, but I'm not downloading random files from bug reports. You can include the relevant section of the config in a comment if you want to share it.
@brandongc lifesaver — we had this issue too and I never got around to debugging it. A bit harder to track down, cause it works fine with mkdocs serve (I bet there's an undocumented default value being injected)
@aeromusek you are correct. When using serve, the site_url setting is set to the value of dev_addr. This is necessary to avoid things breaking on the local server.
This seems to trip people up more than I expected. Perhaps we should make it a "required" setting as a number of things break without site_url defined. The problem with that is that requires a URL be defined immediately when a new project is just getting started. Sometimes its nice to play with things for a while before reaching the point where we think about the domain.
Either way, we probably should document this. And at the least do a better job of calling out the site_url setting as many new users are missing that this setting exists, let alone setting it.
The behavior makes total sense and is quite elegant, once it's clear how things are working. Jekyll actually does exactly the same thing.
The confusing part for me was having (seemingly random) things like the sitemap break without any clear reason. At the least, I think it would be helpful to add some additional details here, including that this value is used for more than just the canonical metatag, and that it's really not optional for a production environment.
I've edited the title to keep this issue as open as a documentation issue: not setting site_url can have some side-effects as the one described here (empty sitemap when building but not when serving).
Activity
waylan commentedon Apr 19, 2019
Do you have external links in your nav config? If so, then this is a duplicate of #1742, which was fixed in #1748 and will be available in the next release.
Sorry, but I'm not downloading random files from bug reports. You can include the relevant section of the config in a comment if you want to share it.
trel commentedon Apr 19, 2019
I saw a couple smart quotes in the nav listing - not sure if that could be relevant/responsible.
brandongc commentedon Apr 25, 2019
I found that if I do not have
site_urldefined in my yaml file then all of the<loc>tags areNone. Do you have that set?aeromusek commentedon May 30, 2019
@brandongc lifesaver — we had this issue too and I never got around to debugging it. A bit harder to track down, cause it works fine with
mkdocs serve(I bet there's an undocumented default value being injected)waylan commentedon May 30, 2019
@aeromusek you are correct. When using
serve, thesite_urlsetting is set to the value of dev_addr. This is necessary to avoid things breaking on the local server.This seems to trip people up more than I expected. Perhaps we should make it a "required" setting as a number of things break without
site_urldefined. The problem with that is that requires a URL be defined immediately when a new project is just getting started. Sometimes its nice to play with things for a while before reaching the point where we think about the domain.Either way, we probably should document this. And at the least do a better job of calling out the
site_urlsetting as many new users are missing that this setting exists, let alone setting it.brandongc commentedon May 31, 2019
Perhaps issuing a WARN or INFO on
mkdocs buildwhensite_urlis not defined?aeromusek commentedon May 31, 2019
The behavior makes total sense and is quite elegant, once it's clear how things are working. Jekyll actually does exactly the same thing.
The confusing part for me was having (seemingly random) things like the sitemap break without any clear reason. At the least, I think it would be helpful to add some additional details here, including that this value is used for more than just the canonical metatag, and that it's really not optional for a production environment.
A WARN or INFO also would be helpful.
Revert "Revert "Add site_url (required in mkdocs 1.2+)""
Fixes site map generation (#11)
Fixes site map generation (#11)
[-]Sitemap generated with empty url/loc tags[/-][+]Clarify side effects of not setting `site_url`[/+]pawamoy commentedon Apr 17, 2024
I've edited the title to keep this issue as open as a documentation issue: not setting
site_urlcan have some side-effects as the one described here (empty sitemap when building but not when serving).Add TODO for site url to allow auto sitemap generation