adding tags and categories

This commit is contained in:
Holger Reinhardt 2016-01-04 13:09:07 +01:00
parent 1c960f4aa8
commit a488bb0f59
16 changed files with 182 additions and 8 deletions

19
_data/categories.yml Normal file
View File

@ -0,0 +1,19 @@
- slug: general
name: General
color: '#3498db'
- slug: conference
name: Conference
color: '#1abc9c'
- slug: howto
name: Howto
color: '#1abc9c'
- slug: api
name: API
color: '#1abc9c'
- slug: product
name: Product
color: '#1abc9c'

35
_data/tags.yml Normal file
View File

@ -0,0 +1,35 @@
- slug: security
name: Security
- slug: cloud
name: Cloud
- slug: cto
name: CTO
- slug: communication
name: Communication
- slug: open-source
name: Open Source
- slug: api
name: API
- slug: microservice
name: Microservice
- slug: devops
name: Devops
- slug: docker
name: Docker
- slug: mobile
name: Mobile
- slug: custdev
name: Customer Development
- slug: smartsteuer
name: Smartsteuer

View File

@ -0,0 +1,37 @@
---
layout: default
---
<header id="post-header">
<h1 id="post-title">{{ page.category }}</h1>
<h4 id="post-subtitle">Articles by category</h4>
</header>
<div id="post-content">
{% if site.categories[page.category] %}
{% for post in site.categories[page.category] %}
{% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% if forloop.first %}
<h3>{{ post_year }}</h3><div class="list-group">
{% endif %}
{% if forloop.first == false %}
{% assign previous_index = forloop.index0 | minus: 1 %}
{% capture previous_post_year %}{{ site.categories[page.category][previous_index].date | date: '%Y' }}{% endcapture %}
{% if post_year != previous_post_year %}
</div><h3>{{ post_year }}</h3><div class="list-group">
{% endif %}
{% endif %}
<a href="{{ post.url }}/" class="list-group-item">
<h4 class="list-group-item-heading">{{ post.title }}</h4>
</a>
{% if forloop.last %}
</div>
{% endif %}
{% endfor %}
{% else %}
<p>There are no posts in this category.</p>
{% endif %}
</div>

37
_layouts/blog_by_tag.html Normal file
View File

@ -0,0 +1,37 @@
---
layout: default
---
<header id="post-header">
<h1 id="post-title">{{ page.tag }}</h1>
<h4 id="post-subtitle">Articles by tag</h4>
</header>
<div id="post-content">
{% if site.tags[page.tag] %}
{% for post in site.tags[page.tag] %}
{% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% if forloop.first %}
<h3>{{ post_year }}</h3><div class="list-group">
{% endif %}
{% if forloop.first == false %}
{% assign previous_index = forloop.index0 | minus: 1 %}
{% capture previous_post_year %}{{ site.tags[page.tag][previous_index].date | date: '%Y' }}{% endcapture %}
{% if post_year != previous_post_year %}
</div><h3>{{ post_year }}</h3><div class="list-group">
{% endif %}
{% endif %}
<a href="{{ post.url }}/" class="list-group-item">
<h4 class="list-group-item-heading">{{ post.title }}</h4>
</a>
{% if forloop.last %}
</div>
{% endif %}
{% endfor %}
{% else %}
<p>There are no posts for this tag.</p>
{% endif %}
</div>

View File

@ -2,6 +2,8 @@
layout: default
---
{% assign post = page %}
<article class="post">
<h1>{{page.title}}</h1>
@ -9,6 +11,38 @@ layout: default
<span>{{page.date | date: "%B %d, %Y" }}</span>
/
<span>by {{page.author}}</span>
{% if post.category %}
{% for site_category in site.data.categories %}
{% if site_category.slug == post.category %}
{% assign category = site_category %}
{% endif %}
{% endfor %}
{% if category %}
{% capture category_content %} in <span class="label" style="background-color:{{ category.color }}"><a href="/blog/category/{{ category.slug }}/">{{ category.name }}</a></span>{% endcapture %}
{% endif %}
{% else %}
{% assign category_content = '' %}
{% endif %}
{% if post.tags.size > 0 %}
{% capture tags_content %} with {% if post.tags.size == 1 %}<i class="fa fa-tag"></i>{% else %}<i class="fa fa-tags"></i>{% endif %}: {% endcapture %}
{% for post_tag in post.tags %}
{% for data_tag in site.data.tags %}
{% if data_tag.slug == post_tag %}
{% assign tag = data_tag %}
{% endif %}
{% endfor %}
{% if tag %}
{% capture tags_content_temp %}{{ tags_content }}<a href="/blog/tag/{{ tag.slug }}/">{{ tag.name }}</a>{% if forloop.last == false %}, {% endif %}{% endcapture %}
{% assign tags_content = tags_content_temp %}
{% endif %}
{% endfor %}
{% else %}
{% assign tags_content = '' %}
{% endif %}
<p id="post-meta">Posted {{ category_content }}{{ tags_content }}</p>
</p>
<hr/>

