Allow making posts "featured", tweak article list styles

This commit is contained in:
daudix
2024-06-22 06:29:52 +03:00
parent 6c092ad49d
commit b157f81a07
25 changed files with 290 additions and 122 deletions

View File

@ -12,8 +12,8 @@
<div class="dialog-buttons">
<a onclick="window.history.go(-1)" class="inline-button">Go Back</a>
{% if config.extra.issues_url %}
{%- if config.extra.issues_url %}
<a class="inline-button colored external" href="{{ config.extra.issues_url }}">File an Issue</a>
{% endif %}
{%- endif %}
</div>
{% endblock content %}

View File

@ -11,15 +11,6 @@
<time datetime="{{ page.date | date(format=' %+') }}" pubdate>
{{ page.date | date(format=date_format, locale=date_locale) }}
</time>
{%- if page.updated -%}
<span></span>
<time datetime="{{ page.updated | date(format=' %+') }}" pubdate>
<span>
{{ macros_translate::translate(key="updated", default="Last updated on", language_strings=language_strings) }}
{{ page.updated | date(format=date_format, locale=date_locale) }}
</span>
</time>
{%- endif -%}
{%- if page.authors -%}
<span></span>
<span>
@ -29,8 +20,7 @@
{%- endif -%}
{%- if page.taxonomies -%}
{%- for name, taxon in page.taxonomies -%}
<span></span>
<ul class="tags">
<ul class="tags inline">
{%- for item in taxon -%}
<li>
<a class="tag" href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">
@ -42,6 +32,16 @@
{%- endfor -%}
{%- endif -%}
</small>
{%- if page.updated -%}
<small class="last-updated">
<time datetime="{{ page.updated | date(format=' %+') }}" pubdate>
<span>
{{ macros_translate::translate(key="updated", default="Last updated on", language_strings=language_strings) }}
{{ page.updated | date(format=date_format, locale=date_locale) }}
</span>
</time>
</small>
{%- endif -%}
{%- endif -%}
{%- if page.extra.archive -%}

View File

@ -16,47 +16,55 @@
</small>
<div id="article-list">
{%- for page in section.pages -%}
<article {% if page.draft %}class="draft"{% endif %}>
{%- for page in section.pages %}
<article class="
{% if page.draft %}draft{% endif %}
{% if page.extra.archive %}archive{% endif %}
{% if page.extra.featured %}featured{% endif %}">
<h3><a href="{{ page.permalink | safe }}">{{ page.title }}</a></h3>
{%- if page.draft -%}
{%- if page.draft %}
<span class="draft-badge">
<i class="icon"></i>
{{ macros_translate::translate(key="drafted", default="Drafted", language_strings=language_strings) }}
</span>
{%- endif -%}
{%- if page.extra.archive -%}
{%- if page.extra.archive %}
<span class="archive-badge">
<i class="icon"></i>
{{ macros_translate::translate(key="archived", default="Archived", language_strings=language_strings) }}
</span>
{%- endif -%}
{%- if page.description -%}
{%- endif %}
{%- if page.extra.featured %}
<span class="featured-badge">
<i class="icon"></i>
{{ macros_translate::translate(key="featured", default="Featured", language_strings=language_strings) }}
</span>
{%- endif %}
{%- if page.description %}
{{ page.description | markdown | safe }}
{%- endif -%}
{%- if page.date -%}
{%- endif %}
{%- if page.date %}
<small>
<time datetime="{{ page.date | date(format='%+') }}" pubdate>
{{- page.date | date(format=date_format, locale=date_locale) -}}
{{ page.date | date(format=date_format, locale=date_locale) }}
</time>
{%- if page.authors -%}
{%- if page.authors %}
<span></span>
<span>{{ macros_translate::translate(key="author", default="Author", language_strings=language_strings) }}: {{ page.authors[0] }}</span>
{%- endif %}
{%- if page.taxonomies -%}
{%- for name, taxon in page.taxonomies -%}
<span></span>
<ul class="tags">
{%-for item in taxon -%}
{%- if page.taxonomies %}
{%- for name, taxon in page.taxonomies %}
<ul class="tags inline">
{%-for item in taxon %}
<li><a class="tag" href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">{{ item }}</a></li>
{%- endfor -%}
{%- endfor %}
</ul>
{%- endfor -%}
{%- endif -%}
{%- endfor %}
{%- endif %}
</small>
{%- endif -%}
{%- endif %}
</article>
<hr>
{%- endfor -%}
{%- endfor %}
</div>
{% endblock content %}

