Skip to content

Commit 42cbbab

Browse files
committed
blog: display tags on individual blog post pages
Override the Docsy blog/content.html template to render tags as primary-colored badges below the byline on each blog post page. Tags are only shown when present in the post's front matter.
1 parent 86a59c4 commit 42cbbab

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

assets/scss/_styles_project.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ pre {
175175
.blog-tags .badge {
176176
margin-right: 0.25rem;
177177
margin-bottom: 0.25rem;
178+
font-size: 0.85rem;
179+
font-weight: normal;
180+
padding: 0.35em 0.65em;
178181
}
179182

180183
/* Styling for the banner */

layouts/blog/content.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<div class="td-content">
2+
<h1>{{ .Title }}</h1>
3+
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
4+
<div class="td-byline mb-4">
5+
{{ with .Params.author }}{{ T "post_byline_by" }} <b>{{ . | markdownify }}</b> |{{ end}}
6+
<time datetime="{{ $.Date.Format "2006-01-02" }}" class="text-muted">{{ $.Date.Format $.Site.Params.time_format_blog }}</time>
7+
</div>
8+
{{ with .Params.tags }}
9+
<div class="blog-tags mb-4">
10+
{{ range . }}
11+
<span class="badge badge-primary mr-1">{{ . }}</span>
12+
{{ end }}
13+
</div>
14+
{{ end }}
15+
<header class="article-meta">
16+
{{ partial "taxonomy_terms_article_wrapper.html" . }}
17+
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) }}
18+
{{ partial "reading-time.html" . }}
19+
{{ end }}
20+
</header>
21+
{{ .Content }}
22+
{{ if (.Site.Params.DisqusShortname) }}
23+
<br />
24+
{{ partial "disqus-comment.html" . }}
25+
<br />
26+
{{ end }}
27+
28+
{{ partial "pager.html" . }}
29+
</div>

0 commit comments

Comments
 (0)