Replace blog post estimated reading time to word count

This commit is contained in:
Helen Chong
2024-09-05 23:29:37 +08:00
parent 0b0679cc41
commit 0d06c6a7d2
4 changed files with 7 additions and 5 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -3,7 +3,7 @@ import pluginRss from "@11ty/eleventy-plugin-rss";
import pluginEleventyNavigation from "@11ty/eleventy-navigation";
import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import pluginMetagen from "eleventy-plugin-metagen";
import pluginEmojiReadTime from "@11tyrocks/eleventy-plugin-emoji-readtime";
import pluginWordcount from "eleventy-plugin-wordcount-extended";
// Custom configurations
import markdownItConfig from "./src/_config/markdown-it.js";
@@ -18,7 +18,7 @@ export default function(eleventyConfig) {
eleventyConfig.addPlugin(pluginEleventyNavigation);
eleventyConfig.addPlugin(pluginSyntaxHighlight, { preAttributes: { tabindex: 0 } });
eleventyConfig.addPlugin(pluginMetagen);
eleventyConfig.addPlugin(pluginEmojiReadTime);
eleventyConfig.addPlugin(pluginWordcount);
// Custom configurations
eleventyConfig.addPlugin(markdownItConfig);

View File

@@ -15,11 +15,11 @@
"@11ty/eleventy-navigation": "^0.3.5",
"@11ty/eleventy-plugin-rss": "^2.0.2",
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"@11tyrocks/eleventy-plugin-emoji-readtime": "^1.0.1",
"@uncenter/eleventy-plugin-toc": "^1.0.3",
"@zachleat/details-utils": "^2.0.2",
"eleventy-plugin-embed-everything": "^1.18.2",
"eleventy-plugin-metagen": "^1.8.3",
"eleventy-plugin-wordcount-extended": "^0.2.1",
"markdown-it-anchor": "^9.0.1",
"markdown-it-attrs": "^4.2.0",
"markdown-it-bracketed-spans": "^1.0.1"

View File

@@ -10,7 +10,10 @@ layout: global/base
{% if tags and tags.includes("posts") %}
<div class="blog__post--info">
<p>{{ desc }}</p>
<p><span class="text-bold">Posted:</span> {{ date | niceDate }} by {{ sitemeta.siteAuthor.name }}</p>
<p>
<span class="text-bold">{{ content | wordcount }} words</span>.
<span class="text-bold">Posted:</span> {{ date | niceDate }} by {{ sitemeta.siteAuthor.name }}
</p>
{% if updated %}
<p><span class="text-bold">Last Updated:</span> {{ updated | niceDate }}</p>
{% endif %}
@@ -19,7 +22,6 @@ layout: global/base
<a href="/blog/categories/{{ cat | slugify }}">{{ cat }}</a>{% if not loop.last %}, {% endif %}
{% endfor %}
</p>
<p>{{ content | emojiReadTime }}</p>
</div>
{% endif %}
</header>