Add bare bones and memory management categories

This commit is contained in:
Philipp Oppermann
2015-12-17 02:28:41 +01:00
parent f0cf691229
commit 5f8b058cd3
3 changed files with 71 additions and 22 deletions

View File

@@ -0,0 +1,23 @@
<article class="post" id="{{ post.id }}">
<h1 class="post-title">
<a href="{{ site.baseurl }}{{ post.url }}">
{{ post.title }}
</a>
</h1>
<span class="post-date">
<time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date_to_string }}</time>
{% if post.updated %}
(updated on {{ post.updated | date_to_string }})
{% endif %}
</span>
{% if post.content contains '<!--more-->' %}
{{ post.content | split:'<!--more-->' | first }}
{% else %}
{{ post.excerpt }}
{% endif %}
</article>
{% if forloop.last == false %}
<hr>
{% endif %}

View File

@@ -86,3 +86,33 @@
margin-bottom: 2em; margin-bottom: 2em;
margin-top: -2em; margin-top: -2em;
} }
@mixin category-posts($color) {
border: 2px solid $color;
border-radius: 5px;
margin-bottom: 2rem;
}
@mixin category-title($color) {
color: $color;
margin-right: 0.5rem;
text-transform: uppercase;
font-size: 0.8rem;
text-align: right;
}
.posts.bare-bones {
@include category-posts(#99f);
}
.post-category.bare-bones {
@include category-title(#66f);
}
.posts.memory-management {
@include category-posts(#cc0);
}
.post-category.memory-management {
@include category-title(#990);
}

View File

@@ -13,28 +13,24 @@ title: Home
{% endfor %} {% endfor %}
</div> </div>
<div class="posts"> {% assign posts = site.posts | reverse %}
{% for post in site.posts reversed %}
<article class="post" id="{{ post.id }}">
<h1 class="post-title">
<a href="{{ site.baseurl }}{{ post.url }}">
{{ post.title }}
</a>
</h1>
<span class="post-date"> <div class="post-category bare-bones">Bare Bones</div>
<time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date_to_string }}</time> <div class="posts bare-bones">
{% if post.updated %} {% for post in posts limit:4 %}
(updated on {{ post.updated | date_to_string }}) {% include post_teaser.html %}
{% endif %} {% endfor %}
</span> </div>
{% if post.content contains '<!--more-->' %} <div class="post-category memory-management">Memory Management</div>
{{ post.content | split:'<!--more-->' | first }} <div class="posts memory-management">
{% else %} {% for post in posts offset:4 limit:2 %}
{{ post.excerpt }} {% include post_teaser.html %}
{% endif %} {% endfor %}
</article> </div>
<hr>
<div class="posts">
{% for post in posts offset:6 %}
{% include post_teaser.html %}
{% endfor %} {% endfor %}
</div> </div>