Compare commits

..

No commits in common. "master" and "1.1.0" have entirely different histories.

11 changed files with 51 additions and 172 deletions

View file

@ -8,9 +8,7 @@
See the live demo (of the default configuration) here:
https://pawroman.github.io/zola-theme-terminimal/
Tested with Zola v0.19.2.
Please note that earlier (and older) versions might not work because of breaking changes across Zola versions.
Tested with Zola v0.17.2. Please note that earlier versions might not work because of breaking changes across Zola versions.
#### Fork disclaimer
@ -88,7 +86,7 @@ Example:
Same as `image`, but with a few extra optional arguments:
- **`caption`** (supports markdown)
- **`caption`**
- **`caption_position`** (center \[default\] | left | right)
- **`caption_style`**
@ -99,44 +97,12 @@ Example:
style="width: 25%;",
position="right",
caption_position="left",
caption="**Ferris**, the (unofficial) Rust mascot",
caption_style="font-style: italic;") }}
```
## OpenGraph
To add an image to a post, set the `og_image` extra option to the desired image
in the same directory of the markdown file:
```toml
[extra]
og_image = "colocated_image.png"
```
Additionally, for the section pages and for posts to have a fallback image, add
`default_og_image` to the `[extra]` section:
```toml
[extra]
default_og_image = "static/ocean.jpg"
caption="Ferris, the (unofficial) Rust mascot",
caption_style="font-weight: bold; font-style: italic;") }}
```
## Configuration
### Only show the post's description
On each post you can specify the following:
```toml
description = "test description"
[extra]
show_only_description = true
```
This will render `test description` under this
particular post on the homepage instead of a summary.
### Colors
Both the accent colors and background colors are
@ -392,7 +358,7 @@ This theme has been forked from https://github.com/panr/hugo-theme-terminal
- Prism.js syntax highlighting is not supported (you can use
[Zola's](https://www.getzola.org/documentation/content/syntax-highlighting/)).
- All references to social media (e.g. Twitter) have been removed.
- All references to social media (e.g. Twitter, OpenGraph) have been removed.
- All references to external URLs (e.g. Google CDN) have been removed.
This theme's static assets are meant to be served from where it's hosted.

View file

@ -6,10 +6,10 @@ title = "Zola Terminimal theme"
compile_sass = true
# The theme supports feeds (RSS and ATOM)
generate_feeds = true
generate_feed = true
# Use `rss.xml` for RSS feeds and `atom.xml` for ATOM.
feed_filenames = ["rss.xml", "atom.xml"]
feed_filename = "atom.xml"
# Optional: enable tags
taxonomies = [
@ -96,8 +96,3 @@ use_full_hack_font = false
#
# Note that the main (index) page only has the main title.
page_titles = "main_only"
# Optional: default image to use for OpenGraph.
# If the page doesnt set og_image, use this one as fallback. Usefull
# for indexes and taxonomies' pages.
#default_og_image = "static/ocean.jpg"

View file

@ -77,7 +77,7 @@ figure(src="http://rustacean.net/assets/rustacean-flat-gesture.png",
style="width: 25%;",
position="center",
caption_position="left",
caption="**Ferris**, the (unofficial) Rust mascot",
caption="Ferris, the (unofficial) Rust mascot",
caption_style="font-weight: bold; font-style: italic;")
```
@ -85,8 +85,8 @@ figure(src="http://rustacean.net/assets/rustacean-flat-gesture.png",
style="width: 25%;",
position="center",
caption_position="left",
caption="**Ferris**, the (unofficial) Rust mascot",
caption_style="font-style: italic;") }}
caption="Ferris, the (unofficial) Rust mascot",
caption_style="font-weight: bold; font-style: italic;") }}
---

View file

@ -1,7 +1,7 @@
{% extends "index.html" %}
{% block title %}
404 | {{ config.title }}
404
{% endblock title %}
{% block header_menu %}

View file

