Add breadcrumbs at the top of each content page. (#3093)

This commit is contained in:
Martin Taillefer 2019-01-16 09:46:52 -08:00 committed by GitHub
parent ce248839cd
commit 4b22211317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 72 additions and 59 deletions

View File

@ -1,5 +1,5 @@
---
title: Istio Blog Posts
title: Istio Blog
description: Posts about using Istio.
linktitle: Blog
sidebar_multicard: true

View File

@ -1,42 +1,5 @@
{{ define "main" }}
{{ .Scratch.Set "skipSeeAlso" true }}
{{ partial "section-index.html" . }}
{{ partial "primary-top.html" . }}
<p>{{ .Description }}</p>
<div class="section-index">
<div class="row">
{{ $pages := (where .Site.Pages "Section" .Section).ByWeight }}
{{ $parent := .Page }}
{{ if $parent.Params.simple_list }}
<ul>
{{ range $pages }}
{{ if eq .Parent $parent }}
<li><a href="{{ .Permalink }}">{{- .Title -}}</a></li>
{{ end }}
{{ end }}
</ul>
{{ else }}
{{ range $pages }}
{{ if eq .Parent $parent }}
<div class="col-xs-12 col-sm-6 col-xl-4 entry">
<h5>
<a href="{{ .Permalink }}">{{- if .Params.icon -}}<i class="page_icon">
{{- partial "icon.html" .Params.icon -}}</i>{{- end -}}{{- .Title -}}</a>
</h5>
<p>{{ .Description }}</p>
</div>
{{ end }}
{{ end }}
{{ end }}
</div>
</div>
{{ .Content }}
{{ partial "primary-bottom.html" . }}
{{ end }}
{{ end }}

5
layouts/blog/list.html Normal file
View File

@ -0,0 +1,5 @@
{{ define "main" }}
{{ partial "section-index.html" . }}
{{ end }}

View File

@ -0,0 +1,23 @@
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
{{ $page := .Page }}
{{ range $index, $element := split $url "/" }}
{{ if $page }}
{{ $.Scratch.Add "urls" (slice $page.Permalink) }}
{{ $.Scratch.Add "titles" (slice $page.LinkTitle) }}
{{ $page = $page.Parent }}
{{ end }}
{{ end }}
{{ $len := len ($.Scratch.Get "titles") }}
{{ range $index, $element := $.Scratch.Get "titles" }}
{{ $i := sub (sub $len $index) 1 }}
{{ $title := index ($.Scratch.Get "titles") $i }}
{{ $url := index ($.Scratch.Get "urls") $i }}
{{ if ne $i 0 }}
<a href="{{- $url -}}">{{- $title -}}</a>
<span>/</span>
{{ else }}
{{ $title }}
{{ end }}
{{ end }}

View File

@ -28,11 +28,9 @@
{{ end }}
<main aria-labelledby="title">
{{ if not .Parent.IsHome }}
<div class="pagenav">
<p><a href="{{ .Parent.Permalink }}" title="{{ .Parent.Description }}"><svg class="icon"><use xlink:href="/img/icons.svg#level-up" /></svg>{{- .Parent.Title -}}</a></p>
</div>
{{ end }}
<div class="pagenav">
<p>{{- partial "breadcrumbs.html" . -}}</p>
</div>
<h1 id="title">
{{- if .Params.icon -}}

View File

@ -0,0 +1,38 @@
{{ .Scratch.Set "skipSeeAlso" true }}
{{ partial "primary-top.html" . }}
<p>{{ .Description }}</p>
<div class="section-index">
<div class="row">
{{ $pages := (where .Site.Pages "Section" .Section).ByWeight }}
{{ $parent := .Page }}
{{ if $parent.Params.simple_list }}
<ul>
{{ range $pages }}
{{ if eq .Parent $parent }}
<li><a href="{{ .Permalink }}">{{- .Title -}}</a></li>
{{ end }}
{{ end }}
</ul>
{{ else }}
{{ range $pages }}
{{ if eq .Parent $parent }}
<div class="col-xs-12 col-sm-6 col-xl-4 entry">
<h5>
<a href="{{ .Permalink }}">{{- if .Params.icon -}}<i class="page_icon">
{{- partial "icon.html" .Params.icon -}}</i>{{- end -}}{{- .Title -}}</a>
</h5>
<p>{{ .Description }}</p>
</div>
{{ end }}
{{ end }}
{{ end }}
</div>
</div>
{{ .Content }}
{{ partial "primary-bottom.html" . }}

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 66.569 66.569" style="enable-background:new 0 0 66.569 66.569;"
xml:space="preserve">
<path stroke-width="4px" d="M65.401,58.213H30.607c-5.796,0-10.511-4.717-10.511-10.511V10.239l16.259,16.275c0.454,0.453,1.197,0.453,1.651,0
c0.454-0.455,0.454-1.199,0-1.652L19.18,6.022L0.34,24.86c-0.454,0.453-0.454,1.196,0,1.651c0.23,0.231,0.529,0.341,0.826,0.341
c0.296,0,0.598-0.114,0.828-0.341l15.762-15.765v36.952c0,7.081,5.767,12.848,12.847,12.848h34.798
c0.644,0,1.168-0.525,1.168-1.168C66.569,58.733,66.044,58.213,65.401,58.213z"/>
</svg>

Before

Width:  |  Height:  |  Size: 705 B

View File

@ -616,11 +616,6 @@
c-6.764,6.76-6.764,17.727,0,24.485l106.768,106.775c3.381,3.383,7.812,5.072,12.242,5.072c4.43,0,8.861-1.689,12.242-5.072
c6.764-6.76,6.764-17.726,0-24.484l-77.209-77.218h323.572c9.562,0,17.316-7.753,17.316-17.315
C400.004,190.438,392.251,182.686,382.688,182.686z"/>
</symbol><symbol id="level-up" viewBox="0 0 66.569 66.569">
<path stroke-width="4px" d="M65.401,58.213H30.607c-5.796,0-10.511-4.717-10.511-10.511V10.239l16.259,16.275c0.454,0.453,1.197,0.453,1.651,0
c0.454-0.455,0.454-1.199,0-1.652L19.18,6.022L0.34,24.86c-0.454,0.453-0.454,1.196,0,1.651c0.23,0.231,0.529,0.341,0.826,0.341
c0.296,0,0.598-0.114,0.828-0.341l15.762-15.765v36.952c0,7.081,5.767,12.848,12.847,12.848h34.798
c0.644,0,1.168-0.525,1.168-1.168C66.569,58.733,66.044,58.213,65.401,58.213z"/>
</symbol><symbol id="links" viewBox="0 0 54.971 54.971">
<path d="M51.173,3.801c-5.068-5.068-13.315-5.066-18.384,0l-9.192,9.192c-0.781,0.781-0.781,2.047,0,2.828
c0.781,0.781,2.047,0.781,2.828,0l9.192-9.192c1.691-1.69,3.951-2.622,6.363-2.622c2.413,0,4.673,0.932,6.364,2.623

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB