Skip to content

Commit dff3ac2

Browse files
committed
Merge remote-tracking branch 'app4triqs-remote/4.0.x' into 4.0.x
# Conflicts: # doc/conf.py.in # doc/doxygen/Doxyfile.in
2 parents d51f13d + abf9b4e commit dff3ac2

3 files changed

Lines changed: 47 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ cmake_policy(VERSION ${CMAKE_VERSION})
2727
project(triqs_dft_tools VERSION 4.0.0 LANGUAGES CXX)
2828
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
2929

30+
# version displayed in the documentation
31+
set(BRANCH_FOR_DOC ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.x)
32+
3033
# ############
3134
# Load TRIQS
3235
find_package(TRIQS 4.0 REQUIRED)

doc/_templates/versions.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{# Version switcher flyout.
2+
3+
sphinx_rtd_theme 3.x ships an empty versions.html (the flyout is injected by
4+
the ReadTheDocs addons when hosted there, and is absent on self-hosted
5+
builds). layout.html still does `{% include "versions.html" %}`, so this
6+
override revives the classic bottom-left "v: <version> ▾" widget. It is
7+
styled by the theme's existing .rst-versions CSS and toggled by theme.js;
8+
the entries come from html_context['versions'] in conf.py. #}
9+
{%- if versions %}
10+
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="{{ _('Versions') }}">
11+
<span class="rst-current-version" data-toggle="rst-current-version">
12+
<span class="fa fa-book"> {{ _('Versions') }}</span>
13+
v: {{ current_version }}
14+
<span class="fa fa-caret-down"></span>
15+
</span>
16+
<div class="rst-other-versions">
17+
<dl>
18+
<dt>{{ _('Versions') }}</dt>
19+
{%- for slug, url in versions %}
20+
<dd><a href="{{ url }}">{{ slug }}</a></dd>
21+
{%- endfor %}
22+
</dl>
23+
</div>
24+
</div>
25+
{%- endif %}

doc/conf.py.in

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ autosummary_generate = True
5252
autosummary_imported_members = False
5353

5454
project = 'TRIQS DFTTools'
55-
version = '@PROJECT_VERSION@'
55+
version = '@BRANCH_FOR_DOC@'
5656

5757
# this makes the current project version available as var in every rst file
5858
rst_epilog = """
@@ -71,6 +71,12 @@ html_theme = 'sphinx_rtd_theme'
7171
# this loads the custom css file to change the page width
7272
html_style = 'css/custom.css'
7373

74+
# Point search engines at the evergreen "latest" build of each page via a
75+
# rel="canonical" link. Setting this in *every* version build (unstable, X.Y.x,
76+
# ...) consolidates ranking signals onto the latest/ docs so they are preferred
77+
# over older versions in search results.
78+
html_baseurl = 'https://triqs.github.io/@PROJECT_NAME@/latest/'
79+
7480
html_favicon = '@CMAKE_CURRENT_SOURCE_DIR@/_static/triqs_logo/triqs_favicon.ico'
7581
#html_logo = '@CMAKE_CURRENT_SOURCE_DIR@/logos/logo.png'
7682

@@ -92,7 +98,18 @@ html_theme_options = {
9298

9399
html_show_sphinx = False
94100

95-
html_context = {'header_title': 'TRIQS DFTTools'}
101+
html_context = {
102+
'header_title': 'TRIQS DFTTools',
103+
# Version switcher flyout (rendered by _templates/versions.html, which
104+
# overrides the empty versions.html shipped by sphinx_rtd_theme 3.x). The
105+
# list is static -- update it when a new release line is published.
106+
'current_version': version,
107+
'versions': [
108+
['unstable', 'https://triqs.github.io/@PROJECT_NAME@/unstable/'],
109+
['4.0.x', 'https://triqs.github.io/@PROJECT_NAME@/4.0.x/'],
110+
['3.3.x', 'https://triqs.github.io/@PROJECT_NAME@/3.3.x/'],
111+
],
112+
}
96113

97114
html_static_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_static']
98115
html_sidebars = {'index': ['sideb.html', 'searchbox.html']}

0 commit comments

Comments
 (0)