fix for sections + move cards

This commit is contained in:
welpo 2024-11-17 23:51:24 +01:00
parent 2025b6a6f2
commit f47018c658
No known key found for this signature in database
GPG key ID: A2F978CF4EC1F5A6
26 changed files with 25 additions and 19 deletions

View file

@ -252,7 +252,7 @@ favicon_emoji = "🌱"
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
# Learn how to create these images in batch and automatically:
# https://osc.garden/blog/automating-social-media-cards-zola/
social_media_card = "social_cards/index.jpg"
social_media_card = "index.jpg"
menu = [
{ name = "blog", url = "blog", trailing_slash = true },

View file

@ -9,7 +9,7 @@ max_posts = 4
projects_path = "projects/_index.ca.md"
max_projects = 3
show_projects_first = false
social_media_card = "social_cards/ca.jpg"
social_media_card = "ca.jpg"
+++
tabi és un tema de [Zola](https://www.getzola.org) ràpid, lleuger i modern. Té com a objectiu ser una pàgina personal i llar d'entrades de blog. Compta amb una puntuació perfecta de Lighthouse, disseny responsive, tema fosc i clar, shortcodes personalitzats i molt més.

View file

@ -9,7 +9,7 @@ max_posts = 4
projects_path = "projects/_index.es.md"
max_projects = 3
show_projects_first = false
social_media_card = "social_cards/es.jpg"
social_media_card = "es.jpg"
+++
tabi es un tema de [Zola](https://www.getzola.org) rápido, ligero y moderno. Su objetivo es ser una página personal y hogar para publicaciones de blogs. Cuenta con una puntuación perfecta en Lighthouse, diseño responsive, tema oscuro y claro, shortcodes personalizados y mucho más.

View file

@ -9,7 +9,7 @@ max_posts = 4
projects_path = "projects/_index.md"
max_projects = 3
show_projects_first = false
social_media_card = "social_cards/index.jpg"
social_media_card = "index.jpg"
+++
tabi is a fast, lightweight, and modern [Zola](https://www.getzola.org) theme. It aims to be a personal page and home to blog posts. It features a perfect Lighthouse score, responsive design, dark and light themes, custom shortcodes, and much more.

View file

@ -3,5 +3,5 @@ title = "Arxiu"
template = "archive.html"
[extra]
social_media_card = "archive/social_cards/ca_archive.jpg"
social_media_card = "ca_archive.jpg"
+++

View file

@ -3,5 +3,5 @@ title = "Archivo"
template = "archive.html"
[extra]
social_media_card = "archive/social_cards/es_archive.jpg"
social_media_card = "es_archive.jpg"
+++

View file

@ -3,5 +3,5 @@ title = "Archive"
template = "archive.html"
[extra]
social_media_card = "archive/social_cards/archive.jpg"
social_media_card = "archive.jpg"
+++

View file

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Before After
Before After

View file

@ -5,6 +5,6 @@ sort_by = "date"
insert_anchor_links = "left"
[extra]
social_media_card = "blog/social_cards/ca_blog.jpg"
social_media_card = "ca_blog.jpg"
show_previous_next_article_links = true
+++

View file

@ -5,6 +5,6 @@ sort_by = "date"
insert_anchor_links = "left"
[extra]
social_media_card = "blog/social_cards/es_blog.jpg"
social_media_card = "es_blog.jpg"
show_previous_next_article_links = true
+++

View file

@ -5,6 +5,6 @@ sort_by = "date"
insert_anchor_links = "left"
[extra]
social_media_card = "blog/social_cards/blog.jpg"
social_media_card = "blog.jpg"
show_previous_next_article_links = true
+++

View file

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Before After
Before After

View file

@ -5,7 +5,6 @@ path = "/ca/about"
[extra]
quick_navigation_buttons = true
social_media_card = "social_cards/about.ca.jpg"
+++
Benvingut a la demo de [**tabi**](https://github.com/welpo/tabi), un tema per a [Zola](https://www.getzola.org/), un generador de llocs web estàtics rapidíssim.

View file

@ -5,7 +5,6 @@ path = "/es/about"
[extra]
quick_navigation_buttons = true
social_media_card = "social_cards/about.es.jpg"
+++
Bienvenido a la demo de [**tabi**](https://github.com/welpo/tabi), un tema para [Zola](https://www.getzola.org/), un rapidísimo generador de sitios estáticos.

View file

@ -5,7 +5,6 @@ path = "about"
[extra]
quick_navigation_buttons = true
social_media_card = "social_cards/about.jpg"
+++
Welcome to the demo of [**tabi**](https://github.com/welpo/tabi), a theme for [Zola](https://www.getzola.org/), a fast static site generator.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

View file

@ -1,16 +1,25 @@
{# Image for social media sharing #}
{%- set social_media_card = macros_settings::evaluate_setting_priority(setting="social_media_card", page=page | default(value=""), section=section | default(value=""), default_global_value="") -%}
{% if social_media_card %}
{# Try to find the image in current page, parent directories, and as absolute path #}
{% set page_path = page.colocated_path | default(value="") %}
{% set current_path = page_path ~ social_media_card %}
{# Get base path from either page or section #}
{% set base_path = "" %}
{% if section and section.path %}
{% set base_path = section.path | trim_end_matches(pat="/_index.md") %}
{% if base_path and not social_media_card is starting_with("/") %}
{% set base_path = base_path ~ "/" %}
{% endif %}
{% else %}
{% set base_path = page.colocated_path | default(value="") %}
{% endif %}
{% set current_path = base_path ~ social_media_card | trim_start_matches(pat="/") %}
{# Try parent path by removing the last directory component #}
{% set parent_path = page_path | split(pat="/") | slice(end=-2) | join(sep="/") %}
{% if parent_path %}
{% set parent_path = base_path | split(pat="/") | slice(end=-2) | join(sep="/") %}
{% if parent_path and not social_media_card is starting_with("/") %}
{% set parent_path = parent_path ~ "/" %}
{% endif %}
{% set parent_relative_path = parent_path ~ social_media_card %}
{% set parent_relative_path = parent_path ~ social_media_card | trim_start_matches(pat="/") %}
{# Check all possible locations #}
{%- set current_meta = get_image_metadata(path=current_path, allow_missing=true) -%}