canonical url is set to dev url #266

Open
opened 2025-01-21 12:41:03 +00:00 by fauno · 5 comments
Member

i'd provide a patch but not sure how to set this on mkdocs, the config seems ok, and the template (if i found the actual source code) uses page.canonical_url but i don't know how it's generated.

this affects how search engines index the site but discovered while trying to share a page from chrome for android.

i'd provide a patch but not sure how to set this on mkdocs, the config seems ok, and the template (if i found the actual source code) uses [page.canonical_url](https://github.com/squidfunk/mkdocs-material/blob/master/src/templates/base.html#L48) but i don't know how it's generated. this affects how search engines index the site but discovered while trying to share a page from chrome for android.
Owner

@fauno you mean you're seeing URLs with localhost / 0.0.0.0 in the generated output of the live site?

Maybe we're generating the site in dev mode when publishing? (😂)

It seems to be controlled by site_url which we do set.

Oh shiet:

compose.yml Line 15 in 97ba8b1a77
command: serve -a 0.0.0.0:8000 --no-livereload

@fauno you mean you're seeing URLs with `localhost` / `0.0.0.0` in the generated output of the live site? Maybe we're generating the site in dev mode when publishing? (😂) It seems to be controlled by [`site_url`](https://www.mkdocs.org/user-guide/configuration/#site_url) which we [do set](https://git.coopcloud.tech/toolshed/docs.coopcloud.tech/src/commit/97ba8b1a77cdd47274a5db9c173479c60ca5915f/mkdocs.yml#L4). Oh shiet: https://git.coopcloud.tech/toolshed/docs.coopcloud.tech/src/commit/97ba8b1a77cdd47274a5db9c173479c60ca5915f/compose.yml#L15
Author
Member

@decentral1se exactly that! nice of you to understand the issue even with the lack of context :P

@decentral1se exactly that! nice of you to understand the issue even with the lack of context :P
Owner

Haha, i do try 😌 Thanks!

Good luck fixing it 🙃 It seems maybe a bit tricky...

You might need to build the container to test it...

Haha, i do try 😌 Thanks! Good luck fixing it 🙃 It seems maybe a bit tricky... You might need to build the container to test it...
Author
Member

I'm not sure how the building works, so far I found:

does this mean the site being deployed is the development site? i can see the cmd runs with server address:port of 0.0.0.0:8000 while my local make adds a canonical url of http://localhost:8000, so i think that's the culprit, but not sure if the fix would be to change the cmd on this repo's dockerfile/drone.yml

I'm not sure how the building works, so far I found: * drone builds the dockerfile from this repo, based on the mkdocs template. but i can't find the actual [site building step on the build log](https://build.coopcloud.tech/toolshed/docs.coopcloud.tech/644/1/2) * the [entrypoint and cmd for mkdocs-material dockerfile](https://github.com/squidfunk/mkdocs-material/blob/master/Dockerfile#L107) run a development server does this mean the site being deployed is the development site? i can see the cmd runs with server address:port of 0.0.0.0:8000 while my local `make` adds a canonical url of http://localhost:8000, so i think that's the culprit, but not sure if the fix would be to change the cmd on this repo's dockerfile/drone.yml
fauno added spent time 15 minutes 2025-02-07 13:36:22 +00:00
Author
Member

@decentral1se it'd be great to fix this before publishing toolshed/coopcloud.tech#53

@decentral1se it'd be great to fix this before publishing https://git.coopcloud.tech/toolshed/coopcloud.tech/pulls/53
Sign in to join this conversation.
No Label
2 Participants
Notifications
Total Time Spent: 15 minutes
fauno
15 minutes
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: toolshed/docs.coopcloud.tech#266
No description provided.