From c2a20c42e67b17f1c8ee0150bdb14c9ebd60ed2a Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Tue, 27 May 2025 17:53:53 +0200 Subject: [PATCH 01/18] feat: add adobe analytics page load setup Signed-off-by: Milo Casagrande --- source/_templates/layout.html | 127 ++++++++++++++++------------------ source/conf.py | 11 +-- 2 files changed, 68 insertions(+), 70 deletions(-) diff --git a/source/_templates/layout.html b/source/_templates/layout.html index a68cee7c2..0784c933e 100644 --- a/source/_templates/layout.html +++ b/source/_templates/layout.html @@ -34,80 +34,75 @@ {%- block extrahead %} {{ super() }} - - - -{% endblock %} - -{% block footer %} -{{ super() }} - - - window.CookieConsent = cookieConsent; + + {% endif %} +{% endblock %} + +{% block footer %} + {{ super() }} + + {% endblock %} diff --git a/source/conf.py b/source/conf.py index bcf31da6e..2e0efd581 100644 --- a/source/conf.py +++ b/source/conf.py @@ -102,10 +102,13 @@ gh_release = 'releases/tag/mp-' + mp_version # pass vars to template engine's context -html_context = {'search_version': search_version, - 'meilisearch_host': meilisearch_host, - 'meilisearch_search_key': meilisearch_search_key, - 'gh_release': gh_release, +html_context = { + 'search_version': search_version, + 'meilisearch_host': meilisearch_host, + 'meilisearch_search_key': meilisearch_search_key, + 'gh_release': gh_release, + 'adobe_analytics_url': os.environ.get('ADOBE_ANALYTICS_URL', ''), + 'adobe_analytics_base_section': 'qc:foundries:', } # -- General configuration ------------------------------------------------ From e1ca5337e1abdc6aebd904b99b3e66ae1b5efe83 Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Tue, 27 May 2025 17:54:19 +0200 Subject: [PATCH 02/18] feat: add cookie settings link in footer Signed-off-by: Milo Casagrande --- source/_templates/footer.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/_templates/footer.html b/source/_templates/footer.html index 534172bfa..09fa1cc6b 100644 --- a/source/_templates/footer.html +++ b/source/_templates/footer.html @@ -5,6 +5,8 @@ + + Cookie Settings
From e32855028929e124ab07e19ef15229550b7e8209 Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Wed, 28 May 2025 10:46:47 +0200 Subject: [PATCH 03/18] fix: add missing closing curly-brace Signed-off-by: Milo Casagrande --- source/_templates/searchbox.html | 1 + 1 file changed, 1 insertion(+) diff --git a/source/_templates/searchbox.html b/source/_templates/searchbox.html index 122551d50..aa752a0b7 100644 --- a/source/_templates/searchbox.html +++ b/source/_templates/searchbox.html @@ -47,6 +47,7 @@ .docsearch-modal-search-hits-item--highlight { background: none; color: rgb(245, 132, 31); +} {% endif %} From e23b3ea8dd0f5fa0680d3fb5331db712567d33d4 Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Wed, 28 May 2025 10:47:11 +0200 Subject: [PATCH 04/18] fix: add indentation to styles Signed-off-by: Milo Casagrande --- source/_templates/searchbox.html | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/source/_templates/searchbox.html b/source/_templates/searchbox.html index aa752a0b7..aa2c9b41f 100644 --- a/source/_templates/searchbox.html +++ b/source/_templates/searchbox.html @@ -30,24 +30,24 @@ href="https://unpkg.com/meilisearch-docsearch@latest/dist/index.css" > {% endif %} From 9376ba653909950d6deef1f2015a3ff6c3d3a6e4 Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Wed, 28 May 2025 10:56:43 +0200 Subject: [PATCH 05/18] fix: remove css class not defined nor closed Signed-off-by: Milo Casagrande --- source/_static/theme_overrides.css | 1 - 1 file changed, 1 deletion(-) diff --git a/source/_static/theme_overrides.css b/source/_static/theme_overrides.css index 04e1c5e78..b96030e5a 100644 --- a/source/_static/theme_overrides.css +++ b/source/_static/theme_overrides.css @@ -119,4 +119,3 @@ body { min-height:100%; background:#edf0f2 } -.wy-text-left { From 7983f4a956afe026f5be072168666e8edc0811fc Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Wed, 28 May 2025 17:57:04 +0200 Subject: [PATCH 06/18] feat: add CSS helper classes Signed-off-by: Milo Casagrande --- source/_static/theme_overrides.css | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/source/_static/theme_overrides.css b/source/_static/theme_overrides.css index b96030e5a..122410317 100644 --- a/source/_static/theme_overrides.css +++ b/source/_static/theme_overrides.css @@ -119,3 +119,29 @@ body { min-height:100%; background:#edf0f2 } + +.is-flex { + display: flex !important; +} + +.is-flex-direction-row { + flex-direction: row !important; +} + +.has-gap-4 { + gap: 1rem !important; +} + +.is-link { + color: #2980b9 !important; + text-decoration: inherit; + background-color: transparent !important; + border: none !important; + padding: 0; + margin: 0; +} + +.is-link:hover { + color: #3091d1 !important; + outline: 0; +} \ No newline at end of file From 1bcdd78af4184c0a3cc14ae322842e9c1d29e955 Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Wed, 28 May 2025 18:02:09 +0200 Subject: [PATCH 07/18] feat: add analytics event triggering Signed-off-by: Milo Casagrande --- source/_static/analytics-events.js | 56 ++++++++++++++++++++++++++++++ source/conf.py | 4 +++ 2 files changed, 60 insertions(+) create mode 100644 source/_static/analytics-events.js diff --git a/source/_static/analytics-events.js b/source/_static/analytics-events.js new file mode 100644 index 000000000..d8a69abb0 --- /dev/null +++ b/source/_static/analytics-events.js @@ -0,0 +1,56 @@ +/** + * The name of the analytics event property in the data-* attributes. + */ +const datasetEventProperty = "analyticsEvent"; + +/** + * List of properties set in the data-* attributes of the element + * that will be passed into the eventInfo object. + */ +const datasetEntries = [ + ["analyticsAction", "action"], + ["analyticsDetail", "detail"], + ["analyticsLabel", "label"], + ["analyticsLocation", "location"], +]; + +const datasetProperties = new Map(datasetEntries); +Object.freeze(datasetProperties); + +function handleAnalyticsEvent({ event, eventInfo }) { + window.adobeDataLayer = window.adobeDataLayer || []; + window.adobeDataLayer.push({ + event, + eventInfo, + }); +} + +document.addEventListener("click", function (event) { + const { target } = event; + + let element = target; + // eslint-disable-next-line security/detect-object-injection + if (element.dataset[datasetEventProperty]) { + element = target; + } else { + element = target.closest("[data-analytics-event]"); + } + + if (element) { + const { dataset } = element; + + const eventInfo = {}; + for (const [property, analyticsValue] of datasetProperties) { + if (Object.hasOwn(dataset, property)) { + // eslint-disable-next-line security/detect-object-injection + eventInfo[analyticsValue] = dataset[property]; + } + } + + handleAnalyticsEvent({ + // eslint-disable-next-line security/detect-object-injection + event: dataset[datasetEventProperty], + eventInfo, + }); + } +}); diff --git a/source/conf.py b/source/conf.py index 2e0efd581..6339cd367 100644 --- a/source/conf.py +++ b/source/conf.py @@ -344,6 +344,10 @@ 'theme_overrides.css' ] +html_js_files = [ + 'analytics-events.js' +] + # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. From e4f942fbfec8b965dde5b95167e12998eacc7731 Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Wed, 28 May 2025 18:03:12 +0200 Subject: [PATCH 08/18] feat: add template overrider for breadcrumbs Signed-off-by: Milo Casagrande --- source/_templates/breadcrumbs.html | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 source/_templates/breadcrumbs.html diff --git a/source/_templates/breadcrumbs.html b/source/_templates/breadcrumbs.html new file mode 100644 index 000000000..1c13f35f4 --- /dev/null +++ b/source/_templates/breadcrumbs.html @@ -0,0 +1,77 @@ +{%- if meta is defined and meta is not none %} + {%- set check_meta = True %} +{%- else %} + {%- set check_meta = False %} +{%- endif %} + +{%- if check_meta and 'github_url' in meta %} + {%- set display_github = True %} +{%- endif %} + +{%- if check_meta and 'bitbucket_url' in meta %} + {%- set display_bitbucket = True %} +{%- endif %} + +{%- if check_meta and 'gitlab_url' in meta %} + {%- set display_gitlab = True %} +{%- endif %} + +{%- set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %} + +{#- Translators: This is an ARIA section label for page links, including previous/next page link and links to GitHub/GitLab/etc. -#} +
+ + + {%- if (theme_prev_next_buttons_location == 'top' or theme_prev_next_buttons_location == 'both') and (next or prev) %} + {#- Translators: This is an ARIA section label for sequential page links, such as previous and next page links. -#} + + {%- endif %} +
+
From 3a1c0dba6d41aa7b4414e27e23f63a0bd2c3a916 Mon Sep 17 00:00:00 2001 From: Milo Casagrande Date: Wed, 28 May 2025 18:03:44 +0200 Subject: [PATCH 09/18] feat: add metadata for analytics event on search Signed-off-by: Milo Casagrande --- source/_templates/searchbox.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/_templates/searchbox.html b/source/_templates/searchbox.html index aa2c9b41f..413e310cb 100644 --- a/source/_templates/searchbox.html +++ b/source/_templates/searchbox.html @@ -1,6 +1,6 @@ {% if search_version == 'default' %} -
+