Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ paginate = 10
# Default (if omitted) is "Blog".
home = "Blog"

# Links will be generated for these taxonomies
# Use to add links for categories, tags, etc.
# Example: [ "categories", "tags" ]
taxonomyItemsToLink = [ "categories" ]

# Metadata used to drive integrations.
googleAnalytics = "Your Google Analytics tracking code"
gravatarHash = "MD5 hash of your Gravatar email address"
Expand Down
5 changes: 1 addition & 4 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<ul class="posts">
{{ range .Data.Pages }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a>
{{ if isset .Params "categories" }}
&middot;
{{ range .Params.categories }}<a class="label" href="{{ "/categories/" | absURL }}{{ . | urlize }}">{{ . }}</a>{{ end }}
{{ end }}</span>
{{ partial "taxonomyLinks.html" (dict "context" . "separator" "middot") }}
&middot; <time>{{ .Date.Format "Jan 2, 2006" }}</time></li>
{{ end }}
</ul>
Expand Down
6 changes: 2 additions & 4 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ <h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title }}</a>
</h1>
<span class="post-date">{{ .Date.Format "Jan 2, 2006" }}{{ if not .Site.Params.hideReadingTime }} &middot; {{ .ReadingTime }} minute read{{ end }}{{ if .Site.DisqusShortname }} &middot; <a href="{{ .Permalink }}#disqus_thread">Comments</a>{{ end }}
{{ if isset .Params "categories" }}
<br/>
{{ range .Params.categories }}<a class="label" href="{{ "/categories/" | absURL }}{{ . | urlize }}">{{ . }}</a>{{ end }}
{{ end }}</span>
{{ partial "taxonomyLinks.html" (dict "context" . "separator" "newline") }}
</span>
{{ if eq .Site.Params.truncate false }}
{{ .Content }}
{{ else if .Description }}
Expand Down
15 changes: 15 additions & 0 deletions layouts/partials/taxonomyLinks.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ $.context.Scratch.Set "hasTaxonomyLinks" false }}
{{ range $itemToLink := $.context.Site.Params.taxonomyItemsToLink }}
{{ with (index $.context.Params $itemToLink) }}
{{ if gt (len .) 0 }} {{ $.context.Scratch.Set "hasTaxonomyLinks" true }} {{ end }}
{{ end }}
{{ end }}

{{ if eq ($.context.Scratch.Get "hasTaxonomyLinks") true }}
{{ if eq $.separator "newline" }}<br/>
{{ else if eq $.separator "middot" }}&middot;
{{ end }}
{{ range $itemToLink := $.context.Site.Params.taxonomyItemsToLink }}
{{ range index $.context.Params $itemToLink }}<a class="label" href="{{ (print $itemToLink "/") | absURL }}{{ . | urlize }}">{{ . }}</a>{{ end }}
{{ end }}
{{ end }}
6 changes: 2 additions & 4 deletions layouts/post/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
<div class="post">
<h1 class="post-title">{{ .Title }}</h1>
<span class="post-date">{{ .Date.Format "Jan 2, 2006" }}{{ if not .Site.Params.hideReadingTime }} &middot; {{ .ReadingTime }} minute read{{ end }}{{ if .Site.DisqusShortname }} &middot; <a href="{{ .Permalink }}#disqus_thread">Comments</a>{{ end }}
{{ if isset .Params "categories" }}
<br/>
{{ range .Params.categories }}<a class="label" href="{{ "/categories/" | absURL }}{{ . | urlize }}">{{ . }}</a>{{ end }}
{{ end }}</span>
{{ partial "taxonomyLinks.html" (dict "context" . "separator" "newline") }}
</span>
{{ .Content }}
</div>
{{ if .Site.DisqusShortname }}<div id="disqus_thread"></div>{{ end }}
Expand Down