View File

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block content %}
{%- if page.extra.archive -%}
{%- if page.extra.archive %}
<div class="statement-container archive">
<strong class="big">
<i class="icon"></i>
@ -9,6 +9,6 @@
</strong>
{{ page.extra.archive | markdown | safe }}
</div>
{%- endif -%}
{%- endif %}
{{ page.content | safe }}
{% endblock content %}

View File

@ -1,4 +1,4 @@
{#- Taken from the https://carlschwan.eu/2020/12/29/adding-comments-to-your-static-blog-with-mastodon/ -#}
{#- Taken from https://carlschwan.eu/2020/12/29/adding-comments-to-your-static-blog-with-mastodon/ -#}
{%- if page.extra.comments.host -%}
{%- set host = page.extra.comments.host -%}

View File

@ -1,60 +1,60 @@
<footer id="site-footer">
{%- if config.extra.footer.links -%}
{%- if config.extra.footer.links %}
<nav>
<ul>
{%- for link in config.extra.footer.links -%}
{%- if link.url is matching('https?://') -%}
{%- for link in config.extra.footer.links %}
{%- if link.url is matching('https?://') %}
<li>
<a href="{{ link.url }}">
{{ macros_translate::translate(key=link.name, default=link.name, language_strings=language_strings) }}
</a>
</li>
{%- else -%}
{%- else %}
<li>
<a href="{{ get_url(path=link.url, lang=lang)}}">
{{ macros_translate::translate(key=link.name, default=link.name, language_strings=language_strings) }}
</a>
</li>
{%- endif -%}
{%- endfor -%}
{%- endif %}
{%- endfor %}
</ul>
</nav>
{%- endif -%}
{%- endif %}
{%- if config.extra.footer.show_copyright -%}
{%- if config.extra.footer.copyright -%}
{%- if config.extra.footer.show_copyright %}
{%- if config.extra.footer.copyright %}
{{ config.extra.footer.copyright | markdown | safe }}
{%- else -%}
{%- else %}
<p>&copy; {{ config.title }}, {{ now() | date(format="%Y") }}</p>
{%- endif -%}
{%- endif -%}
{%- endif %}
{%- endif %}
{%- if config.extra.source_url and config.extra.footer.show_source -%}
{%- if config.extra.source_url and config.extra.footer.show_source %}
<p>
<a href="{{ config.extra.source_url }}">
{{ macros_translate::translate(key="source", default="Website source", language_strings=language_strings) }}
</a>
</p>
{%- endif -%}
{%- endif %}
{%- if config.extra.footer.show_powered_by -%}
{%- if config.extra.footer.show_powered_by %}
<p>
<small>
{{ macros_translate::translate(key="powered_by", default="Powered by", language_strings=language_strings) }} <a class="link" href="https://www.getzola.org">Zola</a> {{ macros_translate::translate(key="powered_by_and", default="and", language_strings=language_strings) }} <a class="link" href="https://daudix.codeberg.page/duckquill">Duckquill</a>
</small>
</p>
{%- endif -%}
{%- endif %}
{%- if config.extra.footer.socials -%}
{%- if config.extra.footer.socials %}
<ul id="socials">
{%- for link in config.extra.footer.socials -%}
{%- for link in config.extra.footer.socials %}
<li>
<a href="{{ link.url | safe }}" rel="me" title="{{ link.name }}">
<i class="icon" style='mask-image: url("data:image/svg+xml,{{ link.icon }}"); -webkit-mask-image: url("data:image/svg+xml,{{ link.icon }}")'></i>
<span>{{ link.name }}</span>
</a>
</li>
{%- endfor -%}
{%- endfor %}
</ul>
{%- endif -%}
{%- endif %}
</footer>

View File

@ -17,21 +17,21 @@
{%- endif %}
{%- endif %}
{%- set stylesheets = [ "style.css" ] %}
{%- set stylesheets = [ "style.css" ] %}
{%- if config.extra.stylesheets %}
{%- set stylesheets = stylesheets | concat(with=config.extra.stylesheets) %}
{%- endif %}
{%- if config.extra.stylesheets %}
{%- set stylesheets = stylesheets | concat(with=config.extra.stylesheets) %}
{%- endif %}
{%- if page.extra.stylesheets -%}
{%- set stylesheets = stylesheets | concat(with=page.extra.stylesheets) %}
{%- if page.extra.stylesheets %}
{%- set stylesheets = stylesheets | concat(with=page.extra.stylesheets) %}
{%- elif section.extra.stylesheets %}
{%- set stylesheets = stylesheets | concat(with=section.extra.stylesheets) %}
{%- endif %}
{%- set stylesheets = stylesheets | concat(with=section.extra.stylesheets) %}
{%- endif %}
{%- for stylesheet in stylesheets %}
{%- for stylesheet in stylesheets %}
<link rel="stylesheet" href="{{ get_url(path=stylesheet) | safe }}" />
{%- endfor %}
{%- endfor %}
<style type="text/css">:root {--primary-color: {{ config.extra.primary_color }}; --primary-color-alpha: {{ config.extra.primary_color_alpha }};}</style>
@ -43,22 +43,26 @@
{%- endif %}
{%- if config.extra.show_copy_button %}
{%- set scripts = [ "copy-button.js" ] %}
{%- include "partials/copy_button.html" %}
{%- endif %}
{%- if config.extra.scripts %}
{%- set scripts = scripts | concat(with=config.extra.scripts) %}
{%- endif %}
{%- set scripts = [] %}
{%- if page.extra.scripts %}
{%- set scripts = scripts | concat(with=page.extra.scripts) %}
{%- if config.extra.scripts %}
{%- set scripts = config.extra.scripts %}
{%- endif %}
{%- if page.extra.scripts %}
{%- set scripts = scripts | concat(with=page.extra.scripts) %}
{%- elif section.extra.scripts %}
{%- set scripts = scripts | concat(with=section.extra.scripts) %}
{%- endif %}
{%- set scripts = scripts | concat(with=section.extra.scripts) %}
{%- endif %}
{%- for script in scripts %}
<script src="{{ get_url(path=script) | safe }}"></script>
{%- endfor %}
{%- if scripts | length > 0 %}
{%- for script in scripts %}
<script src="{{ get_url(path=script) | safe }}"></script>
{%- endfor %}
{%- endif %}
{%- if config.extra.comments %}
<link rel="me" href="https://{{ config.extra.comments.host }}/@{{ config.extra.comments.user }}" />

View File

@ -1,3 +1,5 @@
{#- Based on https://github.com/welpo/tabi/blob/main/templates/partials/language_switcher.html -#}
<li id="dropdown">
<details>
<summary>

View File

@ -12,8 +12,8 @@
{{ config.title }}
</a>
</li>
{%- for link in config.extra.nav.links -%}
{%- if link.url is matching('https?://') -%}
{%- for link in config.extra.nav.links %}
{%- if link.url is matching('https?://') %}
<li>
<a href="{{ link.url }}"
{%- if current_url | default(value='/') | trim_end_matches(pat='/') | safe == link.url | trim_end_matches(pat='/') | safe -%}
@ -22,7 +22,7 @@
{{ macros_translate::translate(key=link.name, default=link.name, language_strings=language_strings) }}
</a>
</li>
{%- else -%}
{%- else %}
<li>
<a href="{{ get_url(path=link.url, lang=lang)}}"
{%- if current_url | default(value='/') | trim_end_matches(pat='/') | safe == get_url(path=link.url, lang=lang) | trim_end_matches(pat='/') | safe -%}
@ -31,12 +31,12 @@
{{ macros_translate::translate(key=link.name, default=link.name, language_strings=language_strings) }}
</a>
</li>
{%- endif -%}
{%- endif %}
{%- endfor -%}
{%- if config.languages | length > 0 -%}
{%- include "partials/language_switcher.html" -%}
{%- if config.languages | length > 0 %}
{%- include "partials/language_switcher.html" %}
{%- endif -%}
{%- if config.generate_feed and config.extra.nav.show_feed -%}
{%- if config.generate_feed and config.extra.nav.show_feed %}
<li id="feed">
<a href="{{ get_url(path=config.feed_filename) }}">
<i class="icon"></i>
@ -45,7 +45,7 @@
</span>
</a>
</li>
{%- endif -%}
{%- endif %}
</ul>
</nav>
</header>

View File

@ -6,6 +6,7 @@
<small>{{ macros_translate::translate(key="tags", number=number_of_tags, default="$NUMBER tags", language_strings=language_strings) }}
</small>
<br />
<br />
<ul class="tags">
{%- for tag in terms -%}
<li><a href="{{ get_taxonomy_url(kind='tags', name=tag.name, lang=lang) }}"><span class="tag">{{ tag.name }}</span><span class="count">{{ tag.pages | length }}</span></a></li>

View File

@ -15,49 +15,55 @@
</small>
<div id="article-list">
{%- for page in term.pages -%}
<article {% if page.draft %}class="draft"{% endif %}>
{%- for page in term.pages %}
<article class="
{% if page.draft %}draft{% endif %}
{% if page.extra.archive %}archive{% endif %}
{% if page.extra.featured %}featured{% endif %}">
<h3><a href="{{ page.permalink | safe }}">{{ page.title }}</a></h3>
{%- if page.draft -%}
{%- if page.draft %}
<span class="draft-badge">
<i class="icon"></i>
{{ macros_translate::translate(key="drafted", default="Drafted", language_strings=language_strings) }}
</span>
{%- endif -%}
{%- if page.extra.archive -%}
{%- if page.extra.archive %}
<span class="archive-badge">
<i class="icon"></i>
{{ macros_translate::translate(key="archived", default="Archived", language_strings=language_strings) }}
</span>
{%- endif -%}
{%- endif %}
{%- if page.extra.featured %}
<span class="featured-badge">
<i class="icon"></i>
{{ macros_translate::translate(key="featured", default="Featured", language_strings=language_strings) }}
</span>
{%- endif %}
{%- if page.description %}
{{ page.description | markdown | safe }}
{%- endif -%}
{%- if page.date -%}
{%- endif %}
{%- if page.date %}
<small>
<time datetime="{{ page.date | date(format='%+') }}" pubdate>
{{- page.date | date(format=date_format, locale=date_locale) -}}
{{ page.date | date(format=date_format, locale=date_locale) }}
</time>
{%- if page.authors -%}
{%- if page.authors %}
<span></span>
<span>
{{ macros_translate::translate(key="author", default="Author", language_strings=language_strings) }}: {{ page.authors[0] }}
</span>
{%- endif -%}
{%- if page.taxonomies -%}
{%- for name, taxon in page.taxonomies -%}
<span></span>
<ul class="tags">
{%-for item in taxon -%}
<span>{{ macros_translate::translate(key="author", default="Author", language_strings=language_strings) }}: {{ page.authors[0] }}</span>
{%- endif %}
{%- if page.taxonomies %}
{%- for name, taxon in page.taxonomies %}
<ul class="tags inline">
{%-for item in taxon %}
<li><a class="tag" href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">{{ item }}</a></li>
{%- endfor -%}
{%- endfor %}
</ul>
{%- endfor -%}
{%- endif -%}
{%- endfor %}
{%- endif %}
</small>
{%- endif -%}
{%- endif %}
</article>
<hr>
{%- endfor -%}
{%- endfor %}
</div>
{% endblock content %}