first commit
This commit is contained in:
3
themes/terminimal/templates/macros/date.html
Normal file
3
themes/terminimal/templates/macros/date.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{% macro now_year() %}
|
||||
{{ now() | date(format="%Y") }}
|
||||
{% endmacro %}
|
26
themes/terminimal/templates/macros/head.html
Normal file
26
themes/terminimal/templates/macros/head.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% macro head(config) %}
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
||||
<meta name="robots" content="noodp"/>
|
||||
|
||||
<link rel="stylesheet" href="{{ get_url(path="style.css", trailing_slash=false) | safe }}">
|
||||
|
||||
{%- if config.extra.accent_color %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="color/" ~ config.extra.accent_color ~ ".css", trailing_slash=false) | safe }}">
|
||||
{% else %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="color/blue.css", trailing_slash=false) | safe }}">
|
||||
{% endif -%}
|
||||
|
||||
{%- if config.extra.background_color %}
|
||||
{%- if config.extra.accent_color and config.extra.background_color != config.extra.accent_color %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="color/background_" ~ config.extra.background_color ~ ".css", trailing_slash=false) | safe }}">
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
|
||||
{%- if config.extra.use_full_hack_font %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="font-hack.css", trailing_slash=false) | safe }}">
|
||||
{% else %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="font-hack-subset.css", trailing_slash=false) | safe }}">
|
||||
{% endif -%}
|
||||
|
||||
{% endmacro head %}
|
52
themes/terminimal/templates/macros/menu.html
Normal file
52
themes/terminimal/templates/macros/menu.html
Normal file
@@ -0,0 +1,52 @@
|
||||
{% macro menu(config, current_path) %}
|
||||
{%- set current_item = false -%}
|
||||
{%- if config.extra.menu_items %}
|
||||
{%- set menu_items = config.extra.menu_items -%}
|
||||
|
||||
{%- for item in menu_items %}
|
||||
{%- set abs_item_url = item.url | replace(from="$BASE_URL", to=config.base_url) -%}
|
||||
{%- set is_current = current_url == abs_item_url ~ "/"
|
||||
or current_url is starting_with(abs_item_url)
|
||||
-%}
|
||||
{%- set is_base = abs_item_url == config.base_url
|
||||
or abs_item_url == config.base_url ~ "/"
|
||||
-%}
|
||||
|
||||
{%- if is_base %}
|
||||
{%- set_global base_item = item -%}
|
||||
{% endif -%}
|
||||
|
||||
{%- if is_current and not is_base %}
|
||||
{%- set_global current_item = item -%}
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
|
||||
{%- if not current_item and base_item %}
|
||||
{# Did not match any menu URLs -- assume it's a blog post #}
|
||||
{%- set current_item = base_item -%}
|
||||
{% endif -%}
|
||||
|
||||
{{ menu_macros::menu_for(config=config, current_item=current_item) }}
|
||||
{% endif -%}
|
||||
{% endmacro menu %}
|
||||
|
||||
{% macro menu_for(config, current_item) %}
|
||||
{%- if config.extra.menu_items %}
|
||||
{%- set menu_items = config.extra.menu_items -%}
|
||||
|
||||
<nav class="menu">
|
||||
<ul class="menu__inner">
|
||||
{%- for item in menu_items %}
|
||||
<li {%- if current_item and current_item == item %} class="active" {%- endif %}>
|
||||
{%- if item.newtab -%}
|
||||
<a href="{{ item.url | replace(from="$BASE_URL", to=config.base_url) | safe }}" target="_blank" rel="noopener noreferrer">{{ item.name | safe }}</a>
|
||||
{%- else -%}
|
||||
<a href="{{ item.url | replace(from="$BASE_URL", to=config.base_url) | safe }}">{{ item.name | safe }}</a>
|
||||
{%- endif -%}
|
||||
</li>
|
||||
{% endfor -%}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif -%}
|
||||
{% endmacro menu %}
|
||||
|
103
themes/terminimal/templates/macros/post.html
Normal file
103
themes/terminimal/templates/macros/post.html
Normal file
@@ -0,0 +1,103 @@
|
||||
{% macro content(page, summary) %}
|
||||
{%- if summary and page.summary %}
|
||||
<div class="post-content">
|
||||
{{ page.summary | safe }}
|
||||
</div>
|
||||
<div>
|
||||
<!-- ︎ -- force text style - some devices render this as emoji -->
|
||||
<a class="read-more button" href="{{ page.permalink | safe }}">
|
||||
<span class="button__text">La suite</span>
|
||||
<span class="button__icon">↩︎</span>
|
||||
</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="post-content">
|
||||
{{ page.content | safe }}
|
||||
</div>
|
||||
{%- endif %}
|
||||
{% endmacro content %}
|
||||
|
||||
|
||||
{% macro date(page) %}
|
||||
<span class="post-date">
|
||||
{%- if page.date %}
|
||||
{{ page.date | date(format="%Y-%m-%d") }}
|
||||
{% endif -%}
|
||||
</span>
|
||||
{% endmacro post_date %}
|
||||
|
||||
|
||||
{% macro earlier_later(page) %}
|
||||
{%- if config.extra.enable_post_view_navigation and page.lower or page.higher %}
|
||||
<div class="pagination">
|
||||
<div class="pagination__title">
|
||||
<span class="pagination__title-h">{{ config.extra.post_view_navigation_prompt }}</span>
|
||||
<hr />
|
||||
</div>
|
||||
<div class="pagination__buttons">
|
||||
{%- if page.higher %}
|
||||
<span class="button previous">
|
||||
<a href="{{ page.higher.permalink | safe }}">
|
||||
<span class="button__icon">←</span>
|
||||
<span class="button__text">{{ page.higher.title }}</span>
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if page.lower %}
|
||||
<span class="button next">
|
||||
<a href="{{ page.lower.permalink | safe }}">
|
||||
<span class="button__text">{{ page.lower.title }}</span>
|
||||
<span class="button__icon">→</span>
|
||||
</a>
|
||||
</span>
|
||||
{% endif -%}
|
||||
</div>
|
||||
</div>
|
||||
{% endif -%}
|
||||
{% endmacro earlier_later %}
|
||||
|
||||
|
||||
{% macro header(page) %}
|
||||
<h1 class="post-title"><a href="{{ page.permalink | safe }}">{{ page.title }}</a></h1>
|
||||
<div class="post-meta-inline">
|
||||
{{ post_macros::date(page=page) }}
|
||||
</div>
|
||||
|
||||
{{ post_macros::tags(page=page) }}
|
||||
{% endmacro header %}
|
||||
|
||||
|
||||
{% macro list_posts(pages) %}
|
||||
<ul>
|
||||
{%- for page in pages %}
|
||||
{%- if page.draft %}
|
||||
{% continue %}
|
||||
{% endif -%}
|
||||
<li class="post-list">
|
||||
<a href="{{ page.permalink | safe }}">
|
||||
<span class="post-date">{{ page.date }}</span>
|
||||
:: <span class="post-list-title">{{ page.title }}</span></a>
|
||||
{{ post_macros::tags(page=page, short=true) }}
|
||||
</li>
|
||||
{% 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:
|
||||
{%- set sep = " " -%}
|
||||
{% 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 %}
|
Reference in New Issue
Block a user