mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-22 03:19:25 +00:00
#66, add taxonomy support
This commit is contained in:
parent
f5a52e6ed1
commit
d6290dcf50
@ -153,7 +153,7 @@ ul.pagination {
|
||||
}
|
||||
|
||||
.book-post {
|
||||
margin-bottom: $padding-16 * 2;
|
||||
margin-bottom: $padding-16 * 3;
|
||||
}
|
||||
|
||||
.book-header {
|
||||
@ -235,7 +235,6 @@ ul.pagination {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.book-languages {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
|
@ -3,7 +3,6 @@
|
||||
baseURL = 'https://example.com/'
|
||||
title = 'Hugo Book'
|
||||
theme = 'hugo-book'
|
||||
disableKinds = ['taxonomy', 'taxonomyTerm']
|
||||
|
||||
# Book configuration
|
||||
disablePathToLower = true
|
||||
|
@ -3,7 +3,6 @@
|
||||
baseURL: https://example.com/
|
||||
title: Hugo Book
|
||||
theme: hugo-book
|
||||
disableKinds: ["taxonomy", "taxonomyTerm"]
|
||||
|
||||
# Book configuration
|
||||
disablePathToLower: true
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"Target":"book.min.8ee891d8dd34fb8b09309d336809d47b0da3d2b94b945845deb52a04253304a4.css","MediaType":"text/css","Data":{"Integrity":"sha256-juiR2N00+4sJMJ0zaAnUew2j0rlLlFhF3rUqBCUzBKQ="}}
|
||||
{"Target":"book.min.68d45956421753cdf6bcfc865ede445c56afc5bcaaebfe02961f44fe77d8f45a.css","MediaType":"text/css","Data":{"Integrity":"sha256-aNRZVkIXU832vPyGXt5EXFavxbyq6/4Clh9E/nfY9Fo="}}
|
18
layouts/partials/docs/post-meta.html
Normal file
18
layouts/partials/docs/post-meta.html
Normal file
@ -0,0 +1,18 @@
|
||||
{{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }}
|
||||
{{ if or .Date .Params.tags }}
|
||||
<div>
|
||||
{{ with .Date}}
|
||||
<h5>{{ .Format $dateFormat }}</h5>
|
||||
{{ end }}
|
||||
|
||||
{{ range $term, $_ := .Site.Taxonomies }}
|
||||
{{ with $list := index $.Params $term }}
|
||||
{{ range $n, $single := $list }}{{ if $n }}, {{ end -}}
|
||||
<a href="/{{$term}}/{{$single}}/">{{ $single }}</a>
|
||||
{{- end }}
|
||||
<br />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
{{ end }}
|
20
layouts/partials/docs/taxonomy.html
Normal file
20
layouts/partials/docs/taxonomy.html
Normal file
@ -0,0 +1,20 @@
|
||||
<aside class="book-toc fixed">
|
||||
<nav>
|
||||
<ul>
|
||||
{{ range $term, $_ := .Site.Taxonomies }}
|
||||
{{ with $.Site.GetPage (printf "/%s" $term) }}
|
||||
<li class="book-section-flat">
|
||||
<strong>{{ .Title | title }}</strong>
|
||||
<ul>
|
||||
{{ range .Pages }}
|
||||
<li>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
@ -1,16 +1,11 @@
|
||||
{{ define "main" }}
|
||||
{{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }}
|
||||
{{ $paginator := .Paginate (where .Pages "Params.hidden" "ne" true) }}
|
||||
{{ range sort .Paginator.Pages }}
|
||||
<article class="markdown book-post">
|
||||
<h2>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</h2>
|
||||
{{ with .Date }}
|
||||
<h5>
|
||||
<strong>{{ .Format $dateFormat }}</strong>
|
||||
</h5>
|
||||
{{ end }}
|
||||
{{ partial "docs/post-meta" . }}
|
||||
<p>
|
||||
{{- .Summary -}}
|
||||
{{ if .Truncated }}
|
||||
@ -19,9 +14,10 @@
|
||||
</p>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "toc" }}
|
||||
|
||||
{{ partial "docs/taxonomy" . }}
|
||||
{{ end }}
|
||||
|
@ -1,16 +1,13 @@
|
||||
{{ define "main" }}
|
||||
{{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }}
|
||||
<header class="markdown">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ with .Date }}
|
||||
<h5>
|
||||
<strong>{{ .Format $dateFormat }}</strong>
|
||||
</h5>
|
||||
{{ end }}
|
||||
</header>
|
||||
<article class="markdown">
|
||||
<article class="markdown">
|
||||
<h1>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</h1>
|
||||
{{ partial "docs/post-meta" . }}
|
||||
<p>
|
||||
{{- .Content -}}
|
||||
</article>
|
||||
</p>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ define "toc" }}
|
||||
|
@ -0,0 +1,13 @@
|
||||
{{ define "main" }}
|
||||
<article class="markdown">
|
||||
<h1>{{ .Title | title }}</h1>
|
||||
{{ $taxonomies := index .Site.Taxonomies .Page.Type }}
|
||||
{{ range $taxonomies }}
|
||||
<div><a href="{{ .Page.Permalink }}">{{ .Page.Title }} <sup>{{ .Count }}</sup></a></div>
|
||||
{{ end }}
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ define "toc" }}
|
||||
{{ partial "docs/taxonomy" . }}
|
||||
{{ end }}
|
@ -0,0 +1,22 @@
|
||||
{{ define "main" }}
|
||||
{{ $paginator := .Paginate (where .Pages "Params.hidden" "ne" true) }}
|
||||
{{ range sort .Paginator.Pages }}
|
||||
<article class="markdown book-post">
|
||||
<h2>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</h2>
|
||||
{{ partial "docs/post-meta" . }}
|
||||
<p>
|
||||
{{- .Summary -}}
|
||||
{{ if .Truncated }}
|
||||
<a href="{{ .RelPermalink }}">...</a>
|
||||
{{ end }}
|
||||
</p>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "toc" }}
|
||||
{{ partial "docs/taxonomy" . }}
|
||||
{{ end }}
|
Loading…
Reference in New Issue
Block a user