From 584ddb093bd0a987d78ef01243c517e6f7aa8a49 Mon Sep 17 00:00:00 2001 From: Dionysis Grigoropoulos Date: Thu, 26 May 2016 01:05:32 +0300 Subject: Add an option to hide ReadingTime in posts --- README.md | 4 +++- layouts/partials/post_header.html | 2 +- sample-config.toml | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c96ce9d..267cc11 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Hugo-Octopress is a port of the classic [Octopress][octopress-link] theme to [Hu ![screenshot](/images/screenshot2.png) ## Configuration -This section is about parameters in the [configuration file](https://gohugo.io/overview/configuration/) and how they can be used to customize the output. A working config file `sample-config.toml`is provided and parameters are explained below: +This section is about parameters in the [configuration file](https://gohugo.io/overview/configuration/) and how they can be used to customize the output. A working config file `sample-config.toml` is provided and parameters are explained below: ``` python baseurl = "http://example.com/" @@ -118,6 +118,8 @@ post = "/blog/:year-:month-:day-:title/" notfound_text = """Please either go back or use the navigation/sidebar menus. """ + # Set to true to hide ReadingTime on posts + disableReadingTime = false ``` ## Code highlight diff --git a/layouts/partials/post_header.html b/layouts/partials/post_header.html index 3868f4f..b65d6cb 100644 --- a/layouts/partials/post_header.html +++ b/layouts/partials/post_header.html @@ -5,7 +5,7 @@ {{ if .IsHome }} {{ .Title }} {{ else }} {{ .Title }} {{ end }}

{{ .Date.Format "Jan 2, 2006" }} - - {{ .ReadingTime }} minute read + {{ if not .Site.Params.disableReadingTime }} - {{ .ReadingTime }} minute read {{ end }} {{ if .Site.Params.disqusShortname }} - Comments{{ end }} {{ if isset .Params "categories" }} diff --git a/sample-config.toml b/sample-config.toml index 6943e6d..8912c80 100644 --- a/sample-config.toml +++ b/sample-config.toml @@ -136,6 +136,9 @@ post = "/blog/:year-:month-:day-:title/" # change the post URL to look like the notfound_text = """Please either go back or use the navigation/sidebar menus. """ + # Set to true to hide ReadingTime on posts + disableReadingTime = false + # blackfriday is Hugo's markdown engine. Options are at: https://gohugo.io/overview/configuration/ (scroll down to "Configure Blackfriday rendering") [blackfriday] hrefTargetBlank = true # open the external links in a new window -- cgit v1.2.3