first commit

This commit is contained in:
welpo
2023-02-02 15:53:54 +01:00
commit 0b117d1641
89 changed files with 1457 additions and 0 deletions

BIN
templates/.DS_Store vendored Normal file

Binary file not shown.

8
templates/404.html Normal file
View File

@@ -0,0 +1,8 @@
{% extends "page.html" %}
{% block main_content %}
<main class="centered-header">
{{ post_macros::page_header(title="404")}}
<span>not found</span>
</main>
{% endblock main_content %}

19
templates/base.html Normal file
View File

@@ -0,0 +1,19 @@
{% import "macros/macros.html" as post_macros %}
<!DOCTYPE html>
<html lang = "en">
{% include "partials/header.html" %}
<body>
{% include "partials/nav.html" %}
<div class="content">
{# Post page is the default #}
{% block main_content %}
Nothing here?!
{% endblock main_content %}
</div>
{% include "partials/footer.html" %}
</body>
</html>

35
templates/cards.html Normal file
View File

@@ -0,0 +1,35 @@
{% extends "base.html" %}
{% block main_content %}
{% if section.extra.section_path -%}
{% set section = get_section(path=section.extra.section_path) %}
{% endif -%}
{{ post_macros::page_header(title=section.title) }}
<main>
{%- if paginator %}
{%- set show_pages = paginator.pages -%}
{% else %}
{%- set show_pages = section.pages -%}
{% endif -%}
{{ post_macros::cards_posts(pages=show_pages) }}
</main>
{% if paginator %}
<ul class="pagination">
{% if paginator.previous %}
<span class="page-item page-prev">
<a href={{ paginator.previous }} class="page-link" aria-label="Previous"><span aria-hidden="true">← Prev</span></a>
</span>
{% endif %}
{% if paginator.next %}
<span class="page-item page-next">
<a href={{ paginator.next }} class="page-link" aria-label="Next"><span aria-hidden="true">Next →</span></a>
</span>
{% endif %}
</ul>
{% endif %}
{% endblock main_content %}

1
templates/index.html Normal file
View File

@@ -0,0 +1 @@
{% extends "section.html" %}

BIN
templates/macros/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,219 @@
{% macro list_posts(pages) %}
<div class="bloglist-container">
{%- for page in pages %}
<section class="bloglist-table-row">
<h3>
<a href={{ page.permalink }}>{{page.title}}</a>
</h3>
<div class="meta">
{%- if page.date %}
<time>{{ page.date | date(format="%Y-%m-%d") }}</time>
{% endif -%}
<br />
<span>{{ page.reading_time }} minute read</span>
{% if page.draft %}
<span class="draft-label">DRAFT</span>
{% endif %}
</div>
<br />
<div class="description">
{% if page.description %}
{{ page.description }}
{% elif page.summary %}
{{ page.summary | safe }}&hellip;
{% else %}
{% set hide_read_more = true %}
{% endif %}
</div>
{% if not hide_read_more %}
<a class="readmore" href={{ page.permalink }}>Read more ⟶</a>
{% endif %}
</section>
{% endfor -%}
</div>
{% endmacro list_posts %}
{% macro tags(page, short=false) %}
{%- if page.taxonomies and page.taxonomies.tags %}
<span class="post-tags-inline">
{%- if short %}
::
{%- set sep = "," -%}
{% else %}
:: tags:&nbsp;
{%- set sep = "&nbsp;" -%}
{% endif -%}
{%- for tag in page.taxonomies.tags %}
<a class="post-tag" href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}">#{{ tag }}</a>
{%- if not loop.last %}{{ sep | safe }}{% endif -%}
{% endfor -%}
</span>
{% endif -%}
{% endmacro tags %}
{% macro page_header(title) %}
<h2>
{{ title }}
</h2>
{% endmacro content %}
{% macro page_desc(desc) %}
<div id="banner-container-home">
<div id="home-banner-text">
<h1>
{{ desc.title }}
</h1>
<p id="banner-home-subtitle">{{ desc.text }}</p>
</div>
<div class="image-container-home">
<img alt="the owner" class="banner-home-img" src="{{ desc.img }}" />
</div>
</div>
{% endmacro content %}
{% macro content(page) %}
<main>
<article>
<div class="title">
{#<h1 class="title">{{ page.title }}</h1>#}
{{ post_macros::page_header(title=page.title) }}
<div class="meta">
{% if page.date %}
Posted on <time>{{ page.date | date(format="%Y-%m-%d") }}</time>
~
{% endif %}
<span> {{ page.reading_time }} minute read</span>
{% if page.draft %}
<span class="draft-label">DRAFT</span>
{% endif %}
{% if page.taxonomies and page.taxonomies.tags %}
<div class="post-tags">
<nav class="nav tags">
{% for tag in page.taxonomies.tags %}
<svg class="tags-item-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path>
<line x1="7" y1="7" x2="7.01" y2="7"></line>
</svg>
<a href={{ get_taxonomy_url(kind='tags' , name=tag) | safe }}>{{ tag }}</a>
{% endfor %}
</nav>
</div>
{% endif %}
</div>
</div>
{% if page.extra.tldr %}
<div class="tldr">
<strong>tl;dr:</strong>
{{ page.extra.tldr }}
</div>
{% endif %}
{# Optional table of contents #}
{% if config.extra.toc | default(value=false) %}
{% if page.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>
</li>
{% if h2.children %}
<ul>
{% for h3 in h2.children %}
<li>
<a href="{{ h3.permalink | safe }}">{{ h3.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
<section class="body">
{{ page.content | safe }}
</section>
</article>
</main>
{% endmacro content %}
{% macro cards_posts(pages) %}
<div class="cards">
{%- for page in pages %}
<div class="card">
{% if page.extra.local_image %}
<img class="card-image" alt={{ page.extra.local_image }} src="{{ get_url(path=page.extra.local_image) }}">
{% elif page.extra.remote_image %}
<img class="card-image" alt={{ page.extra.remote_image }} src="{{ page.extra.remote_image }}">
{% else %}
<div class="card-image-placeholder"></div>
{% endif %}
<div class="card-info">
<h1 class="card-title">
{% if page.extra.link_to %}
<a rel="noopener noreferrer" target="_blank" href={{ page.extra.link_to }}>{{page.title}}</a>
{% else %}
<a href={{ page.permalink }}>{{page.title}}</a>
{% endif %}
</h1>
<div class="meta">
{%- if page.date %}
<time>{{ page.date | date(format="%Y-%m-%d") }}</time>
{% endif -%}
{% if page.draft %}
<span class="draft-label">DRAFT</span>
{% endif %}
</div>
<div class="card-description">
{% if page.description %}
{{ page.description }}
{% endif %}
</div>
</div>
</div>
{% endfor -%}
</div>
{% endmacro cards_posts %}
{% macro list_title(pages, tag_name=false) %}
{% if tag_name %}
<h1>Entries tagged - "{{ term.name }}"</h1>
{% else %}
<h1 class="page-title">All articles</h1>
{% endif %}
<ul class="posts">
{% for page in pages %}
<li class="post">
<a href="{{ page.permalink }}">{{ page.title }}</a>
<span class="meta">{{ page.date | date(format="%Y-%m-%d") }}</span>
</li>
{% endfor %}
</ul>
{% endmacro list_title %}

5
templates/page.html Normal file
View File

@@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block main_content %}
{{ post_macros::content(page=page)}}
{% endblock main_content %}

View File

@@ -0,0 +1,14 @@
<footer>
<section>
<nav class="socials nav-navs">
{%- if config.extra.socials %}
{% for social in config.extra.socials %}
<a rel="noopener noreferrer" target="_blank" class="nav-links social" href="{{ social.url }}">
<img alt={{ social.name }} title={{ social.name }} src="/social_icons/{{ social.icon }}.svg">
</a>
{% endfor %}
{% endif %}
</nav>
</section>
<script src="{{ get_url(path='js/main.js', trailing_slash=false) | safe }}"/></script>
</footer>

View File

@@ -0,0 +1,65 @@
{% import "macros/macros.html" as post_macros %}
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{# Site title #}
{% set current_path = current_path | default(value="/") %}
{% if current_path == "/" %}
<title>
{{ config.title | default(value="Home") }}
</title>
{% else %}
<title>
{{ page.title | default(value=config.title) | default(value="Post") }}
</title>
{% endif %}
{# Favicon #}
{% if config.extra.favicon %}
<link rel="icon" type="image/png" href={{ config.extra.favicon }} />
{% endif %}
{# RSS #}
<link rel="alternate" type="application/atom+xml" title="{{ config.title }}" href="{{ get_url(path=" atom.xml",
trailing_slash=false) }}">
<link rel="stylesheet" type="text/css" media="screen" href={{ get_url(path="main.css" ) }} />
{% if config.extra.stylesheets %}
{% for stylesheet in config.extra.stylesheets %}
<link rel="stylesheet" href="{{ get_url(path=stylesheet) }}">
{% endfor %}
{% endif %}
<meta name="description" content="{{ config.description }}">
<meta name="description" content="{{ config.description }}">
{% if is_404 %}
<meta name="robots" content="noindex, follow">
{% else %}
<meta name="robots" content="index, nofollow">
{% endif %}
<meta property="og:title" content="{{ config.title }}">
<meta property="og:type" content="article" />
{% if config.extra.headerImage %}
<meta property="og:image" content="{{ config.extra.headerImage }}">
<meta name="twitter:card" content="{{ config.extra.headerImage }}">
{% endif %}
{% set current_url = current_url | default(value="/") %}
<meta property="og:url" content="{{ current_url }}">
<meta property="og:description" content="{{ config.description }}">
<meta property="og:site_name" content="{{ config.title }}">
<meta http-equiv="Content-Security-Policy"
content="default-src 'self' ws://127.0.0.1:1024/; img-src 'self' https://*; script-src 'self'; style-src 'self'; font-src 'self'" />
</head>

View File

@@ -0,0 +1,26 @@
<header>
<nav class="navbar">
<div class="nav-title">
<a class="home-title" href={{ config.base_url }}>{{ config.title }}</a>
</div>
{%- if config.extra.menu %}
<div class="nav-navs">
<div>
{% for menu in config.extra.menu %}
<a class="nav-links" href={{ menu.url }}>
{{ menu.name }}</a>
{% endfor %}
</div>
<label class="theme-switcher" for="themeswitch">
<input type="checkbox" id="themeswitch">
<div class="switch">
<img alt="theme switch to light" class="moon" src="/menu_icon/moon.png">
<img alt="theme switch to dark" class="sun" src="/menu_icon/sun.png">
</div>
</label>
</div>
{% endif %}
</nav>
</header>

40
templates/section.html Normal file
View File

@@ -0,0 +1,40 @@
{% extends "base.html" %}
{% block main_content %}
{% if section.extra.section_path -%}
{% set section = get_section(path=section.extra.section_path) %}
{% endif -%}
{%- if section.extra.desc %}
{{ post_macros::page_desc(desc=section.extra.desc) }}
{% endif -%}
<main class="list">
<div class="title-container">
{{ post_macros::page_header(title=section.title) }}
</div>
{%- if paginator %}
{%- set show_pages = paginator.pages -%}
{% else %}
{%- set show_pages = section.pages -%}
{% endif -%}
{{ post_macros::list_posts(pages=show_pages) }}
</main>
{% if paginator %}
<ul class="pagination">
{% if paginator.previous %}
<span class="page-item page-prev">
<a href={{ paginator.previous }} class="page-link" aria-label="Previous"><span aria-hidden="true">← Prev</span></a>
</span>
{% endif %}
{% if paginator.next %}
<span class="page-item page-next">
<a href={{ paginator.next }} class="page-link" aria-label="Next"><span aria-hidden="true">Next →</span></a>
</span>
{% endif %}
</ul>
{% endif %}
{% endblock main_content %}

22
templates/tags/list.html Normal file
View File

@@ -0,0 +1,22 @@
{% extends "index.html" %}
{% block main_content %}
<h1 class="page-title">Tags</h1>
<div class="tag-cloud">
<ul class="tags">
{% for term in terms %}
<div class="tags-item" id="{{ term.name }}">
<svg class="tags-item-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path>
<line x1="7" y1="7" x2="7.01" y2="7"></line>
</svg></div>
<a href="{{ term.permalink | safe }}">
{{ term.name }} ({{ term.pages | length }} post{{ term.pages | length | pluralize }})
</a>
{% endfor %}
</ul>
</div>
{% endblock main_content %}

View File

@@ -0,0 +1,7 @@
{% extends "index.html" %}
{% block main_content %}
{{ post_macros::list_title(pages=term.pages, tag_name=term.name) }}
{% endblock main_content %}