1
0
Fork 0
forked from github/pelican

feat: add blog post word count

This commit is contained in:
Oliver Ladner 2025-07-08 10:51:34 +02:00
commit c0618e0a9c
11 changed files with 103 additions and 50 deletions

View file

@ -52,6 +52,14 @@
ul {
@apply pl-4 list-disc;
}
/* pelican tag_cloud */
ul.tagcloud {
@apply list-none p-0;
}
ul.tagcloud li {
@apply inline-block p-1;
}
}
@layer components {

View file

@ -718,6 +718,18 @@ ul {
padding-left: 1rem;
}
/* pelican tag_cloud */
ul.tagcloud {
list-style-type: none;
padding: 0px;
}
ul.tagcloud li {
display: inline-block;
padding: 0.25rem;
}
/* Preflight is injected here */
.prose {
@ -1331,10 +1343,6 @@ code {
grid-template-columns: repeat(9, minmax(0, 1fr));
}
.grid-cols-\[max-content_max-content_max-content_max-content\] {
grid-template-columns: max-content max-content max-content max-content;
}
.grid-cols-\[max-content_max-content_max-content_max-content_max-content\] {
grid-template-columns: max-content max-content max-content max-content max-content;
}
@ -1360,6 +1368,10 @@ code {
hyphens: auto;
}
.rounded-full {
border-radius: 9999px;
}
.border-b-2 {
border-bottom-width: 2px;
}
@ -1398,16 +1410,6 @@ code {
background-color: rgb(255 250 243 / var(--tw-bg-opacity, 1));
}
.bg-rp-dawn-subtle {
--tw-bg-opacity: 1;
background-color: rgb(121 117 147 / var(--tw-bg-opacity, 1));
}
.bg-rp-dawn-muted {
--tw-bg-opacity: 1;
background-color: rgb(152 147 165 / var(--tw-bg-opacity, 1));
}
.bg-gradient-to-r {
background-image: linear-gradient(to right, var(--tw-gradient-stops));
}
@ -1446,6 +1448,11 @@ code {
padding: 2rem;
}
.px-2 {
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.pb-4 {
padding-bottom: 1rem;
}
@ -1490,6 +1497,11 @@ code {
line-height: 1.5rem;
}
.text-sm {
font-size: 0.875rem;
line-height: 1.25rem;
}
.text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
@ -1503,6 +1515,10 @@ code {
text-transform: uppercase;
}
.capitalize {
text-transform: capitalize;
}
.italic {
font-style: italic;
}
@ -2260,16 +2276,16 @@ code {
background-color: rgb(57 53 82 / var(--tw-bg-opacity, 1));
}
.dark\:bg-rp-moon-surface {
--tw-bg-opacity: 1;
background-color: rgb(42 39 63 / var(--tw-bg-opacity, 1));
}
.dark\:bg-rp-moon-pine {
--tw-bg-opacity: 1;
background-color: rgb(62 143 176 / var(--tw-bg-opacity, 1));
}
.dark\:bg-rp-moon-surface {
--tw-bg-opacity: 1;
background-color: rgb(42 39 63 / var(--tw-bg-opacity, 1));
}
.dark\:text-rp-moon-foam {
--tw-text-opacity: 1;
color: rgb(156 207 216 / var(--tw-text-opacity, 1));
@ -2290,13 +2306,13 @@ code {
color: rgb(234 154 151 / var(--tw-text-opacity, 1));
}
.dark\:text-rp-moon-text {
--tw-text-opacity: 1;
color: rgb(224 222 244 / var(--tw-text-opacity, 1));
}
.dark\:text-rp-moon-surface {
--tw-text-opacity: 1;
color: rgb(42 39 63 / var(--tw-text-opacity, 1));
}
.dark\:text-rp-moon-text {
--tw-text-opacity: 1;
color: rgb(224 222 244 / var(--tw-text-opacity, 1));
}
}

View file

@ -1,12 +1,11 @@
{% extends "base.html" %}
{% block title %}{{ SITENAME|striptags }} - Archives{% endblock %}
{% block title %}Blog archive - {{ SITENAME|striptags }}{% endblock %}
{% block content %}
<div class="md:text-base lg:text-lg">
<h1 class="text-3xl md:text-5xl">Blog archive</h1>
<h1 class="text-3xl md:text-5xl">Blog post archive</h1>
<ul class="hyphens-auto list-outside list-disc">
{% for article in dates %}
{% set year = article.date.strftime('%Y') %}
{% if loop.first %}

View file

@ -29,7 +29,7 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-5">
<path fill-rule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z" clip-rule="evenodd" />
</svg>
&nbsp;{{ article.stats['read_mins']*1.5|round|int }} min. read
&nbsp;{{ article.stats['read_mins']*1.5|round|int }} min. read ({{ article.stats['wc'] }} words)
</span>
<span class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-5">

View file

@ -1,12 +1,13 @@
{% extends "base.html" %}
{% block title %}{{ SITENAME|striptags }} - Authors{% endblock %}
{% block title %}Authors - {{ SITENAME|striptags }}{% endblock %}
{% block content %}
<h1 class="text-3xl md:text-5xl">Authors on {{ SITENAME }}</h1>
<ul>
{% for author, articles in authors|sort %}
<li><a href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a> ({{ articles|count }})</li>
{% endfor %}
</ul>
<h1 class="text-3xl md:text-5xl">Authors</h1>
It's all me, silly you.
<!-- <ul> -->
<!-- {% for author, articles in authors|sort %} -->
<!-- <li><a href="{{ SITEURL }}/{{ author.url }}">{{ author }}</a> ({{ articles|count }})</li> -->
<!-- {% endfor %} -->
<!-- </ul> -->
{% endblock %}

View file

@ -48,6 +48,23 @@
/* Align prism.js font size to main font size */
font-size: 0.9rem;
}
ul.tagcloud {
list-style: none;
padding: 0;
}
<!-- Pelican tag_cloud -->
ul.tagcloud li {
display: inline-block;
}
li.tag-1 {
font-size: 160%;
}
li.tag-2 {
font-size: 130%;
}
li.tag-3 {
font-size: 100%;
}
</style>
{% endblock head %}
</head>
@ -71,7 +88,7 @@
{% if DISPLAY_PAGES_ON_MENU %}
<div>
{% for p in pages %}
<li><a href="{{ SITEURL }}/{{ p.url }}" class="no-underline" {% if p==page %} aria-current="page" {% endif %}>{{ p.title }}</a></li>
<li><a href="{{ SITEURL }}/{{ p.url }}" class="no-underline" {% if p==page %} aria-current="page" {% endif %}>{{ p.title }}</a></li>
{% endfor %}
</div>
{% endif %}
@ -124,13 +141,11 @@
</div>
<div class="col-span-3 p-4 md:border-l-4 border-rp-dawn-overlay dark:border-rp-moon-overlay">
<p class="pb-4">
Mostly valid <a href="https://wave.webaim.org/report#/https://lugh.ch">WCAG 2.2 AA</a>
100% artisanal <a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1" rel="license noopener noreferrer" style="display: inline-block">content licensed under <em>CC BY-SA 4.0</em></a>,
mostly <a href="https://wave.webaim.org/report#/https://lugh.ch/{{ output_file }}">valid <em>WCAG 2.2 AA</em></a>.
</p>
<p class="pb-4">
100% organic content licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1" rel="license noopener noreferrer" style="display: inline-block">CC BY-SA 4.0</a>
</p>
<p class="pb-4">
<a href="/feeds/atom.xml">Atom feed</a>
<a href="/feeds/atom.xml">Atom feed</a> of all blog posts.
</p>
</div>
</div>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}{{ SITENAME|striptags }} - Categories{% endblock %}
{% block title %}Categories - {{ SITENAME|striptags }}{% endblock %}
{% block content %}
<div class="md:text-base lg:text-lg">

View file

@ -1,6 +1,6 @@
{% extends "index.html" %}
{% block title %}{{ SITENAME|striptags }} - {{ category }} category{% endblock %}
{% block title %}{{ category }} - {{ SITENAME|striptags }}{% endblock %}
{% block content_title %}
<h1 class="text-3xl md:text-5xl">Tales from the <em>{{ category }}</em> department</h1>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block html_lang %}{{ page.lang }}{% endblock %}
{% block title %}{{ SITENAME|striptags }} - {{ page.title|striptags }}{%endblock%}
{% block title %}{{ page.title|striptags }} - {{ SITENAME|striptags }} {%endblock%}
{% block head %}
{{ super() }}

