-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
interface for adding extra template context #3483
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
@ericholscher mentioned this could be accomplished with a Sphinx plugin. However, this would require us to maintain a separate public package, make a new release of it with new context, and trigger RTD builds for all versions every time we wanted to change the global context, which is not very convenient. RTD directly supporting extra global context would be much nicer. |
We currently support a user having a defined |
We already call update on the existing I guess we could add |
The problem with it being in the code is that it's now tied to the version being built. The useful thing about the context is that it can be modified externally at build time. |
I'm not sure I follow. Can you explain the exact use case? |
Let's say we want to display the docs for Flask 0.10, 0.11, 0.12, and 1.0. If we want to display some standard information in the sidebar for each build, like links to each version, we don't want to have to go back to the 0.10 branch and update it so it knows that 1.0 was released. We want to inject the current list of versions as we build each one. The specific example with versions is already handled by RTD's context, but it demonstrates the idea. |
Yea, this is actually a different problem on our side. We solve this in JavaScript by sending the data via the footer response. That is "v2" of #3482, where we give users access to that "realtime" project data in JS, so you don't have to rebuild all docs every time one version changes. |
but I believe #3482 has what you want (a list of all active versions injected in template context on build) |
Yes, for the versions use case, I've already got the information I need. This was a more general request for specifying global context at build time. |
Gotcha. 👍 |
That appears to be documenting RTD's internal context. It mentions adding context to |
You primarily need this in order to get versions of particular projects correct? I believe this can be handled through the API like so: https://readthedocs.org/api/v2/version/?project__slug=flask That will get you all the versions and you can grab just the Let me know if this gets you were you need to be on this issue. |
I don't need this anymore, although it may be useful to others. Perhaps it's more appropriate (or already present) in the YAML config? You can close it if you'd like. |
I've been working on porting Flask's docs to be built on RTD instead of our custom builder. Our builder has a separate JSON file with metadata about versions, and inserts it into
html_context
by combining each project's Sphinx config with a standard config.html_context
can also be set on the command line with-A key=value
flags. RTD's interface doesn't allow doing this yet.While that version information is already available from RTD and just needs to be documented (#3482), it would still be nice to be able to specify additional template context using the web interface. One option is a text box that users can paste JSON in, then add
html_context.update({{ extra_html_context|tojson }})
after RTD's defaulthtml_context
.The text was updated successfully, but these errors were encountered: