Zola init

This commit is contained in:
2023-08-25 11:47:55 +03:00
commit bfe5a8b037
96 changed files with 6639 additions and 0 deletions

51
templates/index.html Normal file
View File

@ -0,0 +1,51 @@
{% import "macros/macros.html" as post_macros %}
<!DOCTYPE html>
<html lang="{{lang}}">
{% include "partials/header.html" %}
<body>
<div class="content">
{% include "partials/head.html" %}
{% block main_content %}
<main class="list">
<div class="site-description">
{% if config.description %}
{{ config.description | markdown | safe }}
{% endif %}
</div>
{%- if paginator %}
{%- set show_pages = paginator.pages -%}
{% else %}
{% set section = get_section(path="posts/_index.md") %}
{%- set show_pages = section.pages -%}
{% endif -%}
{{ post_macros::list_posts(pages=show_pages, extra=config.extra) }}
</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">{{ config.extra.translations[lang][0].previous_page }}</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">{{ config.extra.translations[lang][0].next_page }}</span></a>
</span>
{% endif %}
</ul>
{% endif %}
{% endblock main_content %}
{% include "partials/footer.html" %}
</div>
</body>
</html>

View File

@ -0,0 +1,117 @@
{% 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 %}
{% macro list_posts(pages, extra) %}
<ul>
{%- for page in pages %}
{%- if page.draft %}
{% continue %}
{% endif -%}
<section class="list-item">
<h1 class="title">
<a href={{ page.permalink }}>{{page.title}}</a>
</h1>
<time>{{ page.date | date(format="%Y-%m-%d") }}</time>
<span>| {{ page.reading_time }} {{ config.extra.translations[lang][0].read_time }}</span>
{% if page.extra.author %}
<span>| {{extra.translations[lang][0].posted_by }} <a href="{{ page.extra.author.social }}" target="_blank">{{ page.extra.author.name }}</a></span>
{% endif %}
<br />
<div class="description">
{% if page.description %}
{{ page.description }}
{% elif page.summary %}
{{ page.summary }}&hellip;
{% else %}
{% set hide_read_more = true %}
{% endif %}
</div>
{% if not hide_read_more %}
<a class="readmore" href={{ page.permalink }}>{{ extra.translations[lang][0].show_more }}</a>
{% endif %}
</section>
{% endfor -%}
</ul>
{% 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 content(page, extra) %}
<main>
<article>
<div class="title">
<h1 class="title">{{ page.title }}</h1>
<div class="meta">
{% if page.extra.author %}
{{extra.translations[lang][0].posted_by }} <a href="{{ page.extra.author.social }}" target="_blank">{{ page.extra.author.name }}</a>
{% endif %}
{{ extra.translations[lang][0].posted_on }} {{ page.date | date(format="%Y-%m-%d") }}
{% if page.draft %}
<span class="draft-label">DRAFT</span>
{% endif %}
</div>
</div>
{% if page.extra.tldr %}
<div class="tldr">
<strong>tl;dr:</strong>
{{ page.extra.tldr }}
</div>
{% endif %}
<section class="body">
{{ page.content | safe }}
</section>
{% if page.taxonomies and page.taxonomies.tags %}
<div class="post-tags">
<nav class="nav tags">
<ul class="tags">
{% for tag in page.taxonomies.tags %}
<li><a href={{ get_taxonomy_url(kind='tags', name=tag) | safe }}>{{ tag }}</a></li>
{% endfor %}
</ul>
</nav>
</div>
{% endif %}
</article>
</main>
{% endmacro content %}

5
templates/page.html Normal file
View File

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

View File

@ -0,0 +1,19 @@
<footer>
<div style="display:flex">
{% for social in config.extra.social %}
<a class="soc" href={{ social.url }} title={{ social.name }}>
<i data-feather={{ social.icon }}></i>
</a>
{% endfor %}
</div>
<div class="footer-info">
{{ now() | date(format="%Y") }} © {{ config.extra.copyright }} |Powered by <a href="https://github.com/getzola/zola">Zola</a> and <a
href="https://github.com/XXXMrG/archie-zola">Archie-Zola Theme</a>
</div>
</footer>
{% if config.extra.social %}
<script>
feather.replace();
</script>
{% endif %}

View File

