This commit is contained in:
2026-03-21 14:53:25 +00:00
commit 17f2462baf
42 changed files with 5986 additions and 0 deletions

62
templates/base.html Normal file
View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="{{ config.language }}">
<head>
{% block head %}
<meta charset="UTF-8" />
{% if metadata.description and not metadata.description == "nil" %}
<meta name="description" content="{{ metadata.description }}" />
{% endif %}
{% if metadata.authors %}
<meta name="author" content="{{ config.author }}" />
{% endif %}
{% if metadata.categories %}
<meta name="keywords" content="{{ metadata.categories | join(sep=", ") }}" />
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{% if config.highlighter is defined and config.highlighter.enable %}
{# If highlighter is enabled but the engine is not defined then fallback to prismjs #}
{% if config.highlighter.engine is not string or config.highlighter.engine == "prism" %}
{# PrismJS #}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism-themes/1.9.0/prism-one-dark.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
{% elif config.highlighter.engine is defined
and config.highlighter.engine == "hljs" %}
{# Highlight.js #}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script>hljs.highlightAll();</script> #}
{# Enable this one instead if you want all the `<code>` tags to be highlighted
<script>
document.addEventListener("DOMContentLoaded", (event) => {
document.querySelectorAll("code").forEach((block) => {
hljs.highlightBlock(block);
});
});
</script>
#}
{% elif config.highlighter.engine is string
and config.highlighter.engine not in ["prism", "hljs"] %}
<script>
window.alert("Warning: highlighter is enabled in the site configuration but its engine is not 'prism' nor 'hljs'");
</script>
{% endif %}
{% endif %}
{# User-defined styling #}
{# Tailwind CDN, replace with the Tailwind standalone CLI for production! #}
<script src="https://unpkg.com/@tailwindcss/browser@4"></script>
<link rel="stylesheet" href="/assets/style.css" />
<link rel="icon" href="/assets/norgolith.svg" />
<title>{% block title %}{% endblock title %} - {{ config.title | title }}</title>
{% endblock head %}
</head>
<body>
<div id="content">{% block content %}{% endblock content %}</div>
<div id="footer">
{% block footer %}
&copy; Copyright {{ now(format="%Y") }} by {{ config.author }}.
{% endblock footer %}
</div>
</body>
</html>

23
templates/categories.html Normal file
View File

@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block title %}Categories{% endblock title %}
{% block content %}
<div>
<h1>Categories</h1>
<p><i>All the categories used in posts.</i></p>
<hr />
<ul>
{% for category in categories | sort %}
{%- set_global cat_posts = 0 -%}
{% for post in posts %}
{% if category in post.categories %}
{%- set_global cat_posts = cat_posts + 1 -%}
{% endif %}
{% endfor %}
<li>
<a href="{{ config.rootUrl }}/categories/{{ category }}">{{ category }}</a>
<span>({{ cat_posts }} post{{ cat_posts | pluralize }})</span>
</li>
{% endfor %}
</ul>
</div>
{% endblock content %}

19
templates/category.html Normal file
View File

@@ -0,0 +1,19 @@
{% extends "base.html" %}
{% block title %}Category: {{ category }}{% endblock title %}
{% block content %}
<div>
<h1>Posts in {{ category }}</h1>
<p><i>All the posts with the category "{{ category }}"</i></p>
<hr />
<ul>
{% for post in posts %}
{% if category in post.categories %}
<li>
<a href="{{ post.permalink }}">{{ post.title }}</a>
<time>{{ post.created | date(format="%B %e, %Y") }}</time>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endblock content %}

28
templates/default.html Normal file
View File

@@ -0,0 +1,28 @@
{% extends "base.html" %}
{% block title %}{{ metadata.title | title }}{% endblock title %}
{% block content %}
<div class="container mx-auto min-h-screen mt-12">
{{ content | safe }}
</div>
{% endblock content %}
{% block footer %}
<footer class="bg-[#303040] mt-12 py-4 px-6 w-full font-mono">
<div
class="flex justify-between items-center font-medium text-xs md:text-sm text-grey"
>
<span
>Copyright &copy; {{ now(format="%Y") }}
<a
href="https://github.com/NTBBloodbath"
class="text-blue-400 hover:underline">NTBBloodbath</a
>. Licensed under GPLv2.</span
>
<a
href="https://github.com/NTBBloodbath/norgolith"
class="hover:text-blue-400"
>
<span>GitHub</span>
</a>
</div>
</footer>
{% endblock footer %}

33
templates/rss.xml Normal file
View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ config.title }}</title>
<link>{{ config.rootUrl | escape_xml | safe }}</link>
<description>{{ config.rss.description | default(value="Latest posts")}}</description>
<generator>Norgolith</generator>
<language>{{ config.language }}</language>
<lastBuildDate>{{ now | date(format="%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate>
<ttl>{{ config.rss.ttl | default(value=60) }}</ttl>
<atom:link href="{{ config.rootUrl }}/rss.xml" rel="self" type="application/rss+xml" />
<image>
<url>{{ config.rootUrl | escape_xml | safe }}{{ config.rss.image | default(value="/assets/favicon.png") }}</url>
<title>{{ config.title }}</title>
<link>{{ config.rootUrl | escape_xml | safe }}</link>
<width>144</width>
<height>144</height>
</image>
{% for post in posts | filter(attribute="draft", value=false) %}
<item>
<title>{{ post.title }}</title>
<link>{{ post.permalink | escape_xml | safe }}</link>
<guid>{{ post.permalink | escape_xml | safe }}</guid>
<description>{{ post.description }}</description>
<author>{{ post.authors | join(sep=", ") }}</author>
<pubDate>{{ post.created | date(format="%a, %d %b %Y %H:%M:%S %z") }}</pubDate>
{% if post.categories %}{% for category in post.categories %}<category>{{ category }}</category>{% endfor %}{% endif %}
</item>
{% endfor %}
</channel>
</rss>