Skip to content

Commit

Permalink
Merge pull request #53 from AntoniosBarotsis/show-description
Browse files Browse the repository at this point in the history
Added the option to only show the description (continuation)
  • Loading branch information
pawroman authored Dec 14, 2023
2 parents 331b8aa + 194735b commit 39d13a9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ default_og_image = "static/ocean.jpg"

## 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
Expand Down
3 changes: 2 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
{%- for page in show_pages %}
<div class="post on-list">
{{ post_macros::header(page=page) }}
{{ post_macros::content(page=page, summary=true) }}

{{ post_macros::content(page=page, summary=true, show_only_description=page.extra.show_only_description | default(value=false)) }}
</div>
{% endfor -%}
<div class="pagination">
Expand Down
8 changes: 6 additions & 2 deletions templates/macros/post.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{% macro content(page, summary) %}
{%- if summary and page.summary %}
{% macro content(page, summary, show_only_description) %}
{%- if show_only_description %}
<div class="post-content">
{{ page.description | safe }}
</div>
{% elif summary and page.summary %}
<div class="post-content">
{{ page.summary | safe }}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% block content %}
<div class="post">
{{ post_macros::header(page=page) }}
{{ post_macros::content(page=page, summary=false) }}
{{ post_macros::content(page=page, summary=true, show_only_description=false) }}
{{ post_macros::earlier_later(page=page) }}
</div>
{% endblock content %}

2 comments on commit 39d13a9

@BettridgeKameron
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this change may have broken the demo website, but it is not possible to see anything past the post summary of a post such as: https://pawroman.github.io/zola-theme-terminimal/welcome-terminimal-theme/

@pawroman
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reporting. See #58 for a fix.

Please sign in to comment.