@ -0,0 +1,24 @@
<header>
<div class="main" id="main_title">
<a href={{ config.base_url }}>{{ config.title }}</a>
</div>
<nav>
{% for menu in config.extra.translations[lang][0].menus %}
<a href={{ menu.url }}>{{ menu.name }}</a>
{% endfor %}
{% if config.extra.translations.languages %}
|
{% for language in config.extra.translations.languages %}
<a href={{ language.url }}>{{ language.name }}</a>
{% endfor %}
{% endif %}
{% if config.extra.mode == "toggle" %}
| <a id="dark-mode-toggle" onclick="toggleTheme()" href=""></a>
<script src={{ get_url(path="js/themetoggle.js") }}></script>
{% endif %}
</nav>
</header>

View File

@ -0,0 +1,117 @@
{% 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">
{% if page.extra.meta %}
<!-- the meta data config goes here -->
{% for data in page.extra.meta %}
<meta
{% for key, value in data%}
{% if key == "property" and value == "og:title"%}
{% set_global page_has_og_title = true -%}
{% endif %}
{% if key == "property" and value == "og:description"%}
{% set_global page_has_og_description = true -%}
{% endif %}
{% if key == "name" and value == "description"%}
{% set_global page_has_description = true -%}
{% endif %}
{{ key }}="{{ value }}"
{% endfor %}
/>
{% endfor %}
{% endif %}
{% if current_path == "/" %}
<title>
{{ config.title | default(value="Home") }}
</title>
{% if not page_has_og_title %}
<meta property="og:title" content="{{ config.title | default(value="Home") }}" />
{% endif %}
{% else %}
<title>
{% if page.title %} {{ page.title }}
{% elif config.title %} {{ config.title }}
{% else %} Post {% endif %}
</title>
{% if not page_has_og_title %}
<meta property="og:title" content="{% if page.title -%}{{ page.title }}{% elif config.title -%}{{ config.title }}{% else -%}Post{% endif -%}" />
{% endif %}
{% endif %}
{% if not page_has_og_description %}
{% if page.description %}
<meta property="og:description" content="{{ page.description }}" />
{% elif config.description %}
<meta property="og:description" content="{{ config.description }}" />
{% endif %}
{% endif %}
{% if not page_has_description %}
{% if page.description %}
<meta name="description" content="{{ page.description }}" />
{% elif config.description %}
<meta name="description" content="{{ config.description }}" />
{% endif %}
{% endif %}
{% if config.extra.favicon %}
<link rel="icon" type="image/png" href={{ config.extra.favicon }} />
{% endif %}
{# opengraph, twitter_cards #}
{% if config.extra.ga %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{config.extra.ga}}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{config.extra.ga}}');
</script>
{% endif %}
{# if need icon, load feather.js #}
{% if config.extra.social and config.extra.useCDN | default(value=false) %}
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
{% elif config.extra.social or config.extra.mode == "toggle" %}
<script src={{ get_url(path="js/feather.min.js") }}></script>
{% endif %}
{% if config.extra.useCDN | default(value=false) %}
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@1,500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
{% else %}
<link href={{ get_url(path="css/fonts.css") }} rel="stylesheet" />
{% endif %}
<link rel="stylesheet" type="text/css" media="screen" href={{ get_url(path="css/main.css") }} />
{% if config.extra.mode == "auto" or config.extra.mode == "dark" or config.extra.mode == "toggle" %}
<link
rel="stylesheet"
id="darkModeStyle"
type="text/css"
href={{ get_url(path="css/dark.css") }}
{% if config.extra.mode == "auto" %}
media="(prefers-color-scheme: dark)"
{% endif %}
{% if config.extra.mode == "toggle" %}
disabled
{% endif %}
/>
{% endif %}
{# TODO: custom css and js. #}
</head>

6
templates/posts.html Normal file
View File

@ -0,0 +1,6 @@
{% extends "index.html" %}
{% block main_content %}
{% set section = get_section(path="posts/_index.md") %}
{{ post_macros::list_title(pages=section.pages) }}
{% endblock main_content %}

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

@ -0,0 +1,19 @@
{% extends "index.html" %}
{% block main_content %}
<h1 class="page-title">{{ config.extra.translations[lang][0].all_tags }}</h1>
<div class="tag-cloud">
<ul class="tags">
{% for term in terms %}
<li>
<a href="{{ term.permalink | safe }}">
{{ term.name }} ({{ term.pages | length }} post{{ term.pages | length | pluralize }})
</a>
</li>
{% 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 %}