Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/parsiya/Hugo-Octopress.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParsia Hakimian <parsiya@users.noreply.github.com>2016-05-26 20:55:44 +0300
committerParsia Hakimian <parsiya@users.noreply.github.com>2016-05-26 20:55:44 +0300
commit22fb9360181920ff5a4e05ead072c4fba3116109 (patch)
tree68b30969b0bb93f3bdd9a08d8f81bfd3b0347d1f
parentbcd9bcd32cc2810858c223c3f316420eb1b49795 (diff)
parent584ddb093bd0a987d78ef01243c517e6f7aa8a49 (diff)
Merge pull request #15 from Erethon/master
Add option to hide ReadingTime, simplify duplicate code
-rw-r--r--README.md4
-rw-r--r--layouts/index.html16
-rw-r--r--layouts/partials/post_header.html18
-rw-r--r--layouts/post/single.html12
-rw-r--r--sample-config.toml3
5 files changed, 27 insertions, 26 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)
## <a name="config"></a>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
```
## <a name="highlight"></a>Code highlight
diff --git a/layouts/index.html b/layouts/index.html
index 0598df7..c44ebf9 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -6,20 +6,8 @@
{{ $paginator := .Paginate (where .Data.Pages "Type" "post") }}
{{ range $paginator.Pages }}
<article>
- <header>
- <h1 class="entry-title">
- <a href="{{ .Permalink }}">{{ .Title }}</a>
- </h1>
- <p class="meta">{{ .Date.Format "Jan 2, 2006" }} - {{ .ReadingTime }} minute read - {{ if .Site.Params.disqusShortname }} <a href="{{ .Permalink }}#disqus_thread">Comments</a>{{ end }}
- {{ if isset .Params "categories" }}
- <!-- <br/> this will make the categories go to the second line and mess with the title -->
- <!-- in order to make category URLs work, we need to urlize them and then convert them to lowercase
- e.g. .NET Remoting -urlize-> .NET-Remoting -lowercase-> .net-remoting -->
- {{ range .Params.categories }}<a class="label" href="{{ "/categories/" | absURL }}{{ . | urlize | lower }}/">{{ . }}</a>{{ end }}
- {{ end }}</p>
-
- </header>
+ {{ partial "post_header.html" . }}
{{ if eq .Site.Params.truncate false }}
{{ .Content }}
@@ -50,4 +38,4 @@
</div>
</div>
-{{ partial "footer.html" . }} <!-- footer --> \ No newline at end of file
+{{ partial "footer.html" . }} <!-- footer -->
diff --git a/layouts/partials/post_header.html b/layouts/partials/post_header.html
new file mode 100644
index 0000000..b65d6cb
--- /dev/null
+++ b/layouts/partials/post_header.html
@@ -0,0 +1,18 @@
+<!-- This file contains the header/title for each post -->
+
+<header>
+ <h1 class="entry-title">
+ {{ if .IsHome }} <a href="{{ .Permalink }}">{{ .Title }}</a> {{ else }} {{ .Title }} {{ end }}
+ </h1>
+ <p class="meta">{{ .Date.Format "Jan 2, 2006" }}
+ {{ if not .Site.Params.disableReadingTime }} - {{ .ReadingTime }} minute read {{ end }}
+ {{ if .Site.Params.disqusShortname }} - <a href="{{ .Permalink }}#disqus_thread">Comments</a>{{ end }}
+
+ {{ if isset .Params "categories" }}
+ <!-- <br/> this will make the categories go to the second line and mess with the title -->
+ <!-- in order to make category URLs work, we need to urlize them and then convert them to lowercase
+ e.g. .NET Remoting -urlize-> .NET-Remoting -lowercase-> .net-remoting -->
+ - {{ range .Params.categories }}<a class="label" href="{{ "/categories/" | absURL }}{{ . | urlize | lower }}/">{{ . }}</a>{{ end }}
+ {{ end }}
+ </p>
+</header>
diff --git a/layouts/post/single.html b/layouts/post/single.html
index 2e843f3..d61ba0d 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -4,19 +4,9 @@
<div id="content">
<div>
<article class="hentry" role="article">
- <header>
- <h1 class="entry-title">
- {{ .Title }} <!-- we don't need page title to be a link on the actual page -->
- </h1>
- <p class="meta">{{ .Date.Format "Jan 2, 2006" }} - {{ .ReadingTime }} minute read - {{ if .Site.Params.disqusShortname }} <a href="{{ .Permalink }}#disqus_thread">Comments</a>{{ end }}
- <!-- if you want anything in the header between Disqus comments and categories add them here -->
+ {{ partial "post_header.html" . }}
- {{ if isset .Params "categories" }}
- <!-- <br/> this will make the categories go to the second line and mess with the title -->
- {{ range .Params.categories }}<a class="label" href="{{ "/categories/" | absURL }}{{ . | urlize | lower }}">{{ . }}</a>{{ end }}
- {{ end }}</p>
- </header>
<div class="entry-content">
<!-- insert table of contents if it is set either in the config file or in the frontmatter - frontmatter has priority -->
{{ $.Scratch.Set "pagetoc" .TableOfContents }}
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