diff --git a/config.toml b/config.toml index bb93fe3..29d607b 100644 --- a/config.toml +++ b/config.toml @@ -146,6 +146,12 @@ show_reading_time = true # 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 show_date = true +# Determines how dates are displayed in the post listing (e.g. front page or /blog). Options: +# "date" - Show only the original date of the post (default if unset). +# "updated" - Show only the last updated date of the post. +# "both" - Show both the original date and the last updated date. +post_listing_date = "date" + # DEPRECATED! # Use Zola's built-in `bottom_footnotes = true` in the [markdown] section instead. (Available since v0.19.0) # Adds backlinks to footnotes (loads ~500 bytes of JavaScripts). diff --git a/content/blog/mastering-tabi-settings/index.ca.md b/content/blog/mastering-tabi-settings/index.ca.md index e679615..4979474 100644 --- a/content/blog/mastering-tabi-settings/index.ca.md +++ b/content/blog/mastering-tabi-settings/index.ca.md @@ -1,7 +1,7 @@ +++ title = "Domina la configuració de tabi: guia completa" date = 2023-09-18 -updated = 2024-07-04 +updated = 2024-07-09 description = "Descobreix les múltiples maneres en què pots personalitzar tabi." [taxonomies] @@ -141,6 +141,14 @@ Fixa't que si configures `section_path`, no cal que configuris `paginate_by`. Po El `title` és el títol que apareix a sobre de les publicacions. +##### Mostrar la data dels articles al llistat + +Per defecte, quan es llisten els articles, es mostra la data de creació. Pots configurar quina(es) data(es) mostrar utilitzant l'opció `post_listing_date`. Configuracions disponibles: + +- `date`: Mostra només la data de publicació original de l'article (opció per defecte). +- `updated`: Mostra només la data de l'última actualització de l'article. +- `both`: Mostra tant la data de publicació original com la data de l'última actualització. + #### Llistat de Projectes Pots mostrar una selecció de projectes a la teva pàgina principal. Per fer això, primer necessitaràs configurar el directori `projects`. diff --git a/content/blog/mastering-tabi-settings/index.es.md b/content/blog/mastering-tabi-settings/index.es.md index 10eaa3d..6f78c8d 100644 --- a/content/blog/mastering-tabi-settings/index.es.md +++ b/content/blog/mastering-tabi-settings/index.es.md @@ -1,7 +1,7 @@ +++ title = "Domina la configuración de tabi: guía completa" date = 2023-09-18 -updated = 2024-07-04 +updated = 2024-07-09 description = "Descubre las múltiples maneras en que puedes personalizar tabi." [taxonomies] @@ -141,6 +141,14 @@ Fíjate que si configuras `section_path`, no necesitas configurar `paginate_by`. El `title` es el encabezado que aparece sobre las publicaciones. +##### Mostrar la fecha de los artículos en el listado + +Por defecto, cuando se listan los artículos, se muestra la fecha de creación. Puedes configurar qué fecha(s) mostrar usando la opción `post_listing_date`. Configuraciones disponibles: + +- `date`: Muestra solo la fecha de publicación original del artículo (opción por defecto). +- `updated`: Muestra solo la fecha de la última actualización del artículo. +- `both`: Muestra tanto la fecha de publicación original como la fecha de la última actualización. + #### Listado de proyectos Puedes mostrar una selección de proyectos en tu página principal. Para hacer esto, primero necesitarás configurar el directorio `projects`. diff --git a/content/blog/mastering-tabi-settings/index.md b/content/blog/mastering-tabi-settings/index.md index 36cb844..32c5dbd 100644 --- a/content/blog/mastering-tabi-settings/index.md +++ b/content/blog/mastering-tabi-settings/index.md @@ -1,7 +1,7 @@ +++ title = "Mastering tabi Settings: A Comprehensive Guide" date = 2023-09-18 -updated = 2024-07-04 +updated = 2024-07-09 description = "Discover the many ways you can customise your tabi site." [taxonomies] @@ -141,6 +141,14 @@ Notice how if you set `section_path`, you don't need to set `paginate_by`. You c The `title` is the header that appears above the posts. +##### Display the Date of Posts in Listing + +By default, when listing posts, the date of post creation is shown. You can configure which date(s) to display using the `post_listing_date` option. Available settings: + +- `date`: Show only the original date of the post (default). +- `updated`: Show only the last updated date of the post. +- `both`: Show both the original date and the last updated date. + #### Listing Projects You can showcase a selection of projects on your main page. To do this, you'll need to set up the `projects` directory first. diff --git a/sass/main.scss b/sass/main.scss index 13401e6..5d1f275 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -276,6 +276,10 @@ video { margin-bottom: 2rem; } +.mobile-only { + display: none; +} + @media only screen and (max-width: 1000px) { .content { max-width: var(--normal-layout-width); @@ -292,6 +296,10 @@ video { max-width: none; overflow-x: auto; } + + .mobile-only { + display: block; + } } @media only screen and (max-width: 600px) { diff --git a/sass/parts/_posts_list.scss b/sass/parts/_posts_list.scss index 1a9243a..a4572fd 100644 --- a/sass/parts/_posts_list.scss +++ b/sass/parts/_posts_list.scss @@ -10,6 +10,7 @@ padding: 2.5rem 0; .bloglist-meta { + margin-right: 0.7rem; padding: 0; width: 13.5rem; color: var(--meta-color); diff --git a/static/feed_style.xsl b/static/feed_style.xsl index 6068bd2..12e68c1 100644 --- a/static/feed_style.xsl +++ b/static/feed_style.xsl @@ -19,40 +19,65 @@
- - - - - About Feeds - - - - - - + + + + + About Feeds + + + + + +
-
-

