Skip to content

Commit f217444

Browse files
stefanvjarrodmillman
authored andcommitted
Add breadcrumbs
1 parent 255e3a3 commit f217444

4 files changed

Lines changed: 50 additions & 1 deletion

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Breadcrumbs for parent pages meant for the article header
3+
*/
4+
ul.bd-breadcrumbs {
5+
list-style: none;
6+
padding-left: 0;
7+
display: flex;
8+
flex-wrap: wrap;
9+
10+
// Font size slightly smaller to avoid cluttering up space too much
11+
font-size: 0.8rem;
12+
13+
li.breadcrumb-item {
14+
display: flex;
15+
align-items: baseline;
16+
17+
// Style should look like heavier in-page links
18+
// keeping visited in the default link colour
19+
font-weight: bold;
20+
a {
21+
@include link-style-text;
22+
}
23+
24+
// Items that aren't the home have a caret to the left
25+
&:not(.breadcrumb-home):before {
26+
font: var(--fa-font-solid);
27+
font-size: 0.8rem;
28+
content: var(--pst-breadcrumb-divider);
29+
color: var(--pst-color-text-muted);
30+
padding: 0 0.5rem;
31+
}
32+
}
33+
}

assets/theme-css/pst/pydata-sphinx-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
//@import "./sections/sidebar-toggle";
3434
//
3535
//// Re-usable components across the theme
36-
//@import "./components/breadcrumbs";
36+
@import "./components/breadcrumbs";
3737
//@import "./components/icon-links";
3838
//@import "./components/header/header-logo";
3939
//@import "./components/navbar-links";

assets/theme-css/styles.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,9 @@ a.headerlink {
382382
/* Local Variables: */
383383
/* css-indent-offset: 2 */
384384
/* End: */
385+
386+
#breadcrumbs {
387+
margin: 0;
388+
padding: 0;
389+
padding-bottom: 1rem;
390+
}

layouts/partials/single/content.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
<section class="content-padding flex-row">
22
<div class="content-container">
3+
<ul id="breadcrumbs" class="bd-breadcrumbs">
4+
{{- range $index, $ := .Ancestors.Reverse }}
5+
{{ if $index }}
6+
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
7+
{{ else }}
8+
<li class="breadcrumb-item breadcrumb-home"><a href="{{ .RelPermalink }}"><i class="fas fa-home"></i></a></li>
9+
{{ end }}
10+
{{- end }}
11+
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
12+
</ul>
313
<div class="columns">
414
<div class="column is-centered-tablet-portrait">
515
<h1>{{ .Title }}</h1>

0 commit comments

Comments
 (0)