View File

@ -4,6 +4,7 @@ title: We are live or How to start a developer blog
subtite: A short introduction
description: How to start our developer blog
category: general
tags: [cto, communication]
author: Holger
author_email: holger.reinhardt@haufe-lexware.com
---

View File

@ -3,7 +3,8 @@ layout: post
title: Notes from OSCON Europe 2015
subtite:
description: Notes from OSCON Europe 2015
category: general
category: conference
tags: [open-source]
author: Marco
author_email: marco.seifried@haufe-lexware.com
---

View File

@ -4,6 +4,7 @@ title: The beginnings of our API Journey
subtite: Intro to our API style guide
description: Got API?
category: api
tags: [api]
author: Holger
author_email: holger.reinhardt@haufe-lexware.com
---

View File

@ -3,7 +3,8 @@ layout: post
title: Notes from DevOpsCon 2015
subtite:
description: Notes from DevOpsCon 2015
category: general
category: conference
tags: [docker, devops]
author: Rainer
author_email: rainer.zehnle@haufe-lexware.com
---

View File

@ -3,7 +3,8 @@ layout: post
title: Impressions from DockerCon EU 2015 - Part 1
subtite: Insights, Outlooks and Inbetweens
description: Notes from DevOpsCon 2015
category: general
category: conference
tags: [docker, security]
author: ThomasSc
author_email: thomas.schuering@haufe-lexware.com
---

View File

@ -3,7 +3,8 @@ layout: post
title: APIdays Paris - From Philosophy to Technology and back again
subtite: A biased report from APIdays global in Paris
description: APIdays Paris - From Philosophy to Technology and back again
category: general
category: conference
tags: [api]
author: Martin
author_email: martin.danielsson@haufe-lexware.com
---

View File

@ -3,7 +3,8 @@ layout: post
title: Impressions from DockerCon 2015 - Part 2
subtitle: Barcelona 16. + 17.11.2015
description: my highlights and picks from DockerCon 2015
category: docker
category: conference
tags: [docker]
author: Peter Frey
author_email: peter.frey@haufe-lexware.com
---

View File

@ -4,6 +4,7 @@ title: Howto - Leverage 'Let's Encrypt' on Azure
subtitle: Create free valid SSL certificates in 20 minutes.
description: Howto - Leverage 'Let's Encrypt' on an Azure Ubuntu VM
category: howto
tags: [security, cloud]
author: Martin
author_email: martin.danielsson@haufe-lexware.com
---

View File

@ -3,7 +3,8 @@ layout: post
title: Creating the Smartsteuer 'Snap' App
subtitle: A backstage report
description: A behind the scenes view of the birth of our youngest creation.
category: Smartsteuer
category: product
tags: [smartsteuer, mobile, custdev]
author: Eike Hirsch
author_email: eike.hirsch@smartsteuer.de
---

View File

@ -3,7 +3,8 @@ layout: post
title: DevOpsCon Munich - Is it really about the tools?
subtite: A opinionated commentary by Elias Weingaertner
description: My personal findings from DevOpsCon 2015 in Munich
category: general
category: conference
tags: [devops, microservice]
author: Elias Weingaertner
author_email: elias.weingaertner@haufe-lexware.com
---

View File

@ -3,7 +3,7 @@ layout: default
---
<div class="posts">
{% for post in site.posts %}
{% for post in site.posts limit: 6 %}
<article class="post">
<h1><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1>
@ -15,4 +15,6 @@ layout: default
<a href="{{ site.baseurl }}{{ post.url }}" class="read-more">Read More</a>
</article>
{% endfor %}
<a href="/blog/" class="pull-right">more <i class="fa fa-long-arrow-right"></i></a>
</div>