Try to learn something about everything, and everything about somethingThomas Huxley “Darwin's bulldog” (1824-1895)

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
public:computers:pureblog [02/03/26 08:52 GMT] johnpublic:computers:pureblog [03/03/26 07:32 GMT] (current) – [Installation & Configuration] john
Line 2: Line 2:
  
  
-====== Pureblog ======+====== Pure Blog ======
  
-** Description **+** I've installed Pure Blog **
  
-===== Section One =====+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 =====
 +
 +FIXME
 +
 +See [[https://g4slv.info/installing-pure-blog]] for some info.
 +
 +Webfonts used 
 +
 +  * {{ :public:computers:atkinson_hyperlegible_mono_woff2.zip | Atkinson Hyperlegible Mono}}
 +  * {{ :public:computers:atkinson_next_woff2.zip | Atkinson Hyperlegible Next}}
 +
 +==== CSS ====
 +
 +<code 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;
 +}
 +
 +</code>
 ===== Addons ===== ===== 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.
 +
 +
 +<file php 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>' . '&emsp;&emsp;';
 +
 +            endforeach; ?>
 +
 +        </p>
 +
 +    <?php endif; ?>
 +
 +</main>
 +
 +<?php render_footer_layout($config, ['page' => null]); ?>
 +
 +</body>
 +
 +</html>
 +
 +
 +</file>
  
 <file php archive.php> <file php archive.php>
Line 65: Line 338:
 </html> </html>
  
-</code>+</file>
  
  
Line 72: Line 345:
  
  
-{{tag>}}+{{tag>pure blog}}
  
 Page created  : 02/03/26 08:50 GMT Page created  : 02/03/26 08:50 GMT

Navigation