@ -11,20 +11,14 @@
<title>{%- block title %}{{ config.title }}{% endblock title -%}</title>
{{ head_macros::head(config=config) }}
{%- block open_graph %}{{ head_macros::open_graph(config=config) }}{% endblock open_graph -%}
{%- if config.generate_feeds %}
{%- for feed in config.feed_filenames %}
{%- if feed is containing('atom') %}
<link rel="alternate" type="application/atom+xml" title="{{ config.title }} Atom Feed" href="{{ get_url(path=feed, trailing_slash=false, lang=lang) | safe }}" />
{%- endif %}
{%- if feed is containing('rss') %}
<link rel="alternate" type="application/rss+xml" title="{{ config.title }} RSS Feed" href="{{ get_url(path=feed, trailing_slash=false, lang=lang) | safe }}" />
{%- endif %}
{%- endfor %}
{%- endif -%}
{%- if config.generate_feed %}
{%- if "rss" in config.feed_filename %}
{% set feed_type = 'rss+xml' %}
{%- else %}
{% set feed_type = 'atom+xml' %}
{% endif -%}
<link rel="alternate" type="application/{{ feed_type }}" title="RSS" href="{{ get_url(path=config.feed_filename) | safe }}">
{% endif -%}
{%- if config.extra.favicon %}
<link rel="shortcut icon" type="{{ config.extra.favicon_mimetype | default(value="image/x-icon") | safe }}" href="{{ config.extra.favicon | safe }}">
@ -77,8 +71,7 @@
{%- for page in show_pages %}
<div class="post on-list">
{{ post_macros::header(page=page) }}
{{ post_macros::content(page=page, summary=true, show_only_description=page.extra.show_only_description | default(value=false)) }}
{{ post_macros::content(page=page, summary=true) }}
</div>
{% endfor -%}
<div class="pagination">

View file

