Skip to content

Commit 6229a57

Browse files
[cookies] Enable/Disable banner in localhost (#3856)
* Added new Jinja variable enable_cookies to enable/disable cookies banner * Applying suggestion * env variable
1 parent 19f6173 commit 6229a57

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

_templates/layout.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
{%- block extrahead %}
44

5-
<!-- Google Tag Manager -->
5+
{% if enable_cookies is true %}
6+
<!-- Google Tag Manager -->
67
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
78
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
89
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
910
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
1011
})(window,document,'script','dataLayer','GTM-WK44ZFM');</script>
1112
<!-- End Google Tag Manager -->
13+
{% endif %}
1214
{{ super() }}
1315

1416

@@ -17,9 +19,9 @@
1719
{% endblock %}
1820

1921
{% block footer %}
20-
22+
{% if enable_cookies is true %}
2123
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WK44ZFM" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
22-
24+
{% endif %}
2325

2426
{{ super() }}
2527
{% endblock %}

conf.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
add_module_names = False
5959
autoclass_content = 'both'
6060
autodoc_member_order = 'bysource' # To order the methods following the order at the code, not alphabetically
61-
autodoc_mock_imports = ["PyJWT", "requests", "urllib3", "PyYAML",
61+
autodoc_mock_imports = ["PyJWT", "requests", "urllib3", "PyYAML",
6262
"patch-ng", "fasteners", "six", "node-semver", "distro",
63-
"pygments", "tqdm", "Jinja2", "MarkupSafe", "Jinja2",
63+
"pygments", "tqdm", "Jinja2", "MarkupSafe", "Jinja2",
6464
"python-dateutil", "configparse", "patch_ng", "yaml", "semver", "dateutil"]
6565

6666

@@ -90,7 +90,8 @@
9090
"github_user": "conan-io", # Username
9191
"github_repo": "docs", # Repo name
9292
"github_version": "develop2", # Version
93-
"conf_py_path": "/" # Path in the checkout to the docs root
93+
"conf_py_path": "/", # Path in the checkout to the docs root
94+
"enable_cookies": os.getenv("ENABLE_COOKIES_BANNER", True) # enable cookies banner
9495
}
9596

9697
# Add any paths that contain templates here, relative to this directory.
@@ -431,7 +432,6 @@
431432
# Graphviz output format, one of png, svg
432433
graphviz_output_format = 'svg'
433434

434-
435435
# copy legacy redirects
436436
def copy_legacy_redirects(app, docname): # Sphinx expects two arguments
437437
# FILL in this dicts the necessary redirects

0 commit comments

Comments
 (0)