Skip to content

Commit

Permalink
Add tag cloud to home
Browse files Browse the repository at this point in the history
Some designer may chime in with better CSS later, maybe ...

Fixes #28
  • Loading branch information
bep committed Apr 26, 2017
1 parent 11a61c9 commit e82f670
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion layouts/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ partial "header.html" . }}

{{ partial "tag-cloud.html" . }}
<div class="row">
{{ range .Site.RegularPages.ByLastmod.Reverse }}
{{ .Render "thumbnail"}}
Expand Down
13 changes: 13 additions & 0 deletions layouts/partials/tag-cloud.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="row">
<div id="theme-tagcloud" class="col-sm-12">
{{ $tags := (index $.Site.Taxonomies "tags").ByCount }}
{{ $v1 := where $tags "Count" ">=" 3 }}
{{ $v2 := where $v1 "Term" "not in" (slice "hugo" "tags" "rss") }}
{{ range $v2 }}
{{ if .Term }}
{{ $tagURL := printf "tags/%s" .Term | relURL }}
<a href="{{ $tagURL }}" class="btn btn-default" role="button">{{ .Term }} <span class="badge">({{ .Count }})</span></a>
{{ end }}
{{ end }}
</div>
<div>
13 changes: 13 additions & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -742,12 +742,25 @@ h1.top-menu {

#theme-header .theme-buttons a.btn-dark {
color: #242424;

}

#theme-header .theme-buttons a.btn-dark:hover {
color: #121212;
}


#theme-tagcloud {
margin-bottom: 15px;
}

#theme-tagcloud .btn {
text-transform: uppercase;
font-size: 12px;
padding-right: 5px;
padding-left: 5px;
}

.content {
border-top: none;
margin-top: 10px;
Expand Down

0 comments on commit e82f670

Please sign in to comment.