Add pagination with excerpts and read more links
This commit is contained in:
@@ -11,10 +11,17 @@ disqus: boukefalos
|
||||
analytics: UA-46375339-1
|
||||
maps: AIzaSyCyIwGR-F48dFjAbwNr9JdOsfUYaUQxz1s
|
||||
|
||||
# pagination
|
||||
paginate: 3
|
||||
all_posts: 'Alle posts →'
|
||||
all_posts_description: 'Bekijk alle # posts.'
|
||||
read_more: '» Verder lezen...'
|
||||
previous_page: '← Vorige pagina'
|
||||
next_page: 'Volgende pagina →'
|
||||
|
||||
# other
|
||||
gems: [jekyll-paginate]
|
||||
markdown: redcarpet
|
||||
paginate: 7
|
||||
highlighter: pygments
|
||||
safe: false
|
||||
environment: dev
|
||||
|
||||
22
_includes/post.html
Normal file
22
_includes/post.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<section itemscope itemtype="http://schema.org/BlogPosting">
|
||||
<header>
|
||||
<div class="timeline">
|
||||
{% if post.date %}
|
||||
<time datetime="{{ post.date|date_to_xmlschema }}" title="{{ post.date|date_to_xmlschema }}"><strong>{{ post.date|date:"%b %d"|upcase }}</strong><br />{{ post.date|date:"%Y" }}</time>
|
||||
{% endif %}
|
||||
{% if post.location %}
|
||||
<a href="https://maps.google.com/maps?hl=en&ll={{ post.location.latitude }},{{ post.location.longitude }}&t=w&z=12"><img alt="map" height="49" src="https://maps.googleapis.com/maps/api/staticmap?center={{ post.location.latitude }},{{ post.location.longitude }}&zoom=9&size=98x98&sensor=false" title="{{ post.location.title }}" width="49" /></a>
|
||||
{% endif %}
|
||||
{% if post.code %}
|
||||
<a href="{{ post.code }}"><img alt="code" height="49" src="{{ site.static_prefix }}/icon/code.png" width="49" /></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<h1>
|
||||
<span itemprop="name">{{ post.title }}</span>
|
||||
<small class="print-only" itemprop="datePublished" content="{{ post.date|date:'%F') }}">{{ post.date|date:'%A, %B %d, %Y' }}</small>
|
||||
</h1>
|
||||
</header>
|
||||
<section class="post-content" itemprop="articleBody">
|
||||
{{ post.content }}
|
||||
</section>
|
||||
</section>
|
||||
33
_includes/post_detail.html
Normal file
33
_includes/post_detail.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<section itemscope itemtype="http://schema.org/BlogPosting">
|
||||
<header>
|
||||
<div class="timeline">
|
||||
{% if post.date %}
|
||||
<time datetime="{{ post.date|date_to_xmlschema }}" title="{{ post.date|date_to_xmlschema }}"><strong>{{ post.date|date:"%b %d"|upcase }}</strong><br />{{ post.date|date:"%Y" }}</time>
|
||||
{% endif %}
|
||||
{% if post.location %}
|
||||
<a href="https://maps.google.com/maps?hl=en&ll={{ post.location.latitude }},{{ post.location.longitude }}&t=w&z=12"><img alt="map" height="49" src="https://maps.googleapis.com/maps/api/staticmap?center={{ post.location.latitude }},{{ post.location.longitude }}&zoom=9&size=98x98&sensor=false" title="{{ post.location.title }}" width="49" /></a>
|
||||
{% endif %}
|
||||
{% if post.code %}
|
||||
<a href="{{ post.code }}"><img alt="code" height="49" src="{{ site.static_prefix }}/icon/code.png" width="49" /></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<h1>
|
||||
<span itemprop="name">{{ post.title }}</span>
|
||||
<small class="print-only" itemprop="datePublished" content="{{ post.date|date:'%F') }}">{{ post.date|date:'%A, %B %d, %Y' }}</small>
|
||||
</h1>
|
||||
</header>
|
||||
<section class="post-content" itemprop="articleBody">
|
||||
{{ post.excerpt }}
|
||||
{% capture content_words %}
|
||||
{{ post.content | number_of_words }}
|
||||
{% endcapture %}
|
||||
{% capture excerpt_words %}
|
||||
{{ post.excerpt | number_of_words }}
|
||||
{% endcapture %}
|
||||
{% if excerpt_words != content_words %}
|
||||
<p>
|
||||
<a href="/{{ site.baseurl }}{{ post.url }}" role="button">{{ site.read_more }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
</section>
|
||||
@@ -20,12 +20,6 @@
|
||||
<section class="post-content" itemprop="articleBody">
|
||||
{{ content }}
|
||||
</section>
|
||||
<div class="meta">
|
||||
<div class="meta-social screen-only">
|
||||
<a href="https://twitter.com/share" class="twitter-share-button" data-via="dpb587">Tweet</a>
|
||||
<div class="g-plusone" data-size="medium" data-width="300"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% if false != page.comments %}
|
||||
{% include disqus.html %}
|
||||
{% endif %}
|
||||
|
||||
@@ -316,7 +316,7 @@ $oConsole
|
||||
</div>
|
||||
{%% include gallery_list.html gallery='%s' %%}
|
||||
EOF
|
||||
, (empty($aGallery['description']) ? '' : $aGallery['description']), implode(' · ', $aLinks), $sGallery);
|
||||
, (empty($aGallery['description']) ? '' : $aGallery['description']), implode(' | ', $aLinks), $sGallery);
|
||||
file_put_contents(
|
||||
$sRenderPath . '/index.html',
|
||||
'---' . "\n" . yamlDump($aMatter) . '---' . "\n" . $sContents
|
||||
|
||||
30
index.html
30
index.html
@@ -13,24 +13,28 @@ tags: blog scotland chemistry phd
|
||||
</section>
|
||||
|
||||
{% for post in paginator.posts %}
|
||||
<section>
|
||||
<header>
|
||||
<div class="timeline">
|
||||
<time datetime="{{ post.date|date_to_xmlschema }}"><strong>{{ post.date|date:"%b %d"|upcase }}</strong><br />{{ post.date|date:"%Y" }}</time>
|
||||
</div>
|
||||
<h1><a href="/{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1>
|
||||
{% if post.description %}
|
||||
<div class="meta" style="margin-bottom:0;margin-top:0;">{{ post.description }}</div>
|
||||
{% endif %}
|
||||
</header>
|
||||
</section>
|
||||
{% include post_detail.html %}
|
||||
{% endfor %}
|
||||
|
||||
{% if paginator.total_pages > 1 %}
|
||||
<ul class="pager">
|
||||
{% if paginator.previous_page %}
|
||||
<a href="/{{ site.baseurl }}{{ paginator.previous_page_path }}">{{ site.previous_page }}</a>
|
||||
{% endif %}
|
||||
{% if paginator.previous_page and paginator.next_page %}
|
||||
|
|
||||
{% endif %}
|
||||
{% if paginator.next_page %}
|
||||
<a href="/{{ site.baseurl }}{{ paginator.next_page_path }}">{{ site.next_page }}</a>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if paginator.next_page %}
|
||||
<section>
|
||||
<header>
|
||||
<h1><a href="/blog/">more posts →</a></h1>
|
||||
<div class="meta" style="margin-bottom:0;margin-top:0;">See the full list of {{ site.posts.size }} posts.</div>
|
||||
<h1><a href="/{{ site.baseurl }}/blog/">{{ site.all_posts }}</a></h1>
|
||||
<div class="meta">{{ site.all_posts_description | replace:'#',site.posts.size }}</div>
|
||||
</header>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user