add featured imaged to post

This commit is contained in:
Nico Jensen 2021-06-21 17:12:13 +02:00
parent 9da2f400e8
commit 4460694453
5 changed files with 43 additions and 23 deletions

View file

@ -0,0 +1,3 @@
<div class="post-featured-image">
<img src="/assets/images/header/{{include.image}}" alt="{{include.alt}}" />
</div>

View file

@ -3,6 +3,7 @@ layout: default
--- ---
<article class="post"> <article class="post">
<header class="post-header"> <header class="post-header">
{% if page.featured-image %}{% include post-featured-image.html image=page.featured-image alt=page.featured-image-alt %}{% endif %}
<div class="post-title wrapper"> <div class="post-title wrapper">
<h2> <h2>
{% if page.external-url %} {% if page.external-url %}
@ -11,7 +12,7 @@ layout: default
{{ page.title }} {{ page.title }}
{% endif %} {% endif %}
</h2> </h2>
</div>
<p class="public-date">vom <time class="page-date" datetime="{{ page.date | date: "%Y-%m-%d"}}"> <p class="public-date">vom <time class="page-date" datetime="{{ page.date | date: "%Y-%m-%d"}}">
{% assign m = page.date | date: "%-m" %} {% assign m = page.date | date: "%-m" %}
{{ page.date | date: "%d" }} {{ page.date | date: "%d" }}
@ -33,7 +34,9 @@ layout: default
</time> </time>
{% if page.external-url %} {% if page.external-url %}
&nbsp;|&nbsp;<a href="{{ page.external-url }}">Org. Post</a> &nbsp;|&nbsp;<a href="{{ page.external-url }}">Org. Post</a>
{% endif %}</p> {% endif %}
</p>
</div>
</header> </header>
<div class="post-content wrapper"> <div class="post-content wrapper">
{{ content }} {{ content }}

View file

@ -1,6 +1,11 @@
--- ---
title: Update! title: Update!
layout: post layout: post
date: 2021-06-15
author: Nico Jensen
description: Ein update zum Blog selbst und zur Seite
featured-image: update.png
featured-image-alt: Bild von Code der Seite für das Update
--- ---
Moin! Moin!

View file

@ -49,7 +49,7 @@ header.header p {
.wrapper { .wrapper {
margin: 0 auto; margin: 0 auto;
width: 100%; width: 100%;
max-width: 500px; max-width: 700px;
padding: 0 10px; padding: 0 10px;
} }
@ -109,6 +109,15 @@ article.post header.post-header div.post-title h2 {
margin-bottom: 0; margin-bottom: 0;
} }
article.post header.post-header div.post-featured-image {
text-align: center;
}
article.post header.post-header div.post-featured-image img {
max-width: 100%;
width: 760px;
}
article.post header.post-header p.public-date { article.post header.post-header p.public-date {
margin-top: 0; margin-top: 0;
font-size: 0.8em; font-size: 0.8em;

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB