From 2cdd06fd4480e45c2195f8c9819cc5f30d62b2a2 Mon Sep 17 00:00:00 2001 From: Nathan Melehan Date: Thu, 20 Jun 2024 15:34:50 -0400 Subject: [PATCH] Theme updates (#7006) - Tweak to hover text panel for SVG diagrams - Hide numbers in explore docs menu unless filtered by search - Remove transition when toggling explore docs menu sections - Remove GTM - Disable Turbo on API links - Update header navigation --- .../linode-docs-theme/assets/js/main/index.js | 14 ++++++-- .../linode/linode-docs-theme/config.toml | 3 -- .../config/development/config.toml | 3 -- .../config/staging/config.toml | 3 -- .../config/testing/config.toml | 3 -- .../partials/components/render-svg.html | 4 ++- .../layouts/partials/sections/head.html | 14 -------- .../navigation/explorer-hydrated.html | 2 +- .../sections/navigation/explorer-initial.html | 9 ++--- .../linode-website-partials/header.html | 33 ------------------- _vendor/modules.txt | 4 +-- go.mod | 2 +- go.sum | 3 ++ 13 files changed, 23 insertions(+), 74 deletions(-) diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/index.js b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/index.js index 77e8ec3e075..4a88e2f5438 100644 --- a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/index.js +++ b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/index.js @@ -130,7 +130,7 @@ const searchConfig = getSearchConfig(params); this.dataLayer.push(event); }; - let pushGTag = function (eventName) { + let pushDataLayer = function (eventName) { let event = { event: eventName, }; @@ -173,7 +173,7 @@ const searchConfig = getSearchConfig(params); window.turbolinksLoaded = true; setTimeout(function () { - pushGTag('docs_load'); + pushDataLayer('docs_load'); }, 2000); }); @@ -191,7 +191,7 @@ const searchConfig = getSearchConfig(params); return; } - pushGTag('docs_navigate'); + pushDataLayer('docs_navigate'); }); // Preserve scroll position when navigating with Turbo on all elements with the data-preserve-scroll attribute. @@ -202,6 +202,13 @@ const searchConfig = getSearchConfig(params); window.scrollHandledByClick = {}; } + function turboClick(e) { + if (e.detail.url.includes('/docs/api')) { + // Disable Turbo for the API docs to allow for edge redirects. + e.preventDefault(); + } + } + function preserveScroll(e) { document.querySelectorAll('[data-preserve-scroll]').forEach((el) => { // Check if the event's target is a child of the element. @@ -250,6 +257,7 @@ const searchConfig = getSearchConfig(params); } window.addEventListener('turbo:click', preserveScroll); + window.addEventListener('turbo:click', turboClick); window.addEventListener('turbo:before-render', restoreScroll); window.addEventListener('turbo:render', restoreScroll); })(); diff --git a/_vendor/github.com/linode/linode-docs-theme/config.toml b/_vendor/github.com/linode/linode-docs-theme/config.toml index 8c2c09f2272..8296119a23e 100644 --- a/_vendor/github.com/linode/linode-docs-theme/config.toml +++ b/_vendor/github.com/linode/linode-docs-theme/config.toml @@ -4,9 +4,6 @@ time_format_iso8601 = "2006-01-02T15:04:05-07:00" weglot_api_key = "wg_3b3ef29c81aa81292c64d1368ee318969" -# Google Tag Manager ID used in production. -# For development/staging, see the config dir. -gtmID = "GTM-T5FXXG9" # # Adobe Analytics script used in production. # For development/staging, see the config dir. diff --git a/_vendor/github.com/linode/linode-docs-theme/config/development/config.toml b/_vendor/github.com/linode/linode-docs-theme/config/development/config.toml index 3ca8cbdca7e..850a06dfcaa 100644 --- a/_vendor/github.com/linode/linode-docs-theme/config/development/config.toml +++ b/_vendor/github.com/linode/linode-docs-theme/config/development/config.toml @@ -1,7 +1,4 @@ [params] - # GTM container used in development and on Netlify. - gtmID = "GTM-TS67W4L" - # Adobe Analytics script used in development and on Netlify. adobe_launch_script = "https://assets.adobedtm.com/fcfd3580c848/f9e7661907ee/launch-006d022c8726-development.min.js" diff --git a/_vendor/github.com/linode/linode-docs-theme/config/staging/config.toml b/_vendor/github.com/linode/linode-docs-theme/config/staging/config.toml index 57e201e67da..89e603d2676 100644 --- a/_vendor/github.com/linode/linode-docs-theme/config/staging/config.toml +++ b/_vendor/github.com/linode/linode-docs-theme/config/staging/config.toml @@ -1,7 +1,4 @@ [params] - # GTM container used in Staging (docs.staging.linode.com/docs) - # gtmID = "GTM-T5FXXG9" - # Adobe Analytics script used in Staging (docs.staging.linode.com/docs) adobe_launch_script = "https://assets.adobedtm.com/fcfd3580c848/f9e7661907ee/launch-96338797f65e-staging.min.js" diff --git a/_vendor/github.com/linode/linode-docs-theme/config/testing/config.toml b/_vendor/github.com/linode/linode-docs-theme/config/testing/config.toml index 3ca8cbdca7e..850a06dfcaa 100644 --- a/_vendor/github.com/linode/linode-docs-theme/config/testing/config.toml +++ b/_vendor/github.com/linode/linode-docs-theme/config/testing/config.toml @@ -1,7 +1,4 @@ [params] - # GTM container used in development and on Netlify. - gtmID = "GTM-TS67W4L" - # Adobe Analytics script used in development and on Netlify. adobe_launch_script = "https://assets.adobedtm.com/fcfd3580c848/f9e7661907ee/launch-006d022c8726-development.min.js" diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/components/render-svg.html b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/components/render-svg.html index 0fc3363ca2f..6328d8c533c 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/components/render-svg.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/components/render-svg.html @@ -126,7 +126,9 @@ x-transition.opacity :style="tooltip.style" x-show="tooltip.show"> -
+
-{{ if (ne hugo.Environment "development") }} - - -{{ end }} {{ partialCached "sections/head-src.html" . "-" }} diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/explorer-hydrated.html b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/explorer-hydrated.html index fc90ffbee99..8a57cb30910 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/explorer-hydrated.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/explorer-hydrated.html @@ -84,6 +84,7 @@
1 }" x-show="{{ $.n }}.open" - x-transition.200ms x-ref="node-tree">
diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/explorer-initial.html b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/explorer-initial.html index d19a9238ae9..480dd8200e1 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/explorer-initial.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/partials/sections/navigation/explorer-initial.html @@ -146,13 +146,8 @@ "text-basicgray" (not (eq .node.count 0)) ) }} - {{ with .node.count }} - {{ . }} - {{ end }} + +
{{ $ariaLabel := cond .node.open "close" "open" }} {{ $classes := partial "inline/get-classes" (dict diff --git a/_vendor/github.com/linode/linode-website-partials/header.html b/_vendor/github.com/linode/linode-website-partials/header.html index 363537d0245..ad2faefe392 100644 --- a/_vendor/github.com/linode/linode-website-partials/header.html +++ b/_vendor/github.com/linode/linode-website-partials/header.html @@ -65,39 +65,6 @@ -
-
- -
- -
-
diff --git a/_vendor/modules.txt b/_vendor/modules.txt index be70b28c249..683ce22e8bb 100644 --- a/_vendor/modules.txt +++ b/_vendor/modules.txt @@ -1,5 +1,5 @@ -# github.com/linode/linode-docs-theme v0.0.0-20240610162252-dd3795f29d6a -# github.com/linode/linode-website-partials v0.0.0-20240426140442-12b76ccbfefd +# github.com/linode/linode-docs-theme v0.0.0-20240618214412-23d0d6b33823 +# github.com/linode/linode-website-partials v0.0.0-20240516182804-8b13c1f13759 # github.com/gohugoio/hugo-mod-jslibs-dist/alpinejs/v3 v3.21300.20800 # github.com/gohugoio/hugo-mod-jslibs/turbo/v8 v8.20000.20400 # github.com/hotwired/turbo v8.0.4+incompatible diff --git a/go.mod b/go.mod index d02452f447e..ed5eb5a051d 100644 --- a/go.mod +++ b/go.mod @@ -7,5 +7,5 @@ require ( github.com/gohugoio/hugo-mod-jslibs/turbo/v7 v7.20300.20000 // indirect github.com/instantpage/instant.page v5.1.1+incompatible // indirect github.com/linode/linode-api-docs/v4 v4.176.0 // indirect - github.com/linode/linode-docs-theme v0.0.0-20240610162252-dd3795f29d6a // indirect + github.com/linode/linode-docs-theme v0.0.0-20240618214412-23d0d6b33823 // indirect ) diff --git a/go.sum b/go.sum index 2d0dc272cf8..b0b963b58d1 100644 --- a/go.sum +++ b/go.sum @@ -284,6 +284,8 @@ github.com/linode/linode-docs-theme v0.0.0-20240605162953-7c4dfc828751 h1:vQ+k7/ github.com/linode/linode-docs-theme v0.0.0-20240605162953-7c4dfc828751/go.mod h1:IHFGag+AZAtmiEdw1tfqB/svFE0NPxENx9XZH9F0VU4= github.com/linode/linode-docs-theme v0.0.0-20240610162252-dd3795f29d6a h1:63YCTfsqj+e3ejp72H5bqZyMjW3Y+aH7LbElBUV0+QQ= github.com/linode/linode-docs-theme v0.0.0-20240610162252-dd3795f29d6a/go.mod h1:IHFGag+AZAtmiEdw1tfqB/svFE0NPxENx9XZH9F0VU4= +github.com/linode/linode-docs-theme v0.0.0-20240618214412-23d0d6b33823 h1:V7w2OtECiqbNn7Hgok1Om4ebW1qIxEL26XrYVqYLuTw= +github.com/linode/linode-docs-theme v0.0.0-20240618214412-23d0d6b33823/go.mod h1:VJUOubAM5Rxfw4hPlBH+vQ5H6il0m3k5ZYn9OViz+Ok= github.com/linode/linode-website-partials v0.0.0-20221205205120-b6ea1aaa59fb/go.mod h1:K1Em3lwb16JiCwNVftAFwWGhyB9Zkl/nXhxjBBUC1Ao= github.com/linode/linode-website-partials v0.0.0-20221222200538-99862e429110/go.mod h1:K1Em3lwb16JiCwNVftAFwWGhyB9Zkl/nXhxjBBUC1Ao= github.com/linode/linode-website-partials v0.0.0-20230201145731-a8703d0a954a/go.mod h1:K1Em3lwb16JiCwNVftAFwWGhyB9Zkl/nXhxjBBUC1Ao= @@ -303,3 +305,4 @@ github.com/linode/linode-website-partials v0.0.0-20231027173434-abbc557a5519/go. github.com/linode/linode-website-partials v0.0.0-20240130163753-4a933fe77633/go.mod h1:K1Em3lwb16JiCwNVftAFwWGhyB9Zkl/nXhxjBBUC1Ao= github.com/linode/linode-website-partials v0.0.0-20240424162657-dcb8464d17f3/go.mod h1:K1Em3lwb16JiCwNVftAFwWGhyB9Zkl/nXhxjBBUC1Ao= github.com/linode/linode-website-partials v0.0.0-20240426140442-12b76ccbfefd/go.mod h1:K1Em3lwb16JiCwNVftAFwWGhyB9Zkl/nXhxjBBUC1Ao= +github.com/linode/linode-website-partials v0.0.0-20240516182804-8b13c1f13759/go.mod h1:K1Em3lwb16JiCwNVftAFwWGhyB9Zkl/nXhxjBBUC1Ao=