diff --git a/assets/js/components/api-nav.ts b/assets/js/components/api-nav.ts
deleted file mode 100644
index 876ca8092..000000000
--- a/assets/js/components/api-nav.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * API Navigation Component
- *
- * Handles collapsible navigation groups in the API sidebar.
- * Features:
- * - Toggle expand/collapse on group headers
- * - ARIA accessibility support
- * - Keyboard navigation
- *
- * Usage:
- *
- */
-
-interface ComponentOptions {
- component: HTMLElement;
-}
-
-/**
- * Initialize API Navigation component
- */
-export default function ApiNav({ component }: ComponentOptions): void {
- const headers = component.querySelectorAll(
- '.api-nav-group-header'
- );
-
- headers.forEach((header) => {
- header.addEventListener('click', () => {
- const isOpen = header.classList.toggle('is-open');
- header.setAttribute('aria-expanded', String(isOpen));
-
- const items = header.nextElementSibling;
- if (items) {
- items.classList.toggle('is-open', isOpen);
- }
- });
-
- // Keyboard support - Enter and Space already work for buttons
- // but add support for arrow keys to navigate between groups
- header.addEventListener('keydown', (event: KeyboardEvent) => {
- const allHeaders = Array.from(headers);
- const currentIndex = allHeaders.indexOf(header);
-
- switch (event.key) {
- case 'ArrowDown':
- event.preventDefault();
- if (currentIndex < allHeaders.length - 1) {
- allHeaders[currentIndex + 1].focus();
- }
- break;
- case 'ArrowUp':
- event.preventDefault();
- if (currentIndex > 0) {
- allHeaders[currentIndex - 1].focus();
- }
- break;
- case 'Home':
- event.preventDefault();
- allHeaders[0].focus();
- break;
- case 'End':
- event.preventDefault();
- allHeaders[allHeaders.length - 1].focus();
- break;
- }
- });
- });
-}
diff --git a/assets/js/content-interactions.js b/assets/js/content-interactions.js
index eb9b4e1bc..4c2a374c0 100644
--- a/assets/js/content-interactions.js
+++ b/assets/js/content-interactions.js
@@ -122,21 +122,29 @@ function expandAccordions() {
// Expand accordions on load based on URL anchor
function openAccordionByHash() {
- var anchor = window.location.hash;
+ var hash = window.location.hash;
+ if (!hash || hash.length <= 1) return;
+
+ // Use native DOM method to handle special characters in IDs (like /)
+ var id = hash.substring(1); // Remove leading #
+ var anchorElement = document.getElementById(id);
+ if (!anchorElement) return;
+
+ var $anchor = $(anchorElement);
function expandElement() {
- if ($(anchor).parents('.expand').length > 0) {
- return $(anchor).closest('.expand').children('.expand-label');
- } else if ($(anchor).hasClass('expand')) {
- return $(anchor).children('.expand-label');
+ if ($anchor.parents('.expand').length > 0) {
+ return $anchor.closest('.expand').children('.expand-label');
+ } else if ($anchor.hasClass('expand')) {
+ return $anchor.children('.expand-label');
}
+ return null;
}
- if (expandElement() != null) {
- if (expandElement().children('.expand-toggle').hasClass('open')) {
- // Do nothing?
- } else {
- expandElement().children('.expand-toggle').trigger('click');
+ var $expandLabel = expandElement();
+ if ($expandLabel != null) {
+ if (!$expandLabel.children('.expand-toggle').hasClass('open')) {
+ $expandLabel.children('.expand-toggle').trigger('click');
}
}
}
diff --git a/assets/js/main.js b/assets/js/main.js
index a3cfbaddc..80c9ac7e4 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -46,7 +46,6 @@ import SidebarSearch from './components/sidebar-search.js';
import { SidebarToggle } from './sidebar-toggle.js';
import Theme from './theme.js';
import ThemeSwitch from './theme-switch.js';
-import ApiNav from './components/api-nav.ts';
import ApiScalar from './components/api-scalar.ts';
import ApiTabs from './components/api-tabs.ts';
import ApiToc from './components/api-toc.ts';
@@ -81,7 +80,6 @@ const componentRegistry = {
'sidebar-toggle': SidebarToggle,
theme: Theme,
'theme-switch': ThemeSwitch,
- 'api-nav': ApiNav,
'api-scalar': ApiScalar,
'api-tabs': ApiTabs,
'api-toc': ApiToc,
diff --git a/layouts/partials/api/sidebar-nav.html b/layouts/partials/api/sidebar-nav.html
deleted file mode 100644
index 31fb525af..000000000
--- a/layouts/partials/api/sidebar-nav.html
+++ /dev/null
@@ -1,261 +0,0 @@
-{{/*
- API Reference Navigation for Sidebar
-
- Displays a collapsible navigation tree for API endpoints,
- organized by functional groups defined in data/api_nav_groups.yml.
-
- Uses Hugo data from data/article-data/ to build navigation.
- Supports both tag-based (new) and path-based (legacy) article data.
-*/}}
-
-{{/* Get product path data for data lookup */}}
-{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }}
-{{ $product := index $productPathData 0 }}
-{{ $version := index $productPathData 1 }}
-
-{{/* Build data key for article data lookup */}}
-{{/* Hugo converts hyphens to underscores in data file keys */}}
-{{ $dataKey := "" }}
-{{ if eq $product "influxdb3" }}
- {{ $dataKey = print "influxdb3_" $version }}
-{{ else if eq $product "influxdb" }}
- {{ $dataKey = print $version }}
-{{ else }}
- {{ $dataKey = $product }}
-{{ end }}
-
-{{/* Get article data for this product */}}
-{{/*
- Hugo data path: data/article_data/influxdb/influxdb3_core/articles.yml
- Access: .Site.Data.article_data.influxdb.influxdb3_core.articles.articles
-
- The double "articles" is because:
- - First "articles" is the filename (articles.yml)
- - Second "articles" is the key inside the YAML file
-*/}}
-{{ $articles := slice }}
-{{ with .Site.Data.article_data }}
- {{ with index . "influxdb" }}
- {{ with index . $dataKey }}
- {{ with index . "articles" }}
- {{ with index . "articles" }}
- {{ $articles = . }}
- {{ end }}
- {{ end }}
- {{ end }}
- {{ end }}
-{{ end }}
-
-{{/* Get navigation groups configuration */}}
-{{ $navGroups := .Site.Data.api_nav_groups.groups }}
-
-{{/* Check if articles use tag-based structure */}}
-{{ $isTagBased := false }}
-{{ if gt (len $articles) 0 }}
- {{ $firstArticle := index $articles 0 }}
- {{ if reflect.IsMap $firstArticle }}
- {{ with index $firstArticle "fields" }}
- {{ if reflect.IsMap . }}
- {{ if isset . "tag" }}
- {{ $isTagBased = true }}
- {{ end }}
- {{ end }}
- {{ end }}
- {{ end }}
-{{ end }}
-
-{{ if and (gt (len $articles) 0) $navGroups $isTagBased }}
-{{/* Tag-based navigation */}}
-
-{{ else if gt (len $articles) 0 }}
-{{/* Legacy path-based navigation (fallback) */}}
-
-{{ end }}
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index 1352bccf1..bbbb263d0 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -74,12 +74,12 @@
{{ $platformMenu := .Site.Menus.platform }}
- {{ partial "sidebar/nested-menu" (dict "page" $currentPage "menu" $mainMenu) . }}
+ {{ partial "sidebar/nested-menu" (dict "page" $currentPage "menu" $mainMenu "siteData" .Site.Data) }}
{{ if gt (len $refMenu) 0 }}
Reference
- {{ partial "sidebar/nested-menu" (dict "page" $currentPage "menu" $refMenu) . }}
+ {{ partial "sidebar/nested-menu" (dict "page" $currentPage "menu" $refMenu "siteData" .Site.Data) }}
{{ end }}
@@ -97,7 +97,7 @@
{{ $platformWhitelist := `telegraf|chronograf|kapacitor|enterprise_influxdb|influxdb_1` }}
{{ if gt (len (findRE $platformWhitelist $menuKey)) 0 }}
- {{ partial "sidebar/nested-menu" (dict "page" $currentPage "menu" $platformMenu) . }}
+ {{ partial "sidebar/nested-menu" (dict "page" $currentPage "menu" $platformMenu "siteData" .Site.Data) }}
{{ end }}
@@ -110,9 +110,4 @@
{{ end }}
-
- {{/* API Reference Navigation - shown only for API pages */}}
- {{ if eq .Type "api" }}
- {{ partial "api/sidebar-nav.html" . }}
- {{ end }}