Skip to content

Commit 1ff7b13

Browse files
committed
Error for missing breadcrumbs (scientific-python/blog.scientific-python.org#158)
* layouts/partials/breadcrumbs.html: Log an error and fail the build if a breadcrumb is missing (i.e. if a page used in a breadcrumb has a missing "title" field in its front matter). [re-run deploy preview] This only applies to content pages which are referred to in breadcrumbs; other pages are still allowed to not have titles. See <scientific-python/blog.scientific-python.org#158>.
1 parent ac48aa5 commit 1ff7b13

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

layouts/partials/breadcrumbs.html

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<ul id="breadcrumbs" class="bd-breadcrumbs">
22
{{- range $index, $ := .Ancestors.Reverse }}
33
{{ if $index }}
4+
5+
{{ or .Title
6+
(errorf "Missing breadcrumb: Page has no \"title\" field. Filename:%q"
7+
.File.Filename) }}
8+
49
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
510
{{ else }}
611
<li class="breadcrumb-item breadcrumb-home"><a href="{{ .RelPermalink }}"><i class="fas fa-home"></i></a></li>

0 commit comments

Comments
 (0)