Skip to content

Commit 5ec0ad2

Browse files
authored
Frontmatter: Add optional reading time (#358)
1 parent 8505b2a commit 5ec0ad2

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

assets/css/v2/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,11 @@ a:hover {
15481548
display: block;
15491549
}
15501550
}
1551+
1552+
.content__reading-time {
1553+
font-size: var(--font-step--1);
1554+
color: oklch(var(--color-footer-text));
1555+
}
15511556
}
15521557

15531558
.headerlink {

exampleSite/content/nginx/installing-nginx-open-source.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ doctypes:
77
title: Installing NGINX Open Source
88
toc: true
99
weight: 200
10+
nd-reading-time: true
1011
---
1112

1213
![hero-graphic](/hero-graphic.webp)

layouts/_default/single.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
{{ partial "banner" .}}
1515

1616
<h1>{{ .Title }}</h1>
17+
<div class="content__reading-time">
18+
{{ if index .Params "nd-reading-time" }}
19+
{{ printf "~%d min read" .ReadingTime }}
20+
{{ end }}
21+
</div>
1722

1823
{{ $content | safeHTML }}
1924

0 commit comments

Comments
 (0)