23 lines
756 B
Plaintext

---
layout: /layouts/base.njk
permalink: "content/{{ title | slugify }}/index.html"
---
<div class="text-base text-purple-300 mb-5 inline-flex flex-col">
<span>{{ page.date | string | truncate(15, true, "") }}</span>
<span class="text-sm text-amber-200"><span id="time"></span> minutes read</span>
</div>
<article id="article" class="prose lg:prose-xl text-off-white text-justify">
{{ content | safe }}
</article>
<script defer>
function readingTime() {
const text = document.getElementById("article").innerText;
const wpm = 225;
const words = text.trim().split(/\s+/).length;
const time = Math.ceil(words / wpm);
document.getElementById("time").innerText = time;
}
readingTime();
</script>