|
56 | 56 | "ext.github_tools", |
57 | 57 | "ext.rstjinja", |
58 | 58 | "ablog", |
| 59 | + "sphinx_sitemap", |
| 60 | + "sphinxext.opengraph", |
| 61 | +] |
| 62 | + |
| 63 | +html_baseurl = os.environ.get("SPHINX_HTML_BASE_URL", "https://fury.gl/latest/") |
| 64 | + |
| 65 | +# Open Graph configuration |
| 66 | +ogp_site_url = html_baseurl |
| 67 | +ogp_image = html_baseurl + "_static/images/text-logo.png" |
| 68 | + |
| 69 | +# Sitemap configuration. html_baseurl already points at this build's own |
| 70 | +# deploy root (e.g. /dev/, /latest/, /vX.Y.x/), so the default scheme's |
| 71 | +# version/language prefixes are redundant and dropped. See _extra/robots.txt. |
| 72 | +sitemap_filename = "sitemap.xml" |
| 73 | +sitemap_url_scheme = "{link}" |
| 74 | +# Generated indexes and source views, of no value in search results. |
| 75 | +sitemap_excludes = [ |
| 76 | + "search.html", |
| 77 | + "genindex.html", |
| 78 | + "py-modindex.html", |
| 79 | + "_modules/*", |
| 80 | + "*sg_execution_times.html", |
59 | 81 | ] |
60 | 82 |
|
61 | 83 | # Configuration options for plot_directive. See: |
|
145 | 167 | "navigation_with_keys": True, |
146 | 168 | "navbar_start": ["navbar-logo"], |
147 | 169 | "navbar_center": ["custom-navbar-nav.html"], |
148 | | - "navbar_end": ["navbar-icon-links", "theme-switcher"], |
| 170 | + "navbar_end": ["version-switcher", "navbar-icon-links", "theme-switcher"], |
149 | 171 | "logo": { |
150 | 172 | "text": "FURY", |
151 | 173 | }, |
|
174 | 196 | html_css_files = ["css/fury_theme.css"] |
175 | 197 | html_additional_pages = {"index": "home.html"} |
176 | 198 |
|
177 | | -# html_baseurl = os.environ.get("SPHINX_HTML_BASE_URL", "http://127.0.0.1:8000/") |
| 199 | +html_extra_path = ["_extra"] |
178 | 200 |
|
179 | 201 | html_logo = "_static/images/logo.svg" |
180 | 202 |
|
|
291 | 313 | "dipy": ("https://docs.dipy.org/stable", None), |
292 | 314 | "scikit-learn": ("https://scikit-learn.org/stable/", None), |
293 | 315 | } |
| 316 | + |
| 317 | + |
| 318 | +def _home_page_context(app, pagename, templatename, context, doctree): |
| 319 | + """ |
| 320 | + Fix up context for the home page. |
| 321 | +
|
| 322 | + It renders via home.html through html_additional_pages, which Sphinx builds |
| 323 | + with an empty context (no doctree) - so ``title`` is never populated (the |
| 324 | + <title> tag ends up empty) and ``pageurl`` resolves to /index.html instead |
| 325 | + of the site root. |
| 326 | + """ |
| 327 | + if pagename == "index": |
| 328 | + context["title"] = "FURY - Free Unified Rendering in pYthon" |
| 329 | + if context.get("pageurl"): |
| 330 | + context["pageurl"] = app.config.html_baseurl |
| 331 | + |
| 332 | + |
| 333 | +def setup(app): |
| 334 | + app.connect("html-page-context", _home_page_context) |
0 commit comments