Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing post date format #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,16 @@ page_titles = "combined"
All the configuration options are also described in
[`config.toml`](../master/config.toml).

### Post date format

You can customize the format of the post date by adding:

```toml
[extra]
# Overwrite the format to Jan 13, 2025.
post_date_format = "%b %d, %Y"
```

## Extending

Each of the templates defines named blocks, so
Expand Down
3 changes: 3 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ accent_color = "blue"
# Defaults to accent color (or, if not accent color specified, to blue).
background_color = "blue"

# Format of the post date - defaults to "2025-01-13".
post_date_format = "%Y-%m-%d"

# The logo text - defaults to "Terminimal theme"
logo_text = "Terminimal theme"

Expand Down
2 changes: 1 addition & 1 deletion templates/macros/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{% macro date(page) %}
<span class="post-date">
{%- if page.date %}
{{ page.date | date(format="%Y-%m-%d") }}
{{ page.date | date(format=config.extra.post_date_format) }}
{% endif -%}
</span>
{% endmacro post_date %}
Expand Down
3 changes: 3 additions & 0 deletions theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ accent_color = "blue"
# Defaults to accent color (or, if not accent color specified, to blue).
background_color = "blue"

# Format of the post date - defaults to "2025-01-13".
post_date_format = "%Y-%m-%d"

# The logo text - defaults to 2 non-breaking spaces.
logo_text = "Terminimal theme"

Expand Down