Skip to content

Commit 7b373a5

Browse files
fix: correct id attribute for main content in multiple layout files
risk: low
1 parent c102392 commit 7b373a5

File tree

4 files changed

+101
-3
lines changed

4 files changed

+101
-3
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 id="#main-content" 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
@@ -22,7 +22,7 @@
2222
<div class="d-none d-xl-block col-xl-2 td-toc d-print-none">
2323
{{ partial "toc.html" . }}
2424
</div>
25-
<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">
25+
<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">
2626
{{ partial "version-banner.html" . }}
2727
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
2828
{{ if .Draft }}

docs/layouts/partials/sidebar.html

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

docs/layouts/swagger/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<div class="d-none d-xl-block col-xl-2 td-toc d-print-none">
2424
{{ partial "toc.html" . }}
2525
</div>
26-
<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">
26+
<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">
2727
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
2828
<script src="/js/swagger-ui-bundle.js"></script>
2929
<script src="/js/swagger-ui-standalone-preset.js"></script>

0 commit comments

Comments
 (0)