View file

@ -1,6 +1,6 @@
{% extends "index.html" %}
{% block title %}{{ SITENAME|striptags }} - {{ tag }} tag{% endblock %}
{% block title %} {{ tag|capitalize }} - {{ SITENAME|striptags }}{% endblock %}
{% block content_title %}
<h1 class="text-3xl md:text-5xl">Tales tagged with <em>{{ tag }}</em></h1>

View file

@ -1,12 +1,26 @@
{% extends "base.html" %}
{% block title %}{{ SITENAME|striptags }} - Tags{% endblock %}
{% block title %}Tags - {{ SITENAME|striptags }}{% endblock %}
{% block content %}
<h1 class="text-3xl md:text-5xl">Tags for {{ SITENAME }}</h1>
<ul>
{% for tag, articles in tags|sort %}
<li><a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a> ({{ articles|count }})</li>
{% endfor %}
</ul>
<h1 class="text-3xl md:text-5xl">Article tags</h1>
<ul class="tagcloud">
{% for tag in tag_cloud %}
<li class="tag-{{ tag.1 }}">
<a class="no-underline" title="{{ tag.2 }} articles" href="{{ SITEURL }}/{{ tag.0.url }}">
{{ tag.0 }}
</a>
{% if TAG_CLOUD_BADGE %}
<span class="bg-rp-dawn-overlay dark:bg-rp-moon-surface text-rp-dawn-pine dark:text-rp-moon-foam rounded-full px-2 text-sm">{{ tag.2 }}</span>
{% endif %}
</li>
{% endfor %}
</ul>
<!-- <ul> -->
<!-- {% for tag, articles in tags|sort %} -->
<!-- <li><a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a> ({{ articles|count }})</li> -->
<!-- {% endfor %} -->
<!-- </ul> -->
{% endblock %}