Better breadcrumb

This commit is contained in:
echarp 2022-11-27 21:55:49 +01:00
parent a90abc799d
commit 5264c64901
5 changed files with 21 additions and 25 deletions

View File

@ -1,5 +1,5 @@
--- ---
title: 1ere quiz title: 1er quiz
ac_create: ac_create:
- /pages/1er-quiz/start - /pages/1er-quiz/start
--- ---

View File

@ -4,21 +4,17 @@
.breadcrumb { .breadcrumb {
display: none; display: none;
}
body.author .breadcrumb {
display: initial;
}
.breadcrumb ol {
padding: 0; padding: 0;
margin-top: 0; margin-top: 0;
} }
.with-breadcrumb .breadcrumb {
display: initial;
}
.breadcrumb li { .breadcrumb li {
display: inline; display: inline;
} }
.breadcrumb li + li:before { .breadcrumb li + li:before {
content: ">"; content: ">";
padding-left: 0.3rem;
padding-right: 0.5rem;
} }
dl { dl {

View File

@ -12,9 +12,14 @@
{{ end }} {{ end }}
<div class="blah w-100{{ if $featured_image }} w-60-ns{{ end }}"> <div class="blah w-100{{ if $featured_image }} w-60-ns{{ end }}">
{{ if .IsPage }} <header>
<div class="breadcrumb">{{- partial "breadcrumb" . -}}</div> <time class="db f6 fr" datetime="{{ .Date }}">
{{ end }} {{ .Date | time.Format .Site.Params.date_format }}
</time>
<ol class="breadcrumb nav navbar-nav">
{{ partial "breadcrumb" .Parent }}
</ol>
</header>
<h1 class="f3 fw1 athelas mt0 lh-title"> <h1 class="f3 fw1 athelas mt0 lh-title">
<a href="{{.RelPermalink}}" class="color-inherit dim link"> <a href="{{.RelPermalink}}" class="color-inherit dim link">

View File

@ -1,5 +1,6 @@
{{ define "main" }} {{ define "main" }}
<section class="pa3 pa4-ns nested-copy-line-height"> <section class="pa3 pa4-ns nested-copy-line-height
{{ if (le (.RelPermalink | strings.Count "/") 3) }}with-breadcrumb{{ end }}">
<aside id="actions" class="w-30-l mt4-l fr tc"> <aside id="actions" class="w-30-l mt4-l fr tc">
{{ if .Parent.IsHome }} {{ if .Parent.IsHome }}
<button id="create" <button id="create"

View File

@ -1,15 +1,9 @@
<time class="db f6 fr" datetime="{{ .Date }}"> {{ if and .Parent.IsSection (not .Parent.IsHome) }}
{{ .Date | time.Format .Site.Params.date_format }}
</time> {{ partial "breadcrumb.html" .Parent }}
<li>
<a href="{{ .Permalink }}">{{- .Title -}}</a>
</li>
<ol class="nav navbar-nav">
{{ template "breadcrumbnav" (dict "p1" . "p2" .) }}
</ol>
{{ define "breadcrumbnav" }}
{{ if .p1.Parent }}
{{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2) }}
{{ end }}
{{ if (and .p1.IsSection (not .p1.Parent.IsHome)) }}
<li><a href="{{ .p1.Permalink }}">{{ .p1.Title }}</a></li>
{{ end }}
{{ end }} {{ end }}