Replace estimated reading time with wordcount

This commit is contained in:
Helen Chong 2024-09-05 23:49:01 +08:00
parent f3fe88ff58
commit c179700a08
4 changed files with 14 additions and 15 deletions

BIN
bun.lockb

Binary file not shown.

View File

@ -4,7 +4,7 @@ import pluginEleventyNavigation from "@11ty/eleventy-navigation";
import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"; import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import pluginEmbedEverything from "eleventy-plugin-embed-everything"; import pluginEmbedEverything from "eleventy-plugin-embed-everything";
import pluginMetagen from "eleventy-plugin-metagen"; import pluginMetagen from "eleventy-plugin-metagen";
import pluginEmojiReadTime from "@11tyrocks/eleventy-plugin-emoji-readtime"; import pluginWordcount from "eleventy-plugin-wordcount-extended";
import pluginTOC from "@uncenter/eleventy-plugin-toc"; import pluginTOC from "@uncenter/eleventy-plugin-toc";
// Custom Configurations // Custom Configurations
@ -21,7 +21,7 @@ export default function(eleventyConfig) {
eleventyConfig.addPlugin(pluginSyntaxHighlight, { preAttributes: { tabindex: 0 } }); eleventyConfig.addPlugin(pluginSyntaxHighlight, { preAttributes: { tabindex: 0 } });
eleventyConfig.addPlugin(pluginEmbedEverything, { add: ['soundcloud'] }); eleventyConfig.addPlugin(pluginEmbedEverything, { add: ['soundcloud'] });
eleventyConfig.addPlugin(pluginMetagen); eleventyConfig.addPlugin(pluginMetagen);
eleventyConfig.addPlugin(pluginEmojiReadTime); eleventyConfig.addPlugin(pluginWordcount);
eleventyConfig.addPlugin(pluginTOC, { eleventyConfig.addPlugin(pluginTOC, {
tags: ['h2', 'h3', 'h4', 'h5', 'h6'], tags: ['h2', 'h3', 'h4', 'h5', 'h6'],
wrapper: function (toc) { wrapper: function (toc) {

View File

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

View File

@ -18,9 +18,9 @@
{% if isArticle %} {% if isArticle %}
<div class="article__info"> <div class="article__info">
<p class="article__info--desc">{{ desc }}</p> <p class="article__info--desc">{{ desc }}</p>
<p>Posted on {{ date | formatDate }} by {{ sitemeta.siteAuthor.name }} <p>{{ content | wordcount }} words. Posted on {{ date | formatDate }} by {{ sitemeta.siteAuthor.name }}</p>
{% if updated %} {% if updated %}
Last updated on {{ updated | formatDate }}</p> <p>Last updated on {{ updated | formatDate }}</p>
{% endif %} {% endif %}
{% if categories %} {% if categories %}
<p>Categories: <p>Categories:
@ -29,7 +29,6 @@
{% endfor %} {% endfor %}
</p> </p>
{% endif %} {% endif %}
<p>{{ content | emojiReadTime }}</p>
</div> </div>
{% else %} {% else %}
{% if desc %} {% if desc %}