+

+
    -
  • + + + + +
  • + +
  • +
    + + +
  • + +
  • +
    + + +
  • + + + + + +
  • +
diff --git a/templates/atom.xml b/templates/atom.xml index 4f59410..2774243 100644 --- a/templates/atom.xml +++ b/templates/atom.xml @@ -9,6 +9,9 @@ + + {{ config.extra.separator | default(value="•") }} + {{- macros_translate::translate(key="about_feeds", default="This is a web feed, also known as an Atom feed. Subscribe by copying the URL from the address bar into your newsreader", language_strings=language_strings) -}} @@ -18,6 +21,9 @@ {{- macros_translate::translate(key="recent_posts", default="Recent posts", language_strings=language_strings) -}} + + {{- macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -}} + {#- Load extra CSS (skin) if set in config.toml -#} @@ -34,6 +40,7 @@ {{ config.description }} {%- endif %} + {{ config.extra.post_listing_date | default(value="date") }} {% for post in posts %} {% if loop.index <= max %} @@ -12,9 +14,30 @@ {% endif %}
    - {% if post.date %} -
  • {{ macros_format_date::format_date(date=post.date, short=false, language_strings=language_strings) }}
  • - {% endif %} + {%- set allowed_post_listing_dates = ["date", "updated", "both"] -%} + {%- set post_listing_date = config.extra.post_listing_date | default(value="date") -%} + {%- if post_listing_date not in allowed_post_listing_dates -%} + {{ throw(message="ERROR: Invalid value for config.extra.post_listing_date. Allowed values are 'date', 'updated', or 'both'.") }} + {%- endif -%} + + {%- set show_date = post.date and post_listing_date == "date" or post.date and post_listing_date == "both" -%} + {%- set show_updated = post.updated and post_listing_date == "updated" or post.updated and post_listing_date == "both" -%} + + {%- if show_date or show_updated -%} + {%- if show_date -%} +
  • {{- macros_format_date::format_date(date=post.date, short=false, language_strings=language_strings) -}}
  • + {%- endif -%} + {%- if show_date and show_updated -%} +
  • {{- separator -}}
  • + {%- endif -%} + {%- if show_updated -%} + {%- set last_updated_str = macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -%} + {%- set formatted_date = macros_format_date::format_date(date=post.updated, short=true, language_strings=language_strings) -%} + {%- set updated_str = last_updated_str | replace(from="$DATE", to=formatted_date) -%} +
  • {{ updated_str }}
  • + {%- endif -%} + {%- endif -%} + {% if post.draft %}
  • {{ macros_translate::translate(key="draft", default="DRAFT", language_strings=language_strings) }}
  • {% endif %} diff --git a/theme.toml b/theme.toml index a806e13..957bd9a 100644 --- a/theme.toml +++ b/theme.toml @@ -103,6 +103,12 @@ show_reading_time = true # 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 show_date = true +# Determines how dates are displayed in the post listing (e.g. front page or /blog). Options: +# "date" - Show only the original date of the post (default if unset). +# "updated" - Show only the last updated date of the post. +# "both" - Show both the original date and the last updated date. +post_listing_date = "date" + # DEPRECATED! # Use Zola's built-in `bottom_footnotes = true` in the [markdown] section instead. (Available since v0.19.0) # Adds backlinks to footnotes (loads ~500 bytes of JavaScripts).