This is an old revision of the document!
Table of Contents
Pure Blog
I've installed Pure Blog
After trying the Blog Plugin in dokuwiki and Chyrp-Lite PHP/SQLite blogging platform I switched to Pure Blog.
It's just what I need, and nothing extra to make it big and bloated.
Installation & Configuration
CSS
.tag-cloud a { margin: 0 0.5rem; line-height: 2rem; } .archive li { line-height: 1.5rem; font-size: 1.1rem; list-style-type: none; } body { font-size: 1rem; line-height: 1.25rem; } main { max-width: 50rem; } article { margin-bottom: 0; } p.post-archive-view { font-size : 1.1rem; line-height: 1.1rem; } main h1 { font-size: 2.8rem; } header, footer{ font-family: "atkinson_next", sans-serif; font-size: 1.1rem; } footer { margin-top: 3rem; } main h1, main h2, main h3, main h4, main h5, main h6 { margin-left: -1rem; font-family: "atkinson_next", sans-serif; } .tag-list { border-top: 1px solid var(--border-color); padding-top: 2rem; } .post-nav { margin-top : 0; margin-bottom: 3rem; } @font-face { font-family: 'atkinson_next'; src: url('/content/fonts/AtkinsonHyperlegibleNext-Regular.woff2') format('woff2'); font-weight: normal; font-display: swap; font-style: normal; } @font-face { font-family: 'atkinson_next'; src: url('/content/fonts/AtkinsonHyperlegibleNext-Bold.woff2') format('woff2'); font-weight: bold; font-display: swap; font-style: normal; } @font-face { font-family: 'atkinson_next'; src: url('/content/fonts/AtkinsonHyperlegibleNext-RegularItalic.woff2') format('woff2'); font-weight: normal; font-display: swap; font-style: italic; } @font-face { font-family: 'atkinson_next'; src: url('/content/fonts/AtkinsonHyperlegibleNext-BoldItalic.woff2') format('woff2'); font-weight: bold; font-display: swap; font-style: italic; } @font-face { font-family: 'atkinson_mono'; src: url('/content/fonts/AtkinsonHyperlegibleMono-Regular.woff2') format('woff2'); font-weight: normal; font-display: swap; font-style: normal; } @font-face { font-family: 'atkinson_mono'; src: url('/content/fonts/AtkinsonHyperlegibleMono-RegularItalic.woff2') format('woff2'); font-weight: normal; font-display: swap; font-style: italic; } @font-face { font-family: 'atkinson_mono'; src: url('/content/fonts/AtkinsonHyperlegibleMono-Bold.woff2') format('woff2'); font-weight: bold; font-display: swap; font-style: normal; } @font-face { font-family: 'atkinson_mono'; src: url('/content/fonts/AtkinsonHyperlegibleMono-BoldItalic.woff2') format('woff2'); font-weight: bold; font-display: swap; font-style: italic; } :root { --font-stack: "atkinson_mono", system-ui, monospace; } pre { font-family: "atkinson_mono", monospace; } code { font-family: "atkinson_mono", monospace; }
Addons
Kev sent me 2 PHP scripts to provide a Tag-Cloud and a full site Archive page.
I tweaked them a bit, and here are my current versions.
- tag-cloud.php
<?php declare(strict_types=1); $pageTitle = 'Tag Cloud'; $metaDescription = 'All tags, sized by how often they appear.'; $tagIndex = load_tag_index(); $tagCounts = []; if ($tagIndex) { foreach ($tagIndex as $slug => $slugs) { $tagCounts[$slug] = count($slugs); } } // Collect original display names from posts (slugs alone lose capitalisation/spaces) $originalNames = []; foreach (get_all_posts(false) as $post) { foreach (($post['tags'] ?? []) as $tag) { $slug = normalize_tag($tag); if (!isset($originalNames[$slug])) { $originalNames[$slug] = $tag; } } } // Sort alphabetically by display name uksort($tagCounts, function (string $a, string $b) use ($originalNames): int { return strcasecmp($originalNames[$a] ?? $a, $originalNames[$b] ?? $b); }); $maxCount = $tagCounts ? max($tagCounts) : 1; $minCount = $tagCounts ? min($tagCounts) : 1; $range = $maxCount > $minCount ? $maxCount - $minCount : 1; require PUREBLOG_BASE_PATH . '/includes/header.php'; render_masthead_layout($config, ['page' => null]); ?> <main> <h1>Tag Cloud</h1> <?php if (empty($tagCounts)): ?> <p>No tags found.</p> <?php else: ?> <p class="tag-cloud"> <?php foreach ($tagCounts as $slug => $count): $name = $originalNames[$slug] ?? $slug; $ratio = ($count - $minCount) / $range; $fontSize = round(0.85 + $ratio * 1.4, 2); $postWord = $count === 1 ? 'post' : 'posts'; echo '<a href="/tag/' . e(rawurlencode($slug)) . '"' . ' style="font-size: ' . $fontSize . 'em"' . ' title="' . e((string) $count) . ' ' . $postWord . '">' . e($name) . '(' . e((string) $count) . ')' . '</a>' . '  '; endforeach; ?> </p> <?php endif; ?> </main> <?php render_footer_layout($config, ['page' => null]); ?> </body> </html>
- archive.php
<?php declare(strict_types=1); $allPosts = get_all_posts(false); $postsByYear = []; foreach ($allPosts as $entry) { $year = !empty($entry['date']) ? date('Y', strtotime((string) $entry['date'])) : 'Unknown'; $postsByYear[$year][] = $entry; } krsort($postsByYear, SORT_NATURAL); $pageTitle = 'Archive'; $metaDescription = 'Browse all published posts by year.'; ?> <?php require PUREBLOG_BASE_PATH . '/includes/header.php'; ?> <?php render_masthead_layout($config); ?> <main class=archive> <article> <h1>Archive</h1> <p><?= e((string) count($allPosts)) ?> published posts.</p> <?php if (!$allPosts): ?> <p>No published posts yet.</p> <?php else: ?> <?php foreach ($postsByYear as $year => $yearPosts): ?> <h3><?= e((string) $year) ?> (<?= e((string) count($yearPosts)) ?>)</h3> <ul> <?php foreach ($yearPosts as $postItem): ?> <li> <?php if (!empty($postItem['date'])): ?> <!-- <small> --> <time datetime="<?= e((string) $postItem['date']) ?>"> <?= e(date('D Y-m-d H:i', strtotime((string) $postItem['date']))) ?> </time> <!-- </small> -->   <?php endif; ?> <a href="/<?= e((string) ($postItem['slug'] ?? '')) ?>"> <?= e((string) ($postItem['title'] ?? 'Untitled')) ?> </a> </li> <?php endforeach; ?> </ul> <?php endforeach; ?> <?php endif; ?> </article> </main> <?php render_footer_layout($config); ?> </body> </html>
Further Information
Page created : 02/03/26 08:50 GMT
Page updated : 03/03/26 07:32 GMT