Configuration and remove google analytics extension by modern method in layout html

This commit is contained in:
2026-05-22 09:25:36 +02:00
parent c852782a13
commit e3415dbabb
3 changed files with 52 additions and 9 deletions
+1
View File
@@ -18,6 +18,7 @@ roman-numerals==4.1.0
snowballstemmer==3.0.1
Sphinx==9.1.0
sphinx-autobuild==2025.8.25
sphinx-copybutton==0.5.2
sphinx_rtd_theme==3.1.0
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
+13
View File
@@ -0,0 +1,13 @@
{% extends "!layout.html" %}
{% block extrahead %}
{{ super() }}
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ googleanalytics_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ googleanalytics_id }}');
</script>
{% endblock %}
+38 -9
View File
@@ -6,20 +6,20 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'Sphinx Demo'
copyright = '2026, Xarkam'
author = 'Xarkam'
project = 'Jam.py'
copyright = '2022, Jam.py Team'
author = 'Andrew Yushev & Dean D. Babic'
release = '0.0.1'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = ['sphinx.ext.autodoc','sphinx_rtd_theme']
extensions = ['sphinx_rtd_theme', 'sphinx_copybutton', 'sphinx.ext.autodoc', 'sphinx.ext.linkcode', 'sphinx.ext.githubpages', 'sphinx_llms_txt']
templates_path = ['_templates']
exclude_patterns = []
exclude_patterns = ['**/.git', 'Thumbs.db', '**/.venv', '**/.idea', '**/.mypy_cache', '**/build']
googleanalytics_id = 'UA-122962025-6' # Provided by Google in your dashboard and need for html context below.
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
@@ -28,7 +28,6 @@ html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_theme_options = {
'analytics_id': 'G-XXXXXXXXXX', # Provided by Google in your dashboard
'analytics_anonymize_ip': False,
'logo_only': False,
'prev_next_buttons_location': 'bottom',
@@ -43,5 +42,35 @@ html_theme_options = {
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
}
'titles_only': False,
}
html_static_path = ['source/_static']
html_theme_path = ['source/_templates']
html_css_files = ['source/_static/Jam.py.html_files/freemind2html.css']
html_favicon = 'source/_static/favicon.ico'
html_last_updated_fmt = '%b %d, %Y'
html_context = {
'googleanalytics_id': googleanalytics_id,
}
# -- Python link_code_resolve configuration
def linkcode_resolve(domain, info):
"""Map specific exceptions to specific files."""
if domain != 'py':
return None
mapping = {
'LanguageNotFound': 'https://github.com/jam-py-v5/jam-py-v7/blob/master/jam/langs.py',
'NetworkError': 'https://github.com/username/repo/blob/main/network.py',
'FileError': 'https://github.com/username/repo/blob/main/file_ops.py',
}
exception_name = info['fullname']
return mapping.get(exception_name)