-
-
Notifications
You must be signed in to change notification settings - Fork 62
Get URL's version number inside conf.py? #137
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
Comments
@JulienPalard Do you know if this docs version is available in |
That's not trivial, first because So maybe first: do we need a distinct build for If yes, we have another problem: the exact same tree would have to give two distinct values ( But docsuilb-scripts could tell, like via an environment variable, "I'm currently building for |
No, I don't think we need to worry about that, and especially not for a first iteration. I think it would be better to use
That would be great! |
If I understand correctly, you'd prefer something like:
rather than:
? If I understand correctly again, this is because you'd like to have an environment variable like:
I'm not sure we can't hardcode it to
For me the canonical URL of the content delivered by https://docs.python.org/3.9/library/functions.html is https://docs.python.org/3/library/functions.html. I've searched (a few seconds) on the internet and found that some SEO tools can complain if the canonical URL does not match the og:url, that make another point to just use (After reading ogp.me and written this, I have to admit I don't understand OpenGraph, isn't it just duplicating the |
Yes, but it's not a strong preference, more of a hunch, I don't fully understand the dark arts of SEO!
And yes, because I think it's important to have one of the builds indexed as
Are you suggesting using
In many cases they will, but it's possible they can be different as they're slightly different, semantically speaking. One is the title of the webpage, for browsers, the other is the title of the thing to be shared, for Facebook and so on. For example, Stack Overflow has:
For us, they will be the same, but I don't think a few extra characters of plaintext is a problem given the size of webpages. Images and weighty JS frameworks are more of a concern. |
Yes.
Let's start with that, and if there's strong evidence that we need something more complicated we'll do. So no commits are needed docsbuild-script side, only cpython side, I think this issue can be closed? |
Yes, let's start with |
Question
Is it possible to get the version from the docs URL (e.g.
/3/
,/3.12/
or/3.10.7/
) inconf.py
?Why?
I'm looking at adding OpenGraph metadata to the docs to help with SEO (see python/pythondotorg#1691).
And there's a handy Sphinx extension that can help: https://pypi.org/project/sphinxext-opengraph/
We need to add config like
ogp_site_url = "http://example.org/"
For example:
Produces something like:
However, the version in the URL isn't necessarily
/3/
, it could include minor version (https://docs.python.org/3.12/) or even patch version (https://docs.python.org/release/3.10.7/), so we can't hardcode it.Is this path version available in
conf.py
?conf.py
already has:But these are like
3.12, 3.12.0a0
, and don't necessarily match the URL version (which could be any ofmajor[.minor[.patch]]
.Thanks!
The text was updated successfully, but these errors were encountered: