Added events collection and first event

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2018-05-19 15:48:33 +02:00
parent b96c8670b4
commit 808a2b656a
5 changed files with 97 additions and 0 deletions

View File

@ -13,6 +13,9 @@ description: > # this means to ignore newlines until "baseurl:"
related to me personally.
baseurl: "" # the subpath of your site, e.g. /blog
url: "https://2martens.de" # the base hostname & protocol for your site
collections:
events:
output: true
defaults:
-
scope:
@ -29,6 +32,13 @@ defaults:
values:
layout: "page"
sidebarboxes: "author encrypted-communication"
-
scope:
path: ""
type: "events"
values:
layout: "event"
sidebarboxes: "author encrypted-communication"
# Build settings
markdown: kramdown

View File

@ -0,0 +1,8 @@
---
layout: event
title: "Bezirks- und Europawahl 2019"
date: 2018-05-19 10:00:00 +0200
start_date: 2019-05-26 10:00:00 +0200
end_date: 2019-05-26 18:00:00 +0200
location: Hamburg
---

View File

@ -0,0 +1,42 @@
{% if site.events.size > 0 %}
<div class="card sidebar mb-3">
<header class="card-header">
Events
</header>
<ul class="list-group list-group-flush list-unstyled">
{% capture now-unix %}{{ 'now' | date: '%s' | divided_by: 86400 }}{% endcapture %}
{% for event in site.events %}
{% capture event-time %}{{ event.start_date | date: '%s' | divided_by: 86400 }}{% endcapture %}
{% if now-unix <= event-time %}
<li itemscope itemtype="http://schema.org/Event">
<div class="card-body">
<header>
<h6 itemprop="name about"><a href="{{ event.url | relative_url }}">{{ event.title }}</a></h6>
<ul class="list-unstyled">
<li><span class="far fa-map-marker"></span> <span itemprop="location">{{ event.location }}</span></li>
<li>
<span class="far fa-calendar-alt"></span>
<time datetime="{{ event.start_date | date_to_xmlschema }}" itemprop="startDate">
{% if event.end_date %}Start: {% else %}Date: {% endif %}{{ event.start_date | date: "%b %-d, %Y %H:%M" }}
</time>
</li>
{% if event.end_date %}
<li>
<span class="far fa-calendar-alt"></span>
<time datetime="{{ event.end_date | date_to_xmlschema }}" itemprop="endDate">
End: {{ event.end_date | date: "%b %-d, %Y %H:%M" }}
</time>
</li>
{% endif %}
</ul>
</header>
<div class="card-text text-justify" itemprop="description">
{{ event.content }}
</div>
</div>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endif %}

36
_layouts/event.html Normal file
View File

@ -0,0 +1,36 @@
---
layout: default
---
{% if page.date_modified %}
{% assign modified = page.date_modified %}
{% else %}
{% assign modified = page.date %}
{% endif %}
<div class="post" itemscope itemtype="http://schema.org/Event">
<header class="post-header">
<h1 class="post-title" itemprop="name about">{{ page.title }}</h1>
</header>
<ul class="list-unstyled">
<li>
<span class="far fa-map-marker"></span>
<span itemprop="location">{{ page.location }}</span>
</li>
<li>
<span class="far fa-calendar-alt"></span>
<time datetime="{{ page.start_date | date_to_xmlschema }}" itemprop="startDate">
{% if page.end_date %}Start: {% else %}Date: {% endif %}{{ page.start_date | date: "%b %-d, %Y %H:%M" }}
</time>
</li>
{% if page.end_date %}
<li>
<span class="far fa-calendar-alt"></span>
<time datetime="{{ page.end_date | date_to_xmlschema }}" itemprop="endDate">
End: {{ page.end_date | date: "%b %-d, %Y %H:%M" }}
</time>
</li>
{% endif %}
</ul>
<div class="text-justify" itemprop="description">{{ content }}</div>
</div>

View File

@ -1,5 +1,6 @@
---
layout: default
sidebarboxes: author encrypted-communication events
---
<h1>2martens.de</h1>