Only show the three newest blog entries on landing page

Add blog tab
This commit is contained in:
MG-5 2023-10-25 13:28:42 +02:00
parent 85557efd29
commit 85f5b3dac8
5 changed files with 57 additions and 1 deletions

View file

@ -0,0 +1,35 @@
<div class="posts">
{% unless site.posts %}
<article><section class="post-content"><p>There are no blog posts</p></section></article>
{% endunless %}
{% for post in site.posts limit:3 %}
<div class="post-teaser">
{% if post.thumbnail %}
<div class="post-img">
<a aria-label="{{ post.title }}" href="{{ post.url | relative_url }}">
<img alt="{{ post.title }}" src="{{ post.thumbnail | relative_url }}">
</a>
</div>
{% endif %}
<span>
<header>
<h2>
<a aria-label="{{ post.title }}" class="post-link" href="{{ post.url | relative_url }}">
{{ post.title }}
</a>
</h2>
{% include blog/post_info.liquid author=post.author date=post.date %}
</header>
{% if site.excerpt or site.theme_settings.excerpt %}
<div class="excerpt">
{% if site.excerpt == "truncate" %}
{{ post.content | strip_html | truncate: '250' | escape }}
{% else %}
{{ post.excerpt | strip_html | escape }}
{% endif %}
</div>
{% endif %}
</span>
</div>
{% endfor %}
</div>

9
_layouts/full_blog.html Normal file
View file

@ -0,0 +1,9 @@
---
layout: default
---
<div class="home">
<div class="blog-links">
{% include blog/blog.liquid %}
</div>
</div>

View file

@ -35,6 +35,6 @@ layout: default
<div class="blog-links"> <div class="blog-links">
<center><h2>Neuste Blogeinträge:</h2></center> <center><h2>Neuste Blogeinträge:</h2></center>
{% include blog/blog.liquid %} {% include blog/small_blog.liquid %}
</div> </div>
</div> </div>

6
blog/index.html Normal file
View file

@ -0,0 +1,6 @@
---
layout: full_blog
title: Blog
---
<!-- this is needed for pagination plugin working correctly -->

6
pages/03_blog.md Normal file
View file

@ -0,0 +1,6 @@
---
layout: full_blog
title: Blog
permalink: /blog
pagination: true
---