Skip to content

Commit 4a76b97

Browse files
committed
Frontmatter: Add optional reading time
1 parent 7986d55 commit 4a76b97

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
@@ -1523,6 +1523,11 @@ a:hover {
15231523
display: block;
15241524
}
15251525
}
1526+
1527+
.content__reading-time {
1528+
font-size: var(--font-step--1);
1529+
color: oklch(var(--color-footer-text));
1530+
}
15261531
}
15271532

15281533
.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)