Skip to content

Commit 791c0a1

Browse files
fix: added ids to main content
risk: low
1 parent bef53ea commit 791c0a1

File tree

5 files changed

+100
-4
lines changed

5 files changed

+100
-4
lines changed

docs/layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{ partial "navbar.html" . }}
1111
</header>
1212
<div class="container-fluid td-default td-outer">
13-
<main role="main" class="td-main" aria-label="Article content">
13+
<main id="main-content" role="main" class="td-main" aria-label="Article content">
1414
{{ block "main" . }}{{ end }}
1515
</main>
1616
{{ partialCached "footer.html" . }}

docs/layouts/docs/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<div class="d-none d-xl-block col-xl-2 td-toc d-print-none">
2626
{{ partial "toc.html" . }}
2727
</div>
28-
<main class="col-12 col-lg-8 col-xl-7 pl-lg-5 ps-lg-5" role="main" aria-label="Article content">
28+
<main id="main-content" class="col-12 col-lg-8 col-xl-7 pl-lg-5 ps-lg-5" role="main" aria-label="Article content">
2929
{{ partial "version-banner.html" . }}
3030
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
3131
{{ if .Draft }}

docs/layouts/partials/navbar-version-selector.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
{{ $.Scratch.Set "activeVersion" .version }}
1010
{{ end }}
1111
{{ end }}
12-
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
12+
<button class="nav-link dropdown-toggle" id="navbarDropdown" role="button" data-toggle="dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
1313
{{ printf "%s" ($.Scratch.Get "docLabel") }}
14-
</a>
14+
</button>
1515
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
1616
{{ range .Site.Params.versions }}
1717
<a

docs/layouts/partials/sidebar.html

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{{/* (C) 2023 GoodData Corporation */}}
2+
<button type="button" id="gd-docs-menu__mobile-trigger" class="gd-docs-menu__mobile-btn" aria-expanded="false" aria-controls="gd-docs-menu" aria-label="Toggle navigation menu">
3+
<span class="gd-docs-menu__mobile-icon" aria-hidden="true"></span>
4+
</button>
5+
<div class="gd-docs-menu__mobile-bg"></div>
6+
<nav id="gd-docs-menu" class="gd-docs-menu init" aria-label="Articles">
7+
{{ if .Site.Params.versions }}
8+
{{ partial "navbar-version-selector.html" . }}
9+
{{ end }}
10+
11+
{{ partial "sidebar-tree.html" . }}
12+
</nav>
13+
14+
{{ define "root-link" }}
15+
{{ $isCurrent := eq .currentPage .root.FirstSection }}
16+
{{ $active := .active }}
17+
{{ with .root }}
18+
<ul class="gd-docs-menu-section gd-docs-menu-section__root">
19+
<li class="gd-docs-menu-page{{ if or $isCurrent $active }} active{{ end }}">
20+
<div class="gd-docs-menu-page__title">
21+
<a href="{{ .RelPermalink }}" class="gd-docs-menu-page__link">{{ .LinkTitle }}</a>
22+
</div>
23+
</li>
24+
</ul>
25+
{{ end }}
26+
{{ end }}
27+
28+
{{ define "section-tree-nav-sections" }}
29+
{{ $root := .root }}
30+
{{ $site := .site }}
31+
{{ $currentPage := .currentPage }}
32+
{{ $firstInSection := (index $root 0) }}
33+
{{ $isRootSection := eq $firstInSection.Parent .site.Home }}
34+
35+
{{ if gt (len (where $root.ByWeight "Params.toc_hide" "ne" true)) 0 }}
36+
37+
<ul class="gd-docs-menu-section{{ if .activeSection }} active{{ end }}">
38+
{{ range $page := $root.ByWeight }}
39+
{{ $page := $page.Page }}
40+
{{ $pageId := replace (replaceRE "^/|/$" "" $page.RelPermalink) "/" "_" }}
41+
42+
{{ if and (not (eq $page.Params.toc_hide true)) (not (eq $page $site.Home)) }}
43+
{{ $activePage := eq $page $currentPage }}
44+
{{ $activeSection := or $activePage ($currentPage.IsDescendant $page) }}
45+
{{ $pageId := replace (replaceRE "^/|/$" "" $page.RelPermalink) "/" "_" }}
46+
47+
<li class="gd-docs-menu-page{{ if $activePage }} active{{ end }}{{ if $page.Params.navSeparator }} gd-docs-menu-page__separator{{ end }}">
48+
{{ if $page.Params.navigationLabel }}
49+
<span class="gd-docs-menu-page__label">{{ $page.LinkTitle }}</span>
50+
{{ else }}
51+
<div class="gd-docs-menu-page__title">
52+
{{ if $page.Params.externalLink }}
53+
<a href="{{ $page.Params.externalLink }}" class="gd-docs-menu-page__link" target="_blank">{{ $page.LinkTitle }}</a>
54+
{{ else }}
55+
<a href="{{ $page.Permalink }}" class="gd-docs-menu-page__link">{{ $page.LinkTitle }}</a>
56+
{{ end }}
57+
58+
{{ if $page.Pages }}
59+
<button
60+
type="button"
61+
id="btn-{{ $pageId }}"
62+
class="gd-docs-menu-page__toggle-btn"
63+
aria-expanded="{{ if $activeSection }}true{{ else }}false{{ end }}"
64+
aria-controls="section-{{ $pageId }}"
65+
aria-label="{{ if $activeSection }}Collapse{{ else }}Expand{{ end }} {{ $page.LinkTitle }} section">
66+
<span class="gd-docs-menu-page__chevron">
67+
{{ with resources.Get "icons/chevron-menu.svg" }}
68+
{{ $svg := . | minify }}
69+
{{ $svg := replace $svg.Content "<svg " "<svg aria-hidden=\"true\" focusable=\"false\" " }}
70+
{{ $svg | safeHTML }}
71+
{{ end }}
72+
</span>
73+
</button>
74+
{{ end }}
75+
</div>
76+
77+
{{ if $page.Pages }}
78+
<div id="section-{{ $pageId }}" class="gd-docs-menu-section-wrapper{{ if $activeSection }} expanded{{ end }}">
79+
{{ template "section-tree-nav-sections" (dict "root" $page.Pages "currentPage" $currentPage "activeSection" $activeSection "site" $site) }}
80+
</div>
81+
{{ end }}
82+
{{ end }}
83+
</li>
84+
85+
{{ if and $page.Params.navigationLabel $page.Pages }}
86+
<li class="gd-docs-menu-page">
87+
{{ template "section-tree-nav-sections" (dict "root" $page.Pages "currentPage" $currentPage "activeSection" $activeSection "site" $site) }}
88+
</li>
89+
{{ end }}
90+
{{ end }}
91+
{{ end }}
92+
</ul>
93+
{{ end }}
94+
{{ end }}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{/* (C) 2023 GoodData Corporation */}}
2+
<div class="skip-links"></div>

0 commit comments

Comments
 (0)