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

@ -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 %}