Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject canonical tag on mkdocs as we do with Sphinx #4820

Closed
stsewd opened this issue Oct 30, 2018 · 5 comments · Fixed by #10166
Closed

Inject canonical tag on mkdocs as we do with Sphinx #4820

stsewd opened this issue Oct 30, 2018 · 5 comments · Fixed by #10166
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required
Milestone

Comments

@stsewd
Copy link
Member

stsewd commented Oct 30, 2018

In Sphinx if a user has a custom domain we setup the canonical tag for the user (we also have some docs for that feature https://docs.readthedocs.io/en/latest/canonical.html)

In Sphinx we do that here https://github.com/rtfd/readthedocs.org/blob/9b2b17c0fc603267b4b20f5923862c2db82602da/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl#L95-L95

On mkdocs we don't do that, but it's possible using the site_url setting https://www.mkdocs.org/user-guide/configuration/#site_url

We can do that here

https://github.com/rtfd/readthedocs.org/blob/9b2b17c0fc603267b4b20f5923862c2db82602da/readthedocs/doc_builder/backends/mkdocs.py#L107-L107

Ref #3137

@stsewd stsewd added Improvement Minor improvement to code Needed: design decision A core team decision is required labels Oct 30, 2018
@stsewd stsewd added this to the Mkdocs milestone Oct 30, 2018
@dojutsu-user
Copy link
Member

@stsewd I would like to take this issue up.
I didn't find the way to get the canonical url of the project, is it present in the keyword arguments that append_conf receive, i.e. __?

@stsewd
Copy link
Member Author

stsewd commented Oct 30, 2018

That comes from the project model, but this issue has the Needed: design decision label, we need to wait to be approved before writing some code

@stsewd
Copy link
Member Author

stsewd commented Oct 30, 2018

Just adding that looks like the site_url option have been there for a long time, nothing relevant on the changelog https://www.mkdocs.org/about/release-notes

@astrojuanlu
Copy link
Contributor

Just btw MKdocs just yesterday added support for Environment variables in version 1.2.0, all you have to do is make a variable with the final URL available for the build :)

https://www.mkdocs.org/about/release-notes/#support-added-for-environment-variables-in-the-configuration-file-1954

@benjaoming
Copy link
Contributor

As mentioned by @astrojuanlu, we can use environment variables in .mkdocs.yml and that would be valuable in general to users.

However, then this needs to be fixed: #8529

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants