Skip to content

Commit 14bf751

Browse files
committed
add support for "read more" in excerpts, configure in _config.yml
1 parent d0a0163 commit 14bf751

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ repository : "academicpages/academicpages.github.io"
1717
teaser : # filename of teaser fallback teaser image placed in /images/, .e.g. "500x300.png"
1818
breadcrumbs : false # true, false (default)
1919
words_per_minute : 160
20+
read_more : "enabled" # if enabled, adds "Read more" links to excerpts
2021
comments:
2122
provider : # false (default), "disqus", "discourse", "facebook", "google-plus", "staticman", "custom"
2223
disqus:

_includes/archive-single.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ <h2 class="archive__item-title" itemprop="headline">
4646
<p class="page__date"><strong><i class="fa fa-fw fa-calendar" aria-hidden="true"></i> {{ site.data.ui-text[site.locale].date_label | default: "Published:" }}</strong> <time datetime="{{ post.date | default: "1900-01-01" | date_to_xmlschema }}">{{ post.date | default: "1900-01-01" | date: "%B %d, %Y" }}</time></p>
4747
{% endif %}
4848

49-
{% if post.excerpt %}
50-
<p class="archive__item-excerpt" itemprop="description">{{ post.excerpt | markdownify }}
51-
<a href="{{ base_path }}{{ post.url }}" rel="permalink"><strong> Read more</strong></a></p>
49+
{% if post.excerpt and site.read_more != 'enabled' %}
50+
<p class="archive__item-excerpt" itemprop="description">{{ post.excerpt | markdownify }}</p>
51+
{% elsif post.excerpt and site.read_more == 'enabled' %}
52+
<p class="archive__item-excerpt" itemprop="description"><p>{{ post.excerpt | markdownify | remove: '<p>' | remove: '</p>' }}<strong><a href="{{ base_path }}{{ post.url }}" rel="permalink"> Read more</a></strong></p></p>
5253
{% endif %}
5354

5455
{% if post.citation and post.paperurl %}

0 commit comments

Comments
 (0)