Skip to content

Commit

Permalink
Fix the summary issue of not cutting the text
Browse files Browse the repository at this point in the history
  • Loading branch information
kplaube committed Apr 5, 2023
1 parent a35ff3c commit 618c58b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ This theme uses the following Pelican plugins:
- Installed [through forking](https://github.com/getpelican/pelican-plugins/tree/master#how-to-use-plugins) `pelican-plugins` repository:
- [i18n_subsites](https://github.com/getpelican/pelican-plugins/tree/master/i18n_subsites) `(required)`
- [summary](https://github.com/getpelican/pelican-plugins/tree/master/summary) `(recommended)`
- [representative_image](https://github.com/getpelican/pelican-plugins/tree/master/representative_image) `(recommended)`

- Installed through manual intervention:
- [extended_meta](https://github.com/kplaube/extended_meta) `(optional)`
Expand Down
5 changes: 4 additions & 1 deletion templates/includes/article.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% import 'macros/summary.html' as summ %}

<article class="Article u-box" itemscope="" itemtype="http://schema.org/BlogPosting">
{% if article.meta %}
<div itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
Expand Down Expand Up @@ -47,7 +49,8 @@ <h1 class="Article-title" itemprop="headline name">
</a>
{% endif %}

{{ article.summary }}
{{ summ.format(article) }}


<p class="Article-footer">
{{ gettext('On') }} <time datetime="{{ article.date.isoformat() }}" itemprop="datePublished">{{ article.locale_date }}</time>
Expand Down
6 changes: 6 additions & 0 deletions templates/macros/summary.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% macro format(obj) -%}
{% set content = obj.summary %}
{% set end_marker = PELICAN_END_SUMMARY or '<!-- PELICAN_END_SUMMARY -->' %}

{{ content[:content.find(end_marker)] }}
{%- endmacro %}

0 comments on commit 618c58b

Please sign in to comment.