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 c4c0a38c5da..0da3d3d07fc 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 @@ -15,7 +15,6 @@ import { toggleBooleanClass, setIsTranslating, getCurrentLang, scrollToActiveExp import { leackChecker } from './helpers/leak-checker'; import { addLangToLinks, - newBreadcrumbsController, newLanguageSwitcherController, newNavController, newPromoCodesController, @@ -94,7 +93,6 @@ const searchConfig = getSearchConfig(params); Alpine.data('lncSearchExplorerInitial', () => newSearchExplorerInitial()); Alpine.data('lncSearchExplorerHydrated', () => newSearchExplorerHydrated(searchConfig)); Alpine.data('lncToc', newToCController); - Alpine.data('lncBreadcrumbs', () => newBreadcrumbsController(searchConfig)); Alpine.data('lncDropdowns', newDropdownsController); Alpine.data('lncTabs', newTabsController); Alpine.data('lncDisqus', newDisqus); diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/breadcrumbs.js b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/breadcrumbs.js deleted file mode 100644 index 0cf7a3f35c9..00000000000 --- a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/breadcrumbs.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -import { newCreateHref } from './create-href'; - -var debug = 0 ? console.log.bind(console, '[breadcrumbs]') : function () {}; - -export function newBreadcrumbsController(searchConfig) { - if (!searchConfig) { - throw 'newBreadcrumbsController: must provide searchConfig'; - } - const hrefFactory = newCreateHref(searchConfig); - - return { - data: { - breadcrumbs: { - sections: [], - }, - }, - breadCrumbsCreated: false, - init: function () { - this.$nextTick(() => { - this.$store.search.withBlank((result) => { - let parts = hrefFactory.sectionsFromPath(); - let sections = []; - let sectionKeys = []; - for (let i = 0; i < parts.length; i++) { - let section = parts[i]; - sectionKeys.push(section.toLowerCase()); - let key = sectionKeys.join(' > '); - let sm = result.getSectionMeta(key); - if (sm) { - sections.push(sm); - } else { - // Just show a link to the home page in the breadcrumbs. - // This is mostly a misspelled URL. - // We could create a path based on the location, - // as we do sanitize in sectionsFromPath, - // but let's not open up to potential XSS attacks. - sections.length = 0; - break; - } - } - - this.data.breadcrumbs.sections = sections; - }); - }); - }, - }; -} diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/explorer.js b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/explorer.js index c7ed747b30f..8128b6d4a8a 100644 --- a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/explorer.js +++ b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/explorer.js @@ -86,30 +86,76 @@ export function newSearchExplorerHydrated(searchConfig) { facets: [], }, + // Flag to indicate if the explorer has been activated. + activated: false, + isActive: function () { return this.isOpen() && this.$store.search.shouldShowHydratedExplorerAndIsHydrated(); }, - init: async function () { - debug('newSearchExplorerHydrated.init'); - const handleKeyOpenStack = () => { - let stack = this.$store.search.explorer.keyOpenStack; - debug('handleKeyOpenStack', stack.length); - if (!stack.length) { + init: function () { + let isInit = false; + let activate = () => { + if (isInit) { return; } - let nn = stack.pop(); - let open = !nn.open; - let n = this.explorer.facets.find((n) => n.key === nn.key); - if (n && n.open != open) { - n.open = open; - if (open) { - openNodeAndCloseTheOthers(n, this.explorer.facets); - } - } - this.activateHydration(); + isInit = true; + this.doActivate(); + this.activated = true; }; + this.$watch('$store.search.results.main.result', (value) => { + activate(); + }); + + this.$watch('$store.search.explorer.keyOpenStack', (value) => { + activate(); + if (this.$store.search.explorer.hydrated) { + this.handleKeyOpenStack(); + } + }); + + this.$watch(' $store.search.explorer.hydrated', (value) => { + this.handleKeyOpenStack(); + }); + + this.doInit(); + }, + + handleKeyOpenStack: function () { + if (!this.activated) { + return; + } + let stack = this.$store.search.explorer.keyOpenStack; + debugDev('handleKeyOpenStack', stack.length, this.explorer.facets.length); + if (!stack.length || !this.explorer.facets.length) { + return; + } + + let nn = stack.pop(); + let open = !nn.open; + let n = this.explorer.facets.find((n) => n.key === nn.key); + if (n && n.open != open) { + n.open = open; + if (open) { + openNodeAndCloseTheOthers(n, this.explorer.facets); + } + } + this.activateHydration(); + }, + + doInit: function () { + debug('newSearchExplorerHydrated.doActivate'); + + this.$watch('$store.search.results.main.sectionFacets', (value) => { + debug('watch $store.search.results.main.sectionFacets'); + updateFacetState(this.explorer.facets, value); + }); + }, + + doActivate: function () { + debug('newSearchExplorerHydrated.doInit'); + this.$store.search.withExplorerData((data) => { let facets = data.blank.sectionFacets; // Apply some metadata used for Algolia events and similar. @@ -168,18 +214,9 @@ export function newSearchExplorerHydrated(searchConfig) { this.explorer.rootNodes = rootNodes; - this.$watch('$store.search.results.main.sectionFacets', (value) => { - debug('watch $store.search.results.main.sectionFacets'); - updateFacetState(this.explorer.facets, value); - }); - - this.$watch('$store.search.explorer.keyOpenStack', (value) => { - debug('$store.search.explorer.keyOpenStack', value); - handleKeyOpenStack(); - }); - this.openAndCloseNodes(); this.$store.search.explorer.hydrated = true; + debugDev('hydrated'); }, createExplorerNodeRequest); }, @@ -224,18 +261,7 @@ export function newSearchExplorerHydrated(searchConfig) { closeLevel(1, this.explorer.facets); } else { let hrefSection = pageInfo.hrefSection; - if (pageInfo.section === 'api') { - // The API section is currently a little special. - hrefSection = pageInfo.href; - } else if (pageInfo.href === '/docs/sections/') { - // E.g. blog, marketplace. These are static only on the first level. - // We need to open up the second level. - hrefSection = decodeURI(window.location.pathname); - - // We don't have a static representation of these nodes. - this.activateHydration(true); - } - debugDev('openAndCloseNodes.hrefSection', hrefSection); + debug('openAndCloseNodes.hrefSection', hrefSection); let currentNode = this.findNode(hrefSection); if (currentNode) { currentNode.open = currentNode.count > 0; @@ -255,7 +281,6 @@ export function newSearchExplorerNode(searchConfig, node) { let ctrl = { node: node, - counter: 0, state: { childNodes: [], pages: [], // Includes only visible pages. @@ -409,7 +434,6 @@ export function newSearchExplorerNode(searchConfig, node) { { pronto: true, query: query, - fileCacheID: self.node.key, }, ); }, @@ -480,7 +504,7 @@ const findChildren = function (href, nodes) { }; const openNodeAndCloseTheOthers = function (node, nodes) { - debugDev('openNodeAndCloseTheOthers', node.href); + debug('openNodeAndCloseTheOthers', node.href); for (let i = 0; i < nodes.length; i++) { let n = nodes[i]; if (node.href.startsWith(n.href)) { @@ -489,7 +513,7 @@ const openNodeAndCloseTheOthers = function (node, nodes) { n.open = false; } if (n.open) { - debugDev('openNodeAndCloseTheOthers.open', n.href); + debug('openNodeAndCloseTheOthers.open', n.href); } } }; diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/index.js b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/index.js index 0c2a2316c5c..f69e3b39294 100644 --- a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/index.js +++ b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/index.js @@ -1,4 +1,3 @@ -export * from './breadcrumbs'; export * from './explorer'; export * from './create-href'; export * from './lang'; diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/nav-store.js b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/nav-store.js index 2896c5b5108..ee8ca111c04 100644 --- a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/nav-store.js +++ b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/navigation/nav-store.js @@ -128,8 +128,6 @@ export function newNavStore(searchConfig, searchStore, params, Alpine) { this.onetrust.functional = groupArray.includes('C0003'); this.onetrust.targeting = groupArray.includes('C0004'); this.onetrust.socialmedia = groupArray.includes('C0005'); - - console.log('updateOptanonGroups', this.onetrust); }, openSearchPanel(scrollUp = false) { diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/search/request.ts b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/search/request.ts index 70d91b09705..953bf048214 100644 --- a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/search/request.ts +++ b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/search/request.ts @@ -15,7 +15,6 @@ interface Request { interface RequestMeta { query: Query; pronto: boolean; - fileCacheID: string; } @@ -36,7 +35,6 @@ interface RequestCallback { meta?: RequestMeta; isFiltered(): boolean; - getFileCacheID(): string; } export enum RequestCallBackStatus { @@ -75,13 +73,7 @@ export const newRequestCallback = function( return false; } return meta.query.isFiltered(); - }, - getFileCacheID: function(): string { - if (!meta) { - return ''; - } - return meta.fileCacheID; - } + }, }; }; diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/search/search-store.js b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/search/search-store.js index db50ffef9da..a6fcb0063f2 100644 --- a/_vendor/github.com/linode/linode-docs-theme/assets/js/main/search/search-store.js +++ b/_vendor/github.com/linode/linode-docs-theme/assets/js/main/search/search-store.js @@ -60,8 +60,6 @@ const createSectionFacetsSorted = function (searchConfig, result) { }; export function newSearchStore(searchConfig, params, Alpine) { - let cacheWarmerUrls = params.search_cachewarmer_urls; - let setResult = function (result, loaded = true) { let facets = createSectionFacetsSorted(searchConfig, result); this.sectionFacets = facets; @@ -84,7 +82,7 @@ export function newSearchStore(searchConfig, params, Alpine) { results.lastQueryID = result.queryID; }; - const searcher = new Searcher(searchConfig, results.blank, cacheWarmerUrls, resultCallback, debug); + const searcher = new Searcher(searchConfig, results.blank, resultCallback, debug); let searchEffectMain = null; const router = newCreateHref(searchConfig); const queryHandler = new QueryHandler(); @@ -298,7 +296,6 @@ export function newSearchStore(searchConfig, params, Alpine) { }, { query: query, - fileCacheID: sectionKey, }, ); }, @@ -342,24 +339,15 @@ export function newSearchStore(searchConfig, params, Alpine) { }, new Map()); markLoaded(); }, - { - fileCacheID: 'sectionsmeta', - }, - ), - newRequestCallback( - createSectionRequest(null), - (result) => { - if (!result.index.endsWith('linode-merged')) { - throw `invalid state: ${result.index}`; - } - debug('withBlank.blank.result:', result); - this.results.blank.set(result, false); - markLoaded(); - }, - { - fileCacheID: 'explorer-blank', - }, ), + newRequestCallback(createSectionRequest(null), (result) => { + if (!result.index.endsWith('linode-merged')) { + throw `invalid state: ${result.index}`; + } + debug('withBlank.blank.result:', result); + this.results.blank.set(result, false); + markLoaded(); + }), ); }, }; @@ -589,7 +577,7 @@ const normalizeResult = function (self, result) { }; class SearchBatcher { - constructor(searchConfig, metaProvider, cacheWarmerUrls, resultCallback = (result) => {}) { + constructor(searchConfig, metaProvider, resultCallback = (result) => {}) { const algoliaHost = `https://${searchConfig.app_id}-dsn.algolia.net`; this.headers = { 'X-Algolia-Application-Id': searchConfig.app_id, @@ -601,7 +589,6 @@ class SearchBatcher { this.cacheEnabled = true; this.metaProvider = metaProvider; this.resultCallback = resultCallback; - this.cacheWarmerUrls = cacheWarmerUrls; this.interval = () => { return 100; }; @@ -674,33 +661,6 @@ class SearchBatcher { return { cacheMisses: cacheMisses, cacheMissesKeys: cacheMissesKeys }; } - async checkFileCache(fileCacheID) { - // Try the local file cache if found. - let fileCacheUrl = this.cacheWarmerUrls[fileCacheID]; - - if (fileCacheUrl) { - debug('fetch data from file cache:', fileCacheUrl); - const response = await fetch(fileCacheUrl, { credentials: 'same-origin' }); - - if (response.ok) { - let data = await response.json(); - if (Array.isArray(data)) { - if (data.length > 0) { - // We currently don't want the branch nodes (in the explorer). - data = data.filter((item) => !item.isBranch); - } - data = { - hits: data, - }; - } - - normalizeResult(this, data); - return data; - } - } - return null; - } - async search(...requestCallbacks) { debug('search, num requests:', requestCallbacks.length); if (requestCallbacks.length === 0) { @@ -734,21 +694,6 @@ class SearchBatcher { continue; } - if (!rc.isFiltered()) { - let fileCacheID = rc.getFileCacheID(); - if (fileCacheID) { - let data = await this.checkFileCache(fileCacheID); - if (data) { - rc.callback(data); - this.resultCallback(data); - if (this.cacheEnabled) { - this.cache.set(rck, data); - } - continue; - } - } - } - requests.push(req); cacheResult.cacheMissesKeys.push(rck); cacheResult.cacheMisses.push(rc); @@ -803,8 +748,8 @@ class SearchBatcher { } class Searcher { - constructor(searchConfig, metaProvider, cacheWarmerUrls, resultCallback, debug = function () {}) { - this.batcher = new SearchBatcher(searchConfig, metaProvider, cacheWarmerUrls, resultCallback); + constructor(searchConfig, metaProvider, resultCallback, debug = function () {}) { + this.batcher = new SearchBatcher(searchConfig, metaProvider, resultCallback); } searchFactories(factories, query) { diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/json/search_cachewarmer_queries/explorer-blank.json b/_vendor/github.com/linode/linode-docs-theme/assets/json/search_cachewarmer_queries/explorer-blank.json deleted file mode 100644 index ef6a98036a0..00000000000 --- a/_vendor/github.com/linode/linode-docs-theme/assets/json/search_cachewarmer_queries/explorer-blank.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indexName": "linode-merged", - "facets": ["section.*", "docType", "category", "tags"], - "distinct": 1 -} diff --git a/_vendor/github.com/linode/linode-docs-theme/assets/json/search_cachewarmer_queries/sectionsmeta.json b/_vendor/github.com/linode/linode-docs-theme/assets/json/search_cachewarmer_queries/sectionsmeta.json deleted file mode 100644 index f28a41a2e54..00000000000 --- a/_vendor/github.com/linode/linode-docs-theme/assets/json/search_cachewarmer_queries/sectionsmeta.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "indexName": "linode-documentation-sections", - "params": "query=&hitsPerPage=600" -} diff --git a/_vendor/github.com/linode/linode-docs-theme/config.toml b/_vendor/github.com/linode/linode-docs-theme/config.toml index 03610be6358..41f8c096dca 100644 --- a/_vendor/github.com/linode/linode-docs-theme/config.toml +++ b/_vendor/github.com/linode/linode-docs-theme/config.toml @@ -94,6 +94,7 @@ [params.search_config2.sections.guides] name = "guides" + hugo_section = "guides" filters = "section.lvl0:guides" weight = 10 title = "Cloud Guides & Tutorials" @@ -111,7 +112,8 @@ [params.search_config2.sections.reference-architecture] name = "reference-architecture" - filters = "section.lvl0:guides" + hugo_section = "reference-architecture" + filters = "section.lvl0:reference-architecture" weight = 20 title = "Reference Architectures" noun = "Reference" @@ -119,6 +121,7 @@ [params.search_config2.sections.marketplace-docs] name = "marketplace-docs" + hugo_section = "marketplace-docs" weight = 25 title = "Marketplace Docs" noun = "Marketplace" diff --git a/_vendor/github.com/linode/linode-docs-theme/content/sections/_index.md b/_vendor/github.com/linode/linode-docs-theme/content/sections/_index.md deleted file mode 100644 index bdec313a310..00000000000 --- a/_vendor/github.com/linode/linode-docs-theme/content/sections/_index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Section - -cascade: - _build: - render: true - list: false - publishResources: false ---- diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/_default/_markup/render-heading.html b/_vendor/github.com/linode/linode-docs-theme/layouts/_default/_markup/render-heading.html index db2d8b9f45c..df19f922726 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/_default/_markup/render-heading.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/_default/_markup/render-heading.html @@ -1,9 +1,4 @@ {{- $id := .Anchor -}} {{- $level := .Level -}} -{{ if eq .Page.Section "release-notes" }} -{{- $level = add $level 1 -}} -{{- $slug := .Page.Slug | default .Page.Title -}} -{{- $id = printf "%s-%s" ($slug | anchorize) $id -}} -{{- end -}} -{{- $ariaLabel := printf "%s: %s" .Page.LinkTitle .Text }} -{{ partial "heading" (dict "id" $id "level" $level "text" .Text "ariaLabel" $ariaLabel) }} \ No newline at end of file +{{- $ariaLabel := printf "%s: %s" .Page.LinkTitle .Text }} +{{ partial "heading" (dict "id" $id "level" $level "text" .Text "ariaLabel" $ariaLabel) }} diff --git a/_vendor/github.com/linode/linode-docs-theme/layouts/_default/list.html b/_vendor/github.com/linode/linode-docs-theme/layouts/_default/list.html index 5a689e784c0..ab40a08029a 100644 --- a/_vendor/github.com/linode/linode-docs-theme/layouts/_default/list.html +++ b/_vendor/github.com/linode/linode-docs-theme/layouts/_default/list.html @@ -5,18 +5,12 @@ {{ define "main" }} {{ template "list-js" . }} {{ end }} {{ define "list-js" }} - {{ $isDynamic := eq .RelPermalink "/docs/sections/" }}
{{ partial "components/error.html" . }}