From 27e83b1e5a9d8b7bbd42d202bd5ef57adcce659b Mon Sep 17 00:00:00 2001
From: Joseph Ting <josephting@users.noreply.github.com>
Date: Mon, 11 Mar 2019 11:21:14 +0000
Subject: [PATCH] Add see also section to posts footer (#152)
---
resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.json | 2 +-
exampleSite/config.toml | 3 +++
layouts/partials/posts/series.html | 24 ++++++++++++++++++++++++
exampleSite/content/posts/migrate-from-jekyll.md | 2 +-
exampleSite/content/posts/theme-demo.md | 2 +-
assets/scss/_content.scss | 6 ++++++
i18n/pt-br.toml | 3 +++
exampleSite/content/posts/external-post.md | 1 +
layouts/posts/single.html | 1 +
i18n/en.toml | 3 +++
exampleSite/content/posts/hugoisforlovers.md | 2 +-
exampleSite/content/posts/creating-a-new-theme.md | 1 +
exampleSite/content/posts/goisforlovers.md | 2 +-
resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.content | 2 +-
14 files changed, 48 insertions(+), 6 deletions(-)
diff --git a/assets/scss/_content.scss b/assets/scss/_content.scss
index 64f83cf..33193ed 100644
--- a/assets/scss/_content.scss
+++ b/assets/scss/_content.scss
@@ -19,6 +19,12 @@
}
footer {
margin-top: 4.0rem;
+ .see-also {
+ margin: 3.2rem 0;
+ h3 {
+ margin: 3.2rem 0;
+ }
+ }
}
}
.post {
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 63870a2..59bd66e 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -36,6 +36,9 @@
# Use inverted colors
inverted = false
+ # Series see also post count
+ maxSeeAlsoItems = 5
+
# Custom CSS
custom_css = []
diff --git a/exampleSite/content/posts/creating-a-new-theme.md b/exampleSite/content/posts/creating-a-new-theme.md
index acac87e..dbf15d5 100644
--- a/exampleSite/content/posts/creating-a-new-theme.md
+++ b/exampleSite/content/posts/creating-a-new-theme.md
@@ -4,6 +4,7 @@
slug = "creating-a-new-theme"
tags = []
categories = []
+series = ["Theme", "Hugo"]
+++
## Introduction
diff --git a/exampleSite/content/posts/external-post.md b/exampleSite/content/posts/external-post.md
index 3e68871..695d4bf 100644
--- a/exampleSite/content/posts/external-post.md
+++ b/exampleSite/content/posts/external-post.md
@@ -11,4 +11,5 @@
"Development",
]
externalLink = "https://github.com/luizdepra/hugo-coder/wiki"
+series = ["Hugo"]
+++
diff --git a/exampleSite/content/posts/goisforlovers.md b/exampleSite/content/posts/goisforlovers.md
index a06ea5f..c850d5c 100644
--- a/exampleSite/content/posts/goisforlovers.md
+++ b/exampleSite/content/posts/goisforlovers.md
@@ -13,7 +13,7 @@
"Development",
"golang",
]
-series = ["Getting Started"]
+series = ["Getting Started", "Hugo"]
+++
Hugo uses the excellent [go][] [html/template][gohtmltemplate] library for
diff --git a/exampleSite/content/posts/hugoisforlovers.md b/exampleSite/content/posts/hugoisforlovers.md
index 39de754..ecb53ad 100644
--- a/exampleSite/content/posts/hugoisforlovers.md
+++ b/exampleSite/content/posts/hugoisforlovers.md
@@ -11,7 +11,7 @@
"Development",
"golang",
]
-series = ["Getting Started"]
+series = ["Getting Started", "Hugo"]
+++
## Step 1. Install Hugo
diff --git a/exampleSite/content/posts/migrate-from-jekyll.md b/exampleSite/content/posts/migrate-from-jekyll.md
index a2a4196..7c5bfe8 100644
--- a/exampleSite/content/posts/migrate-from-jekyll.md
+++ b/exampleSite/content/posts/migrate-from-jekyll.md
@@ -2,7 +2,7 @@
date = "2014-03-10"
title = "Migrate to Hugo from Jekyll"
description = "The post explains how to migrate from from Jekyll to Hugo."
-series = ["Getting Started"]
+series = ["Getting Started", "Hugo"]
+++
Table of Contents
diff --git a/exampleSite/content/posts/theme-demo.md b/exampleSite/content/posts/theme-demo.md
index 135fb05..be97705 100644
--- a/exampleSite/content/posts/theme-demo.md
+++ b/exampleSite/content/posts/theme-demo.md
@@ -4,7 +4,7 @@
description = "The post demonstrates features of the coder theme."
images = ["/images/N90.jpg"]
math = "true"
-
+series = ["Theme", "Hugo"]
+++
## Style Demo
diff --git a/i18n/en.toml b/i18n/en.toml
index 0aa2010..3fb1b81 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -4,6 +4,9 @@
[tag]
other = "tag"
+[series]
+other = "series"
+
[reading_time]
one = "One minute read"
other = "{{ .Count }} minutes read"
diff --git a/i18n/pt-br.toml b/i18n/pt-br.toml
index 1ab305f..679a6a6 100644
--- a/i18n/pt-br.toml
+++ b/i18n/pt-br.toml
@@ -4,6 +4,9 @@
[tag]
other = "tag"
+[series]
+other = "séries"
+
[reading_time]
one = "Um minuto de leitura"
other = "{{ .Count }} minutos de leitura"
diff --git a/layouts/partials/posts/series.html b/layouts/partials/posts/series.html
new file mode 100644
index 0000000..3bdb9e6
--- /dev/null
+++ b/layouts/partials/posts/series.html
@@ -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 }}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index 2e8bdf5..a7be870 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -31,6 +31,7 @@
</div>
<footer>
+ {{ partial "posts/series" . }}
{{ partial "posts/disqus" . }}
</footer>
</article>
diff --git a/resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.content b/resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.content
index ceb413f..7e5b365 100644
--- a/resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.content
+++ b/resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.content
@@ -1 +1 @@
-*,*:after,*:before{box-sizing:inherit}html{box-sizing:border-box;font-size:62.5%}body{color:#212121;background-color:#fafafa;font-family:Merriweather,Georgia,serif;font-size:1.6em;font-weight:300;line-height:1.8em}@media only screen and (max-width:768px){body{font-size:1.6em;line-height:1.6em}}a{font-weight:300;color:#1565c0;text-decoration:none}a:focus,a:hover{text-decoration:underline}p{margin:2rem 0}h1,h2,h3,h4,h5,h6{font-family:Lato,Helvetica,sans-serif;font-weight:700;color:#000;margin:6.4rem 0 3.2rem}h1{font-size:3.2rem;line-height:3.6rem}@media only screen and (max-width:768px){h1{font-size:3rem;line-height:3.4rem}}h2{font-size:2.8rem;line-height:3.2rem}@media only screen and (max-width:768px){h2{font-size:2.6rem;line-height:3rem}}h3{font-size:2.4rem;line-height:2.8rem}@media only screen and (max-width:768px){h3{font-size:2.2rem;line-height:2.6rem}}h4{font-size:2.2rem;line-height:2.6rem}@media only screen and (max-width:768px){h4{font-size:2rem;line-height:2.4rem}}h5{font-size:2rem;line-height:2.4rem}@media only screen and (max-width:768px){h5{font-size:1.8rem;line-height:2.2rem}}h6{font-size:1.8rem;line-height:2.2rem}@media only screen and (max-width:768px){h6{font-size:1.6rem;line-height:2rem}}b,strong{font-weight:700}pre{display:block;font-family:source code pro,lucida console,monospace;font-size:1.6rem;font-weight:400;line-height:2.6rem;margin:2rem 0;padding:2rem;overflow-x:auto}pre code{display:inline-block;background-color:inherit;color:inherit}code{font-family:source code pro,lucida console,monospace;font-size:1.6rem;font-weight:400;background-color:#e0e0e0;color:#212121;padding:.2rem .4rem}blockquote{border-left:2px solid #e0e0e0;padding-left:2rem;line-height:2.2rem;font-weight:400;font-style:italic}th,td{padding:1.6rem}table{border-collapse:collapse}table td,table th{border:2px solid #000}table tr:first-child th{border-top:0}table tr:last-child td{border-bottom:0}table tr td:first-child,table tr th:first-child{border-left:0}table tr td:last-child,table tr th:last-child{border-right:0}img{max-width:100%}.wrapper{display:flex;flex-direction:column;min-height:100vh;width:100%}.container{margin:0 auto;max-width:90rem;width:100%;padding-left:2rem;padding-right:2rem}.fab{font-weight:400}.fas{font-weight:700}.float-right{float:right}.float-left{float:left}.fab{font-weight:400}.fas{font-weight:900}.content{flex:1;display:flex;margin-top:1.6rem;margin-bottom:3.2rem}.content article header{margin-top:6.4rem;margin-bottom:3.2rem}.content article header h1{font-size:4.2rem;line-height:4.6rem;margin:0}@media only screen and (max-width:768px){.content article header h1{font-size:4rem;line-height:4.4rem}}.content article footer{margin-top:4rem}.content .post .post-title{margin-bottom:.75em}.content .post .post-meta i{text-align:center;width:1.6rem;margin-left:0;margin-right:.5rem}.content .post .post-meta .date .posted-on{margin-left:0;margin-right:1.5rem}.content figure{margin:0;padding:0}.content figcaption p{text-align:center;font-style:italic;font-size:1.6rem;margin:0}.avatar img{width:20rem;height:auto;border-radius:50%}@media only screen and (max-width:768px){.avatar img{width:10rem}}.list ul{margin:3.2rem 0;list-style:none;padding:0}.list ul li{font-size:1.8rem}@media only screen and (max-width:768px){.list ul li{margin:1.6rem 0}}.list ul li .date{display:inline-block;width:20rem;text-align:right;margin-right:3rem}@media only screen and (max-width:768px){.list ul li .date{display:block;text-align:left}}.list ul li .title{font-size:1.8rem;color:#212121;font-family:Lato,Helvetica,sans-serif;font-weight:700}.list ul li .title:hover,.list ul li .title:focus{color:#1565c0}.centered{display:flex;align-items:center;justify-content:center}.centered .about{text-align:center}.centered .about h1{margin-top:2rem;margin-bottom:.5rem}.centered .about h2{margin-top:1rem;margin-bottom:.5rem;font-size:2.4rem}@media only screen and (max-width:768px){.centered .about h2{font-size:2rem}}.centered .about ul{list-style:none;margin:3rem 0 1rem;padding:0}.centered .about ul li{display:inline-block;position:relative}.centered .about ul li a{color:#212121;text-transform:uppercase;margin-left:1rem;margin-right:1rem;font-size:1.6rem}.centered .about ul li a:hover,.centered .about ul li a:focus{color:#1565c0}@media only screen and (max-width:768px){.centered .about ul li a{font-size:1.4rem}}.centered .about ul li a i{font-size:3.2rem}.centered .error{text-align:center}.centered .error h1{margin-top:2rem;margin-bottom:.5rem;font-size:4.6rem}@media only screen and (max-width:768px){.centered .error h1{font-size:3.2rem}}.centered .error h2{margin-top:2rem;margin-bottom:3.2rem;font-size:3.2rem}@media only screen and (max-width:768px){.centered .error h2{font-size:2.8rem}}.navigation{height:6rem;width:100%}.navigation a,.navigation span{display:inline;font-size:1.6rem;font-family:Lato,Helvetica,sans-serif;font-weight:700;line-height:6rem;color:#212121}.navigation a:hover,.navigation a:focus{color:#1565c0}.navigation .navigation-title{letter-spacing:.1rem;text-transform:uppercase}.navigation .navigation-list{float:right;list-style:none;margin-bottom:0;margin-top:0}@media only screen and (max-width:768px){.navigation .navigation-list{position:absolute;top:6rem;right:0;z-index:5;visibility:hidden;opacity:0;padding:0;max-height:0;width:100%;background-color:#fafafa;border-top:solid 2px #e0e0e0;border-bottom:solid 2px #e0e0e0;transition:opacity .25s,max-height .15s linear}}.navigation .navigation-list .navigation-item{float:left;margin:0;position:relative}@media only screen and (max-width:768px){.navigation .navigation-list .navigation-item{float:none!important;text-align:center}.navigation .navigation-list .navigation-item a,.navigation .navigation-list .navigation-item span{line-height:5rem}}.navigation .navigation-list .navigation-item a,.navigation .navigation-list .navigation-item span{margin-left:1rem;margin-right:1rem}@media only screen and (max-width:768px){.navigation .navigation-list .menu-separator{border-top:2px solid #212121;margin:0 8rem}.navigation .navigation-list .menu-separator span{display:none}}.navigation #menu-toggle{display:none}@media only screen and (max-width:768px){.navigation #menu-toggle:checked+label{color:#e0e0e0}.navigation #menu-toggle:checked+label+ul{visibility:visible;opacity:1;max-height:100rem}}.navigation .menu-button{display:none}@media only screen and (max-width:768px){.navigation .menu-button{display:block;font-size:2.4rem;font-weight:400;line-height:6rem;color:#212121;cursor:pointer}.navigation .menu-button:hover,.navigation .menu-button:focus{color:#1565c0}}.pagination{margin-top:6rem;text-align:center;font-family:Lato,Helvetica,sans-serif}.pagination li{display:inline;text-align:center;font-weight:700}.pagination li span{margin:0;text-align:center;width:3.2rem}.pagination li a{font-weight:300}.pagination li a span{margin:0;text-align:center;width:3.2rem}.footer{width:100%;text-align:center;line-height:2rem;margin-bottom:1rem}.footer a{color:#1565c0}
\ No newline at end of file
+*,*:after,*:before{box-sizing:inherit}html{box-sizing:border-box;font-size:62.5%}body{color:#212121;background-color:#fafafa;font-family:Merriweather,Georgia,serif;font-size:1.6em;font-weight:300;line-height:1.8em}@media only screen and (max-width:768px){body{font-size:1.6em;line-height:1.6em}}a{font-weight:300;color:#1565c0;text-decoration:none}a:focus,a:hover{text-decoration:underline}p{margin:2rem 0}h1,h2,h3,h4,h5,h6{font-family:Lato,Helvetica,sans-serif;font-weight:700;color:#000;margin:6.4rem 0 3.2rem}h1{font-size:3.2rem;line-height:3.6rem}@media only screen and (max-width:768px){h1{font-size:3rem;line-height:3.4rem}}h2{font-size:2.8rem;line-height:3.2rem}@media only screen and (max-width:768px){h2{font-size:2.6rem;line-height:3rem}}h3{font-size:2.4rem;line-height:2.8rem}@media only screen and (max-width:768px){h3{font-size:2.2rem;line-height:2.6rem}}h4{font-size:2.2rem;line-height:2.6rem}@media only screen and (max-width:768px){h4{font-size:2rem;line-height:2.4rem}}h5{font-size:2rem;line-height:2.4rem}@media only screen and (max-width:768px){h5{font-size:1.8rem;line-height:2.2rem}}h6{font-size:1.8rem;line-height:2.2rem}@media only screen and (max-width:768px){h6{font-size:1.6rem;line-height:2rem}}b,strong{font-weight:700}pre{display:block;font-family:source code pro,lucida console,monospace;font-size:1.6rem;font-weight:400;line-height:2.6rem;margin:2rem 0;padding:2rem;overflow-x:auto}pre code{display:inline-block;background-color:inherit;color:inherit}code{font-family:source code pro,lucida console,monospace;font-size:1.6rem;font-weight:400;background-color:#e0e0e0;color:#212121;padding:.2rem .4rem}blockquote{border-left:2px solid #e0e0e0;padding-left:2rem;line-height:2.2rem;font-weight:400;font-style:italic}th,td{padding:1.6rem}table{border-collapse:collapse}table td,table th{border:2px solid #000}table tr:first-child th{border-top:0}table tr:last-child td{border-bottom:0}table tr td:first-child,table tr th:first-child{border-left:0}table tr td:last-child,table tr th:last-child{border-right:0}img{max-width:100%}.wrapper{display:flex;flex-direction:column;min-height:100vh;width:100%}.container{margin:0 auto;max-width:90rem;width:100%;padding-left:2rem;padding-right:2rem}.fab{font-weight:400}.fas{font-weight:700}.float-right{float:right}.float-left{float:left}.fab{font-weight:400}.fas{font-weight:900}.content{flex:1;display:flex;margin-top:1.6rem;margin-bottom:3.2rem}.content article header{margin-top:6.4rem;margin-bottom:3.2rem}.content article header h1{font-size:4.2rem;line-height:4.6rem;margin:0}@media only screen and (max-width:768px){.content article header h1{font-size:4rem;line-height:4.4rem}}.content article footer{margin-top:4rem}.content article footer .see-also{margin:3.2rem 0}.content article footer .see-also h3{margin:3.2rem 0}.content .post .post-title{margin-bottom:.75em}.content .post .post-meta i{text-align:center;width:1.6rem;margin-left:0;margin-right:.5rem}.content .post .post-meta .date .posted-on{margin-left:0;margin-right:1.5rem}.content figure{margin:0;padding:0}.content figcaption p{text-align:center;font-style:italic;font-size:1.6rem;margin:0}.avatar img{width:20rem;height:auto;border-radius:50%}@media only screen and (max-width:768px){.avatar img{width:10rem}}.list ul{margin:3.2rem 0;list-style:none;padding:0}.list ul li{font-size:1.8rem}@media only screen and (max-width:768px){.list ul li{margin:1.6rem 0}}.list ul li .date{display:inline-block;width:20rem;text-align:right;margin-right:3rem}@media only screen and (max-width:768px){.list ul li .date{display:block;text-align:left}}.list ul li .title{font-size:1.8rem;color:#212121;font-family:Lato,Helvetica,sans-serif;font-weight:700}.list ul li .title:hover,.list ul li .title:focus{color:#1565c0}.centered{display:flex;align-items:center;justify-content:center}.centered .about{text-align:center}.centered .about h1{margin-top:2rem;margin-bottom:.5rem}.centered .about h2{margin-top:1rem;margin-bottom:.5rem;font-size:2.4rem}@media only screen and (max-width:768px){.centered .about h2{font-size:2rem}}.centered .about ul{list-style:none;margin:3rem 0 1rem;padding:0}.centered .about ul li{display:inline-block;position:relative}.centered .about ul li a{color:#212121;text-transform:uppercase;margin-left:1rem;margin-right:1rem;font-size:1.6rem}.centered .about ul li a:hover,.centered .about ul li a:focus{color:#1565c0}@media only screen and (max-width:768px){.centered .about ul li a{font-size:1.4rem}}.centered .about ul li a i{font-size:3.2rem}.centered .error{text-align:center}.centered .error h1{margin-top:2rem;margin-bottom:.5rem;font-size:4.6rem}@media only screen and (max-width:768px){.centered .error h1{font-size:3.2rem}}.centered .error h2{margin-top:2rem;margin-bottom:3.2rem;font-size:3.2rem}@media only screen and (max-width:768px){.centered .error h2{font-size:2.8rem}}.navigation{height:6rem;width:100%}.navigation a,.navigation span{display:inline;font-size:1.6rem;font-family:Lato,Helvetica,sans-serif;font-weight:700;line-height:6rem;color:#212121}.navigation a:hover,.navigation a:focus{color:#1565c0}.navigation .navigation-title{letter-spacing:.1rem;text-transform:uppercase}.navigation .navigation-list{float:right;list-style:none;margin-bottom:0;margin-top:0}@media only screen and (max-width:768px){.navigation .navigation-list{position:absolute;top:6rem;right:0;z-index:5;visibility:hidden;opacity:0;padding:0;max-height:0;width:100%;background-color:#fafafa;border-top:solid 2px #e0e0e0;border-bottom:solid 2px #e0e0e0;transition:opacity .25s,max-height .15s linear}}.navigation .navigation-list .navigation-item{float:left;margin:0;position:relative}@media only screen and (max-width:768px){.navigation .navigation-list .navigation-item{float:none!important;text-align:center}.navigation .navigation-list .navigation-item a,.navigation .navigation-list .navigation-item span{line-height:5rem}}.navigation .navigation-list .navigation-item a,.navigation .navigation-list .navigation-item span{margin-left:1rem;margin-right:1rem}@media only screen and (max-width:768px){.navigation .navigation-list .menu-separator{border-top:2px solid #212121;margin:0 8rem}.navigation .navigation-list .menu-separator span{display:none}}.navigation #menu-toggle{display:none}@media only screen and (max-width:768px){.navigation #menu-toggle:checked+label{color:#e0e0e0}.navigation #menu-toggle:checked+label+ul{visibility:visible;opacity:1;max-height:100rem}}.navigation .menu-button{display:none}@media only screen and (max-width:768px){.navigation .menu-button{display:block;font-size:2.4rem;font-weight:400;line-height:6rem;color:#212121;cursor:pointer}.navigation .menu-button:hover,.navigation .menu-button:focus{color:#1565c0}}.pagination{margin-top:6rem;text-align:center;font-family:Lato,Helvetica,sans-serif}.pagination li{display:inline;text-align:center;font-weight:700}.pagination li span{margin:0;text-align:center;width:3.2rem}.pagination li a{font-weight:300}.pagination li a span{margin:0;text-align:center;width:3.2rem}.footer{width:100%;text-align:center;line-height:2rem;margin-bottom:1rem}.footer a{color:#1565c0}
\ No newline at end of file
diff --git a/resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.json b/resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.json
index 9cb8536..d7d7ca6 100644
--- a/resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.json
+++ b/resources/_gen/assets/scss/scss/coder.scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.json
@@ -1 +1 @@
-{"Target":"css/coder.min.8881182b3ec36ffd9c735306f7e16ce9b1129ebc650e069e7c4114827e9d9b23.css","MediaType":"text/css","Data":{"Integrity":"sha256-iIEYKz7Db/2cc1MG9+Fs6bESnrxlDgaefEEUgn6dmyM="}}
\ No newline at end of file
+{"Target":"css/coder.min.28d751104f30c16da1aa1bb04015cbe662cacfe0d1b01af4f2240ad58580069c.css","MediaType":"text/css","Data":{"Integrity":"sha256-KNdREE8wwW2hqhuwQBXL5mLKz+DRsBr08iQK1YWABpw="}}
\ No newline at end of file
--
Gitblit v1.10.0