Add see also section to posts footer (#152)

* Fix series list page title

* Add see also section to posts footer
This commit is contained in:
Joseph Ting 2019-03-11 20:21:14 +09:00 committed by Luiz F. A. de Prá
parent da6f9e1389
commit 27e83b1e5a
14 changed files with 48 additions and 6 deletions

View File

@ -19,6 +19,12 @@
} }
footer { footer {
margin-top: 4.0rem; margin-top: 4.0rem;
.see-also {
margin: 3.2rem 0;
h3 {
margin: 3.2rem 0;
}
}
} }
} }
.post { .post {

View File

@ -36,6 +36,9 @@ disqusShortname = "yourdiscussshortname"
# Use inverted colors # Use inverted colors
inverted = false inverted = false
# Series see also post count
maxSeeAlsoItems = 5
# Custom CSS # Custom CSS
custom_css = [] custom_css = []

View File

@ -4,6 +4,7 @@ title = "Creating a New Theme"
slug = "creating-a-new-theme" slug = "creating-a-new-theme"
tags = [] tags = []
categories = [] categories = []
series = ["Theme", "Hugo"]
+++ +++
## Introduction ## Introduction

View File

@ -11,4 +11,5 @@ categories = [
"Development", "Development",
] ]
externalLink = "https://github.com/luizdepra/hugo-coder/wiki" externalLink = "https://github.com/luizdepra/hugo-coder/wiki"
series = ["Hugo"]
+++ +++

View File

@ -13,7 +13,7 @@ categories = [
"Development", "Development",
"golang", "golang",
] ]
series = ["Getting Started"] series = ["Getting Started", "Hugo"]
+++ +++
Hugo uses the excellent [go][] [html/template][gohtmltemplate] library for Hugo uses the excellent [go][] [html/template][gohtmltemplate] library for

View File

@ -11,7 +11,7 @@ categories = [
"Development", "Development",
"golang", "golang",
] ]
series = ["Getting Started"] series = ["Getting Started", "Hugo"]
+++ +++
## Step 1. Install Hugo ## Step 1. Install Hugo

View File

@ -2,7 +2,7 @@
date = "2014-03-10" date = "2014-03-10"
title = "Migrate to Hugo from Jekyll" title = "Migrate to Hugo from Jekyll"
description = "The post explains how to migrate from from Jekyll to Hugo." description = "The post explains how to migrate from from Jekyll to Hugo."
series = ["Getting Started"] series = ["Getting Started", "Hugo"]
+++ +++
Table of Contents Table of Contents

View File

@ -4,7 +4,7 @@ title = "Theme Demo"
description = "The post demonstrates features of the coder theme." description = "The post demonstrates features of the coder theme."
images = ["/images/N90.jpg"] images = ["/images/N90.jpg"]
math = "true" math = "true"
series = ["Theme", "Hugo"]
+++ +++
## Style Demo ## Style Demo

View File

@ -4,6 +4,9 @@ other = "category"
[tag] [tag]
other = "tag" other = "tag"
[series]
other = "series"
[reading_time] [reading_time]
one = "One minute read" one = "One minute read"
other = "{{ .Count }} minutes read" other = "{{ .Count }} minutes read"

View File

@ -4,6 +4,9 @@ other = "categoria"
[tag] [tag]
other = "tag" other = "tag"
[series]
other = "séries"
[reading_time] [reading_time]
one = "Um minuto de leitura" one = "Um minuto de leitura"
other = "{{ .Count }} minutos de leitura" other = "{{ .Count }} minutos de leitura"

View File

@ -0,0 +1,24 @@
{{ $currentPageUrl := .URL }}
{{ if .Params.series }}
<section class="see-also">
{{ range .Params.series }}
<h3>See also in {{ . }}</h3>
{{ $name := . | urlize }}
{{ $series := index $.Site.Taxonomies.series $name }}
{{ if gt (len $series.Pages) 0 }}
<nav>
<ul>
{{ $maxItems := $.Site.Params.maxSeeAlsoItems | default 5 }}
{{ range first (add $maxItems 1) $series.Pages }}
{{ if ne .URL $currentPageUrl }}
<li>
<a href="{{ .Params.ExternalLink | default .URL }}">{{ .Title }}</a>
</li>
{{ end }}
{{ end }}
</ul>
</nav>
{{ end }}
{{ end }}
</section>
{{ end }}

View File

@ -31,6 +31,7 @@
</div> </div>
<footer> <footer>
{{ partial "posts/series" . }}
{{ partial "posts/disqus" . }} {{ partial "posts/disqus" . }}
</footer> </footer>
</article> </article>

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"Target":"css/coder.min.8881182b3ec36ffd9c735306f7e16ce9b1129ebc650e069e7c4114827e9d9b23.css","MediaType":"text/css","Data":{"Integrity":"sha256-iIEYKz7Db/2cc1MG9+Fs6bESnrxlDgaefEEUgn6dmyM="}} {"Target":"css/coder.min.28d751104f30c16da1aa1bb04015cbe662cacfe0d1b01af4f2240ad58580069c.css","MediaType":"text/css","Data":{"Integrity":"sha256-KNdREE8wwW2hqhuwQBXL5mLKz+DRsBr08iQK1YWABpw="}}