Skip to content

Commit e6d9477

Browse files
authored
Breadcrumb for blog pages, and per-page/section config (#2161)
1 parent 9fbb3a6 commit e6d9477

File tree

7 files changed

+66
-8
lines changed

7 files changed

+66
-8
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,25 @@ For the full list of changes, see the [0.x.y] release notes.
2828

2929
**New**:
3030

31+
- **[Breadcrumb navigation]** support has been enhanced and adjusted:
32+
- You can now disable breadcrumbs for an entire project, or individual pages
33+
or sections by setting `ui.breadcrumb_disable` to true. For details, see
34+
[Breadcrumb navigation].
35+
- **Blog** pages now also have breadcrumbs by default ([#1788]).
36+
- Index-page single-element breadcrumb lists are hidden by default ([#2160]).
37+
3138
**Other changes**:
3239

33-
- Blog section index page content and title used to be ignored, they are now
40+
- **Blog** section index page content and title used to be ignored, they are now
3441
displayed ([#1787]). To recover the old behavior use the following style
3542
override: `.td-section.td-blog .td-content { display: none; }`.
3643

3744
[0.x.y]: https://github.com/google/docsy/releases/latest?FIXME=v0.X.Y
3845
[#1787]: https://github.com/google/docsy/issues/1787
46+
[#1788]: https://github.com/google/docsy/issues/1788
47+
[#2160]: https://github.com/google/docsy/pull/2160
48+
[Breadcrumb navigation]:
49+
https://www.docsy.dev/docs/adding-content/navigation/#breadcrumb-navigation
3950

4051
## 0.11.0
4152

layouts/blog/baseof.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
<i class="fa-solid fa-rss" aria-hidden="true"></i>
2828
</a>
2929
{{ end -}}
30+
{{ if not (.Param "ui.breadcrumb_disable") -}}
31+
{{ partial "breadcrumb.html" . -}}
32+
{{ end -}}
3033
{{ block "main" . }}{{ end }}
3134
</main>
3235
</div>

layouts/docs/baseof.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
</aside>
2424
<main class="col-12 col-md-9 col-xl-8 ps-md-5" role="main">
2525
{{ partial "version-banner.html" . }}
26-
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
26+
{{ if not (.Param "ui.breadcrumb_disable") -}}
27+
{{ partial "breadcrumb.html" . -}}
28+
{{ end -}}
2729
{{ block "main" . }}{{ end }}
2830
</main>
2931
</div>

layouts/swagger/baseof.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
{{ partial "taxonomy_terms_clouds.html" . }}
2525
</aside>
2626
<main class="col-12 col-md-9 col-xl-8 ps-md-5" role="main">
27-
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
27+
{{ if not (.Param "ui.breadcrumb_disable") -}}
28+
{{ partial "breadcrumb.html" . -}}
29+
{{ end -}}
2830
<script src="https://unpkg.com/swagger-ui-dist@5.1.0/swagger-ui-bundle.js" integrity="sha384-TBW5qg/G561aZRk4jvscdaB7BEDK/9wpe/jS8vyKzK/ls+nJfWQw0W4cobLRYkWk" crossorigin="anonymous"></script>
2931
<script src="https://unpkg.com/swagger-ui-dist@5.1.0/swagger-ui-standalone-preset.js" integrity="sha384-cftHzufgeQ3yLXAwNPSMCBSqPUkItABWOchc20veg7pQ1sDu0FQSp0Grfx/BfhN7" crossorigin="anonymous"></script>
3032
{{ block "main" . }}{{ end }}

userguide/content/en/docs/adding-content/navigation.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,27 @@ To create a placeholder page, create a page file as usual in the directory where
283283

284284
## Breadcrumb navigation
285285

286-
Breadcrumb navigation links appear at the top of each page by default. To disable breadcrumb navigation, set site param `ui.breadcrumb_disable = true` in `hugo.toml`.
286+
[Breadcrumb navigation] appears at the top of each non-index page be default. To
287+
also display single-element breadcrumb lists in index pages, add the following
288+
[style override] to your project:
287289

288-
Breadcrumb navigation links are also shown for each item on the taxonomy results page (i.e. when you click one of the taxonomy labels, e.g. Tags/Categories). These breadcrumbs can be disabled in `hugo.toml` by setting site param `ui.taxonomy_breadcrumb_disable = true`.
290+
```scss
291+
.td-breadcrumbs__single {
292+
display: inline !important;
293+
}
294+
```
295+
296+
[Breadcrumb navigation]: https://en.wikipedia.org/wiki/Breadcrumb_navigation
297+
[style override]: /docs/adding-content/lookandfeel/#project-style-files
298+
299+
Breadcrumb navigation is also shown for each item in the taxonomy results page
300+
&mdash; that is, when you click one of the taxonomy labels such as _Categories_
301+
or _Tags_.
289302

290-
The tabbed pane below lists the breadcrumb navigation options you can define in your project [configuration file].
303+
As illustrated next, you can disable (non-taxonomy) breadcrumb navigation for an
304+
entire project, by setting `ui.breadcrumb_disable` to true in your project
305+
[configuration file]. Similarly, you can disabled taxonomy breadcrumbs by
306+
setting `ui.taxonomy_breadcrumb_disable` to true:
291307

292308
{{< tabpane >}}
293309
{{< tab header="Configuration file:" disabled=true />}}{{< tab header="hugo.toml" lang="toml" >}}
@@ -313,6 +329,17 @@ params:
313329
{{< /tab >}}
314330
{{< /tabpane >}}
315331

332+
To disable breadcrumbs in a specific page or section set `ui.breadcrumb_disable`
333+
to true in the page or section-index front matter. Here is an example of the
334+
latter:
335+
336+
```yaml
337+
cascade:
338+
params:
339+
ui:
340+
breadcrumb_disable: true
341+
```
342+
316343
## Heading self links
317344
{.test-class}
318345

userguide/content/en/project/_index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ description: Docsy project design documentation and other resources
55
outputs: [HTML]
66
cascade:
77
type: docs
8-
# ui:
9-
# breadcrumb_disable: true
8+
params:
9+
ui:
10+
breadcrumb_disable: true
1011
---
1112

1213
- Docsy build and design notes (TBC)

userguide/static/refcache.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@
375375
"StatusCode": 206,
376376
"LastSeen": "2025-01-07T17:47:01.735556-05:00"
377377
},
378+
"https://github.com/google/docsy/issues/1788": {
379+
"StatusCode": 206,
380+
"LastSeen": "2025-01-08T13:26:59.139291-05:00"
381+
},
378382
"https://github.com/google/docsy/issues/1812": {
379383
"StatusCode": 200,
380384
"LastSeen": "2024-11-06T12:03:52.305697-05:00"
@@ -563,6 +567,10 @@
563567
"StatusCode": 200,
564568
"LastSeen": "2024-11-06T12:04:13.893357-05:00"
565569
},
570+
"https://github.com/google/docsy/pull/2160": {
571+
"StatusCode": 206,
572+
"LastSeen": "2025-01-08T13:26:59.610341-05:00"
573+
},
566574
"https://github.com/google/docsy/pulls": {
567575
"StatusCode": 200,
568576
"LastSeen": "2024-11-06T12:03:15.642661-05:00"
@@ -1031,6 +1039,10 @@
10311039
"StatusCode": 206,
10321040
"LastSeen": "2024-11-06T12:08:17.225307-05:00"
10331041
},
1042+
"https://www.docsy.dev/docs/adding-content/navigation/#breadcrumb-navigation": {
1043+
"StatusCode": 206,
1044+
"LastSeen": "2025-01-08T13:26:58.452656-05:00"
1045+
},
10341046
"https://www.docsy.dev/docs/adding-content/navigation/#section-menu-options": {
10351047
"StatusCode": 206,
10361048
"LastSeen": "2024-11-06T12:04:02.230446-05:00"

0 commit comments

Comments
 (0)