Add sitemap and Search Console tag to docs Enable sphinx-sitemap so GitHub Pages publishes sitemap.xml for the documentation site. Add a page.html template override with the Google Search Console verification meta tag and a noindex meta tag on the /dev/ build so search engines index the stable docs instead of duplicating them with /dev/. Change-Id: I4b80593c3f0caa17f9d22632fa030e168e2942c2
diff --git a/docs/requirements.txt b/docs/requirements.txt index 54efa06..7f398ff 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt
@@ -1,3 +1,4 @@ furo>=2024.8.6 sphinx>=8.1.3 sphinx-copybutton>=0.5.2 +sphinx-sitemap>=2.6.0
diff --git a/docs/source/_templates/page.html b/docs/source/_templates/page.html new file mode 100644 index 0000000..76620f2 --- /dev/null +++ b/docs/source/_templates/page.html
@@ -0,0 +1,8 @@ +{% extends "!page.html" %} +{% block extrahead %} + {{ super() }} + <meta name="google-site-verification" content="ExvBT4m-8ldcRLESPlkreTqhR-iNElGGbAH9RM_33bQ" /> + {% if ceres_doc_variant == 'dev' %} + <meta name="robots" content="noindex" /> + {% endif %} +{% endblock %}
diff --git a/docs/source/conf.py b/docs/source/conf.py index 40249e4..c2b9449 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py
@@ -54,6 +54,8 @@ ] if importlib.util.find_spec('sphinx_copybutton') is not None: extensions.append('sphinx_copybutton') +if importlib.util.find_spec('sphinx_sitemap') is not None: + extensions.append('sphinx_sitemap') templates_path = ['_templates'] master_doc = 'index' @@ -88,6 +90,12 @@ html_theme = 'furo' html_title = 'Ceres Solver' +html_baseurl = 'https://ceres-solver.github.io/ceres-solver/' +sitemap_url_scheme = '{link}' +sitemap_excludes = [ + 'search.html', + 'genindex.html', +] html_theme_options = { 'source_repository': 'https://github.com/ceres-solver/ceres-solver', 'source_branch': 'master',