Skip to content

Commit 5063f17

Browse files
filzrevp-kostov
authored andcommitted
feat: Add additional layout options to modern template (dotnet#9737)
* feat: add additional layout options to modern template * chore: Remove min-height attribute from actionbar styles
1 parent 8ca900e commit 5063f17

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

docs/docs/template.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Name | Type | Description
4040
`_gitContribute` | object | Defines the `repo` and `branch` property of git links.
4141
`_gitUrlPattern` | string | URL pattern of git links.
4242
`_disableNewTab` | bool | Whether to render external link indicator icons and open external links in a new tab.
43+
`_disableNavbar` | bool | Whether to show the navigation bar.
44+
`_disableBreadcrumb` | bool | Whether to show the breadcrumb.
45+
`_disableToc` | bool | Whether to show the TOC.
46+
`_disableAffix` | bool | Whether to show the right rail.
4347
`_disableNextArticle` | bool | Whether to show the previous and next article link.
4448
`_disableTocFilter` | bool | Whether to show the table of content filter box.
4549
`_googleAnalyticsTagId` | string | Enables Google Analytics web traffic analysis.

templates/modern/layout/_master.tmpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
<body class="tex2jax_ignore" data-layout="{{_layout}}{{layout}}" data-yaml-mime="{{yamlmime}}">
6262
<header class="bg-body border-bottom">
63+
{{^_disableNavbar}}
6364
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
6465
<div class="container-xxl flex-nowrap">
6566
<a class="navbar-brand" href="{{_appLogoUrl}}{{^_appLogoUrl}}{{_rel}}index.html{{/_appLogoUrl}}">
@@ -81,9 +82,11 @@
8182
</div>
8283
</div>
8384
</nav>
85+
{{/_disableNavbar}}
8486
</header>
8587

8688
<main class="container-xxl">
89+
{{^_disableToc}}
8790
<div class="toc-offcanvas">
8891
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
8992
<div class="offcanvas-header">
@@ -95,16 +98,21 @@
9598
</div>
9699
</div>
97100
</div>
101+
{{/_disableToc}}
98102

99103
<div class="content">
100104
<div class="actionbar">
105+
{{^_disableToc}}
101106
<button class="btn btn-lg border-0 d-md-none" style="margin-top: -.65em; margin-left: -.8em"
102107
type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas"
103108
aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
104109
<i class="bi bi-list"></i>
105110
</button>
111+
{{/_disableToc}}
106112

113+
{{^_disableBreadcrumb}}
107114
<nav id="breadcrumb"></nav>
115+
{{/_disableBreadcrumb}}
108116
</div>
109117

110118
<article data-uid="{{uid}}">
@@ -128,9 +136,11 @@
128136

129137
</div>
130138

139+
{{^_disableAffix}}
131140
<div class="affix">
132141
<nav id="affix"></nav>
133142
</div>
143+
{{/_disableAffix}}
134144
</main>
135145

136146
{{#_enableSearch}}

templates/modern/src/layout.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ body[data-layout="landing"] {
161161
display: flex;
162162
align-items: flex-start;
163163
margin-top: .5rem;
164-
min-height: 40px;
165164
}
166165

167166
article {

templates/modern/src/nav.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export type NavItemContainer = {
2323
export async function renderNavbar(): Promise<NavItem[]> {
2424
const navbar = document.getElementById('navbar')
2525
if (!navbar) {
26-
return
26+
return []
2727
}
2828

2929
const { iconLinks } = await options()

0 commit comments

Comments
 (0)