diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..81ab210 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + +## [2.35] - 2018-11-04 (@budparr) + +- Add global background color class to footer (it's already on the header). Fixes #135 + +## [2.34] - 2018-11-03 (@budparr) + +### Added + +- Add a changelog. + +### Changed + +- Run Ananke with Hugo v0.50 +- Remove default background image so users can choose to not use one at all. #133 (cdeguise) +- Add reading time and word count to pages, conditionally if set at global, page, or section level with the `show_reading_time` key. (thanks to @looer for starting) diff --git a/README.md b/README.md index 9a239f9..9975368 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,11 @@ For example, if your css files are `static/css/custom.css` and `static/css/custo custom_css = ["css/custom.css","css/custom2.css"] ``` +### Show Reading Time and Word Contributing + +If you add a key of `show_reading_time` true to either the Config Params, a page or section's front matter, articles will show the reading time and word count. + + ### Nearly finished In order to see your site in action, run Hugo's built-in local server. diff --git a/layouts/_default/single.html b/layouts/_default/single.html index efbeb39..4f1b1c3 100755 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,7 +4,9 @@ {{ end }} {{ define "main" }} -
+ + {{ $section := .Site.GetPage "section" .Section }} +

@@ -20,10 +22,20 @@ {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}} + + {{/* + Show "reading time" and "word count" but only if one of the following are true: + 1) A global config `params` value is set `show_reading_time = true` + 2) A section front matter value is set `show_reading_time = true` + 3) A page front matter value is set `show_reading_time = true` + */}} + {{ if (or (eq (.Param "show_reading_time") true) (eq $section.Params.show_reading_time true) )}} + - {{ .ReadingTime}} minutes read + - {{ .WordCount}} words + {{ end }}

-
+
{{- .Content -}} {{- partial "tags.html" . -}}