layout: improve taxonomies pages

* NEW Adds a templates for categories and tags lists.
* NEW Styles (not so well…) the categories and tags lists.
* BETTER Improves includes in the _default templates.

Co-Authored-by: Igor Milhit <igor@milhit.ch>
pull/31/head
iGor milhit 2019-09-01 08:32:49 +02:00
parent 09fbaa06f9
commit b5dc64935a
Signed by: igor
GPG Key ID: 692D97C3D0228A99
6 changed files with 59 additions and 33 deletions

View File

@ -3,7 +3,9 @@
{{- partial "head.html" . -}} {{- partial "head.html" . -}}
<body> <body>
{{- partial "header.html" . -}} {{- partial "header.html" . -}}
{{- block "main" . }}{{- end }} <main class="container">
{{- block "main" . }}{{- end }}
</main>
{{- partial "footer.html" . -}} {{- partial "footer.html" . -}}
</body> </body>
</html> </html>

View File

@ -1,18 +1,18 @@
{{ define "main" }} {{ define "main" }}
<main class="container"> <header>
<header> <h1>{{.Title}}</h1>
<h1>{{.Title}}</h1> </header>
</header> <!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md --> {{.Content}}
{{.Content}} <article>
<article> <!-- Ranges through content/posts/*.md -->
<!-- Ranges through content/posts/*.md -->
{{ range .Pages }} {{ range .Pages }}
<article> <article>
<a href="{{.Permalink}}">{{.Title}}</a> <a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> &mdash;
&mdash; {{.PublishDate.Format "2006-01-02"}} {{ if isset .Params "publishdate" }}
</article> {{.PublishDate.Format "2006-01-02"}}
{{ end }}
</article>
{{ end }} {{ end }}
</article> </article>
</main>
{{ end }} {{ end }}

View File

@ -1,20 +1,22 @@
{{ define "main" }} {{ define "main" }}
<main class="container"> <header>
{{ .Content }} <h1>{{.Title}}</h1>
{{ range .Paginator.Pages }} </header>
<article> <!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
<a href="{{ .Permalink }}"> {{.Content }}
{{.Title}} {{ range .Paginator.Pages }}
</a> <article>
&mdash; {{ .PublishDate.Format "2006-01-02" }} <a href="{{ .Permalink }}">
{{ with .Params.categories }} {{.Title}}
{{ range . }} </a>
&mdash; <a href="{{ "categories" | absURL}}/{{ . | urlize }}">{{ . }}</a> &mdash; {{ .PublishDate.Format "2006-01-02" }}
{{ end }} {{ with .Params.categories }}
{{ end }} {{ range . }}
</article> &mdash; <a href="{{ "categories" | absURL}}/{{ . | urlize }}">{{ . }}</a>
{{ end }}
{{ end }} {{ end }}
</ul> </article>
</main> {{ end }}
</ul>
{{ end }} {{ end }}

View File

@ -1,5 +1,4 @@
{{ define "main" }} {{ define "main" }}
<main id="main" class="container">
<header class="post-header"> <header class="post-header">
<h1 id="title">{{ .Title }}</h1> <h1 id="title">{{ .Title }}</h1>
{{- partial "post-info.html" . -}} {{- partial "post-info.html" . -}}
@ -7,6 +6,5 @@
<article id="content"> <article id="content">
{{ .Content }} {{ .Content }}
</article> </article>
</main>
{{ end }} {{ end }}

View File

@ -0,0 +1,15 @@
{{ define "main" }}
<header>
<h1>{{.Title}}</h1>
</header>
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
{{.Content}}
<article class="terms">
{{ range .Data.Terms.Alphabetical }}
<article class="term">
<p><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> ({{ .Count }})</p>
</article>
{{ end }}
</article>
{{ end }}

View File

@ -196,3 +196,12 @@ figure p {
text-align: center; text-align: center;
margin: .2rem 0; margin: .2rem 0;
} }
.terms {
display: flex;
flex-wrap: wrap;
}
.term {
margin-right: 1rem;
}