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

html_title version not changed #61

Open
samtygier-stfc opened this issue Dec 9, 2020 · 3 comments
Open

html_title version not changed #61

samtygier-stfc opened this issue Dec 9, 2020 · 3 comments
Labels
type:task An atomic feature / thing to be implemented

Comments

@samtygier-stfc
Copy link

The classic template puts {{ shorttitle|e }} in the top nav bar and the page title. If not explicitly set it gets its value from html_title which defaults to '<project> <revision> documentation'.

When building with sphinx-multiversion, the oldest tag version is being used in html_title for all versions. So everything gets foo bar 0.9.0 documentation, even the newer versions.

@samtygier-stfc
Copy link
Author

samtygier-stfc commented Dec 10, 2020

This looks tricky to fix as these variable get set to the defaults when the config is read. To change them later would need checking if they were set to a default or by the user.

Instead I worked around by adding a template layout.html

{%- extends "!layout.html" %}
    {%- block htmltitle %}
    {% if versions %}
    <title>{{ title|striptags|e }} - {{ project }} {{ current_version.name }} Documentation</title>
    {% else %}
     <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
    {% endif %}
    {%- endblock %}

 {%- block rootrellink %}
 {% if versions %}
 <li class="nav-item nav-item-0"><a href="{{ pathto(master_doc)|e }}">{{ project }} {{ current_version.name }} Documentation</a>{{ reldelim1 }}</li>
 {% else %}
 <li class="nav-item nav-item-0"><a href="{{ pathto(master_doc)|e }}">{{ shorttitle|e }}</a>{{ reldelim1 }}</li>
 {% endif %}
{%- endblock %}

@Rjvs
Copy link

Rjvs commented Mar 12, 2022

I worked around this problem by just setting html_title = "projectname" in conf.py although obviously this has the downside of removing version information from the title entirely.

@HassanAbouelela
Copy link

HassanAbouelela commented May 16, 2022

I don't think the root cause described here is correct. Yes, it does default to <project> v<revision> documentation, but when building the docs for a certain version, the <revision> should have the correct value, not the latest value. The reason it has the latest (wrong) value is that multiversion explicitly sets the -c flag to your current, actual conf.py, not to the one that was checked out in the temp directory:

https://github.com/Holzhaus/sphinx-multiversion/blob/cdc9cb591a738e67a5aacc458f9c95e2b88a94c2/sphinx_multiversion/main.py#L325-L326

I don't know if this is intentional or not, but it seems a bit strange that you would use the latest config and not the one that existed at the time of the version being built (it leads to issues like the one described here, and others such as not being able to change your extensions without breaking previous releases). There are certain benefits to being able to affect your build process retroactively, but those tasks are perhaps better served by other solutions such as pre/post hooks I've seen described around.

@BurningEnlightenment BurningEnlightenment added the type:task An atomic feature / thing to be implemented label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:task An atomic feature / thing to be implemented
Projects
Status: Backlog
Development

No branches or pull requests

4 participants