feat: randomized subtitle

This commit is contained in:
zaaarf 2023-12-22 12:19:19 +01:00
parent 1917465ec9
commit a77515e9c7
No known key found for this signature in database
GPG key ID: 102E445F4C3F829B
8 changed files with 60 additions and 85 deletions

15
templates/base-page.html Normal file
View file

@ -0,0 +1,15 @@
<h1>{{ page.title }}</h1>
{% if page.toc and page.extra.toc %}
{% include "toc.html" %}
{% endif %}
{{ page.content | safe }}
<p class="tagsData">
{% if page.taxonomies.tags %}
{% for tag in page.taxonomies.tags %}
<a href="/tags/{{ tag | slugify }}">&#47;{{ tag }}&#47;</a>
{% endfor %}
{% endif %}
</p>

View file

@ -6,42 +6,7 @@
{% if config.extra.author and config.extra.display_author == true %}
<address rel="author">By <span class="metaData">{{config.extra.author}}</span></address>
{% endif %}
<h1>{{ page.title }}</h1>
{% if page.toc and page.extra.toc %}
<h2>Table of contents</h2>
<ul>
{% for h1 in page.toc %}
<li>
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
{% if h1.children %}
<ul>
{% for h2 in h1.children %}
<li>
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
<ul>
{% for h3 in h2.children %}
<li>
<a href="{{ h3.permalink | safe }}">{{ h3.title }}</a>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% include "base-page.html" %}
{{ page.content | safe }}
<p class="tagsData">
{% if page.taxonomies.tags %}
{% for tag in page.taxonomies.tags %}
<a href="/tags/{{ tag | slugify }}">&#47;{{ tag }}&#47;</a>
{% endfor %}
{% endif %}
</p>
{% endblock content %}

View file

@ -2,7 +2,7 @@
<div class=footContainer>
<div class="footLeft">
<p>Licensed under the <a target="_blank" rel="noopener noreferrer" href="https://en.wikipedia.org/wiki/MIT_License">MIT License</a>.<br>
Built with <a target="_blank" rel="noopener noreferrer" href="https://www.getzola.org">Zola</a> using <a target="_blank" rel="noopener noreferrer" href="https://github.com/Speyll/anemone">anemone</a> theme &amp; <a target="_blank" rel="noopener noreferrer" href="https://github.com/Speyll/veqev">veqev</a> colors.<br>
Built with <a target="_blank" rel="noopener noreferrer" href="https://www.getzola.org">Zola</a> combining the <a target="_blank" rel="noopener noreferrer" href="https://github.com/Speyll/anemone">anemone</a> and <a href="https://github.com/rhazdon/hugo-theme-hello-friend-ng/">hello-friend-ng</a> themes.<br>
</p>
</div>
{% if config.generate_feed %}

View file

@ -87,6 +87,7 @@
{% if image %}
<link rel="shortcut icon" type="image/x-icon" href="{{ get_url(path=config.extra.favicon, trailing_slash=false) }}">
{% endif %}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
{% endblock metatags %}
{% if config.generate_feed %}
{% block feed %}

View file

@ -8,10 +8,23 @@
<h1>{{ config.title }}</h1>
{% endif %}
{% if config.extra.home_subtitle %}
<p>{{ config.extra.home_subtitle }}</p>
<p>{{ config.extra.home_subtitle }}<span id="subtitleRand"></span></p>
{% elif config.description %}
<p>{{ config.description }}</p>
<p>{{ config.description }}<span id="subtitleRand"></span></p>
{% endif %}
{% include "svg.html" %}
</div>
{% if config.extra.home_subtitle_suffixes %}
<script>
const suffixes = [
{% for s in config.extra.home_subtitle_suffixes %}
"{{ s }}",
{% endfor %}
]
var current = suffixes[Math.floor(Math.random() * suffixes.length)];
var span = document.getElementById("subtitleRand");
span.textContent = current;
</script>
{% endif %}
{% endblock content %}

View file

@ -1,42 +1,5 @@
{% extends "base.html" %}
{% block content %}
<h1>{{ page.title }}</h1>
{% if page.toc and page.extra.toc %}
<h2>Table of contents</h2>
<ul>
{% for h1 in page.toc %}
<li>
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
{% if h1.children %}
<ul>
{% for h2 in h1.children %}
<li>
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
<ul>
{% for h3 in h2.children %}
<li>
<a href="{{ h3.permalink | safe }}">{{ h3.title }}</a>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{{ page.content | safe }}
<p class="tagsData">
{% if page.taxonomies.tags %}
{% for tag in page.taxonomies.tags %}
<a href="/tags/{{ tag | slugify }}">&#47;{{ tag }}&#47;</a>
{% endfor %}
{% endif %}
</p>
{% include "base-page.html" %}
{% endblock content %}

View file

@ -1,8 +0,0 @@
{% if src %}
{# If the image's URL is internal to the site... #}
{% if src is not starting_with("http") %}
{# ... then prepend the site's base URL to the image's URL. #}
{% set src = config.base_url ~ src %}
{% endif %}
<center><img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %} class="{% if position %}{{ position }}{% else -%} center {%- endif %}" {%- if style %} style="border-radius: 8px; {{ style | safe }}" {%- endif %} /></center>
{% endif %}

26
templates/toc.html Normal file
View file

@ -0,0 +1,26 @@
<div class="toc">
<h2>Table of contents</h2>
<ul>
{% for h1 in page.toc %}
<li>
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
{% if h1.children %}
<ul>
{% for h2 in h1.children %}
<li>
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
<ul>
{% for h3 in h2.children %}
<li>
<a href="{{ h3.permalink | safe }}">{{ h3.title }}</a>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</div>