@ -1,5 +1,3 @@
{% import "macros/title.html" as title_macros -%}
{% 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">
@ -26,69 +24,3 @@
{% endif -%}
{% endmacro head %}
{# Extra Meta tags for OpenGraph and Twitter cards #}
{% macro open_graph(config) %}
{%- if page %}
{%- set permalink = page.permalink %}
{%- set title = title_macros::title(page_title=page.title, main_title=config.title) %}
{%- set description = page.description %}
{%- set type = "article" %}
{%- if page.extra and page.extra.og_image %}
{%- if page.colocated_path %}
{%- set og_image = page.path ~ page.extra.og_image %}
{%- else %}
{%- set og_image = page.extra.og_image %}
{% endif %}
{%- elif config.extra.default_og_image %}
{%- set og_image = config.extra.default_og_image %}
{%- endif %}
{%- elif section %}
{%- set permalink = section.permalink %}
{%- set title = title_macros::title(page_title=section.title, main_title=config.title) %}
{%- set description = section.description | default(value=config.description) %}
{%- set type = "website" %}
{%- if section.extra and section.extra.og_image %}
{%- set og_image = section.extra.og_image %}
{%- elif config.extra.default_og_image %}
{%- set og_image = config.extra.default_og_image %}
{%- endif %}
{%- else %}
{# For 404 and taxonomy pages #}
{%- if taxonomy %}
{% if term %}
{%- set permalink = term.permalink %}
{%- set title = title_macros::title(page_title=term.name, main_title=config.title) %}
{%- set description = "All posts tagged " ~ term.name %}
{% else %}
{%- set permalink = config.base_url ~ "/" ~ taxonomy.slug %}
{%- set title = title_macros::title(page_title=taxonomy.name, main_title=config.title) %}
{%- set description = "All " ~ taxonomy.name %}
{% endif %}
{%- else %}
{%- set permalink = config.base_url %}
{%- set title = title_macros::title(page_title="404", main_title=config.title) %}
{%- set description = "Page not found" %}
{%- endif %}
{%- set type = "website" %}
{%- if config.extra.default_og_image %}
{%- set og_image = config.extra.default_og_image %}
{%- endif %}
{%- endif -%}{# #}
<meta name="description" content="{{ description | safe }}">
<meta property="og:description" content="{{ description | safe }}">
<meta property="og:title" content="{{ title | safe }}">
<meta property="og:type" content="{{ type }}">
<meta property="og:url" content="{{ permalink | safe }}">
{% if og_image %}
<meta property="og:image" content="{{ get_url(path=og_image) }}">
<meta name="twitter:image" content="{{ get_url(path=og_image) }}">
{% endif %}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="{{ description | safe }}">
<meta name="twitter:title" content="{{ title | safe }}">
<meta property="twitter:domain" content="{{ config.base_url | replace(from="https://", to="") }}">
<meta property="twitter:url" content="{{ permalink | safe }}">
{% endmacro open_graph %}

View file

@ -1,9 +1,5 @@
{% macro content(page, summary, show_only_description) %}
{%- if show_only_description %}
<div class="post-content">
{{ page.description | safe }}
</div>
{% elif summary and page.summary %}
{% macro content(page, summary) %}
{%- if summary and page.summary %}
<div class="post-content">
{{ page.summary | safe }}
</div>
@ -15,7 +11,6 @@
</a>
</div>
{% else %}
{#- full content -#}
<div class="post-content">
{{ page.content | safe }}
</div>
@ -33,33 +28,31 @@
{% macro earlier_later(page) %}
{%- if config.extra.enable_post_view_navigation %}
{%- if 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>&nbsp;
<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>&nbsp;
<span class="button__icon"></span>
</a>
</span>
{% endif -%}
</div>
{%- 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>
{% endif -%}
<div class="pagination__buttons">
{%- if page.higher %}
<span class="button previous">
<a href="{{ page.higher.permalink | safe }}">
<span class="button__icon"></span>&nbsp;
<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>&nbsp;
<span class="button__icon"></span>
</a>
</span>
{% endif -%}
</div>
</div>
{% endif -%}
{% endmacro earlier_later %}

View file

@ -7,7 +7,7 @@
{% block content %}
<div class="post">
{{ post_macros::header(page=page) }}
{{ post_macros::content(page=page, summary=false, show_only_description=false) }}
{{ post_macros::content(page=page, summary=false) }}
{{ post_macros::earlier_later(page=page) }}
</div>
{% endblock content %}

View file

@ -1,8 +1,8 @@
{% if src %}
<figure class="{% if position %}{{ position }}{% else -%} center {%- endif %}" >
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %}{% if style %} style="{{ style }}"{% endif %} decoding="async" loading="lazy"/>
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %}{% if style %} style="{{ style }}"{% endif %} />
{% if caption %}
<figcaption class="{% if caption_position %}{{ caption_position }}{% else -%} center {%- endif %}"{% if caption_style %} style="{{ caption_style | safe }}"{% endif %}>{{ caption | markdown() | safe }}</figcaption>
<figcaption class="{% if caption_position %}{{ caption_position }}{% else -%} center {%- endif %}"{% if caption_style %} style="{{ caption_style | safe }}"{% endif %}>{{ caption }}</figcaption>
{% endif %}
</figure>
{% endif %}

View file

@ -4,5 +4,5 @@
{# ... then prepend the site's base URL to the image's URL. #}
{% set src = config.base_url ~ src %}
{% endif %}
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %} class="{% if position %}{{ position }}{% else -%} center {%- endif %}" {%- if style %} style="{{ style | safe }}" {%- endif %} decoding="async" loading="lazy"/>
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %} class="{% if position %}{{ position }}{% else -%} center {%- endif %}" {%- if style %} style="{{ style | safe }}" {%- endif %} />
{% endif %}

View file

@ -12,7 +12,7 @@
({{ term.pages | length }} post{{ term.pages | length | pluralize }})
</h1>
<a href="{{ config.base_url | safe }}/tags/">
<a href="{{ config.base_url | safe }}/tags">
Show all tags
</a>