- Add "read more"
- Truncate based on based on <!--more--> / <!--more-big--> or word limit as fallback
This commit is contained in:
1 parent
edec9b3680
commit
86d2b16dae
1 file changed
+28
-4
+28
-4
@@ -11,7 +11,15 @@
|
||||
<h2><a href="{{site.baseurl}}{{ post_1.url }}">{{post_1.title}} </a></h2>
|
||||
<p>Published on {{ post_1.date | date: "%Y-%m-%d"}} by {{ post_1.author }}</p>
|
||||
<img src="{{site.baseurl}}/img/posts/{{ post_1.image }}" class="img-responsive" />
|
||||
{{ post_1.content | truncatewords: site.big-post-preview-words | markdownify }}
|
||||
{% if post_1.content contains '<!--more-big-->' %}
|
||||
{{ post_1.content | split:'<!--more-big-->' | first | markdownify}}
|
||||
<a href="{{site.baseurl}}{{ post_1.url }}">read more</a>
|
||||
{% else %}
|
||||
{{ post_1.content | truncatewords: site.big-post-preview-words, "" | markdownify }}
|
||||
{% if (post_1.content | number_of_words) > site.big-post-preview-words %}
|
||||
<a href="{{site.baseurl}}{{ post_1.url }}">read more</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col-md-4">
|
||||
@@ -19,14 +27,30 @@
|
||||
<div class="col-lg-12">
|
||||
<h3><a href="{{site.baseurl}}{{ post_2.url }}">{{ post_2.title }}</a></h3>
|
||||
<p>Published on {{ post_2.date | date: "%Y-%m-%d"}} by {{ post_2.author }}</p>
|
||||
{{ post_2.content | truncatewords: site.post-preview-words | markdownify }}
|
||||
{% if post_2.content contains '<!--more-->' %}
|
||||
{{ post_2.content | split:'<!--more-->' | first | markdownify}}
|
||||
<a href="{{site.baseurl}}{{ post_2.url }}">read more</a>
|
||||
{% else %}
|
||||
{{ post_2.content | truncatewords: site.post-preview-words, "" | markdownify }}
|
||||
{% if (post_2.content | number_of_words) > site.post-preview-words %}
|
||||
<a href="{{site.baseurl}}{{ post_2.url }}">read more</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if post_3 != nil %}
|
||||
<div class="col-lg-12">
|
||||
<h3><a href="{{site.baseurl}}{{ post_2.url }}">{{ post_3.title }}</a></h3>
|
||||
<h3><a href="{{site.baseurl}}{{ post_3.url }}">{{ post_3.title }}</a></h3>
|
||||
<p>Published on {{ post_3.date | date: "%Y-%m-%d"}} by {{ post_3.author }}</p>
|
||||
{{ post_3.content | truncatewords: site.post-preview-words | markdownify }}
|
||||
{% if post_3.content contains '<!--more-->' %}
|
||||
{{ post_3.content | split:'<!--more-->' | first | markdownify}}
|
||||
<a href="{{site.baseurl}}{{ post_3.url }}">read more</a>
|
||||
{% else %}
|
||||
{{ post_3.content | truncatewords: site.post-preview-words, "" | markdownify }}
|
||||
{% if (post_3.content | number_of_words) > site.post-preview-words %}
|
||||
<a href="{{site.baseurl}}{{ post_3.url }}">read more</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user