Skip to content

Commit 1df2cbc

Browse files
author
Oliver Stapleton
committed
Added category page to display posts per category.
Fixes issue st4ple#3
1 parent 88e4d8c commit 1df2cbc

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

_includes/css/style.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,4 +465,11 @@ csmall {
465465
.share i {
466466
padding-right: 15px;
467467
font-size: 18px;
468-
}
468+
}
469+
470+
a.anchor{
471+
display: block;
472+
position: relative;
473+
top: -80px;
474+
visibility: hidden;
475+
}

_includes/sidebar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h4>Categories</h4>
1616
<div class="hline"></div>
1717
{% for category in site.categories %}{% unless category.first == "blog" or category.first == "project" or category.first == "question" %}
1818
<p>
19-
<a href="{{ category.url }}"><i class="fa fa-angle-right"></i> {{ category | first | capitalize }}</a>
19+
<a href="{{ '/category/#' | prepend: site.baseurl }}{{ category | first }}"><i class="fa fa-angle-right"></i> {{ category | first | capitalize }}</a>
2020
<span class="badge badge-theme pull-right">{{ category | last | size }}</span>
2121
</p>
2222
{% endunless %}{% endfor %}
@@ -41,7 +41,7 @@ <h4>Popular Tags</h4>
4141
<div class="hline"></div>
4242
<p>
4343
{% for category in site.categories %}{% unless category.first == "blog" or category.first == "project" %}
44-
<a class="btn btn-theme" href="{{ category.url }}" role="button">{{ category | first | capitalize }} ({{ category | last | size }})</a>
44+
<a class="btn btn-theme" href="{{ '/category/#' | prepend: site.baseurl }}{{ category | first }}" role="button">{{ category | first | capitalize }} ({{ category | last | size }})</a>
4545
{% endunless %}{% endfor %}
4646
</p>
4747
</div>

category.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
layout: blog
3+
title: Categories
4+
permalink: /category/
5+
---
6+
7+
<div class="container mtb">
8+
<div class="row">
9+
<div class="col-lg-8">
10+
11+
<! -- BLOG POSTS LIST -->
12+
{% for category in site.categories %}{% unless category.first == "blog" or category.first == "project" or category.first == "question" %}
13+
14+
<a class="anchor" id="{{ category.first }}"></a><h4>{{ category.first }}</h4>
15+
<div class="hline"></div>
16+
<ul class="popular-posts">
17+
{% for post in site.categories[category.first] %}
18+
19+
<li>
20+
<a href="{{ post.url | prepend: site.baseurl }}"><img src="{{ "/assets/img/blog/thumbs/" | prepend: site.baseurl }}{{ post.thumb }}" alt="Popular Post"></a>
21+
<p><a href="{{ post.url }}">{{ post.title }}</a></p>
22+
<em>Posted on {{ post.date | date_to_string }}</em>
23+
</li>
24+
25+
{% endfor %}
26+
</ul>
27+
28+
29+
{% endunless %}{% endfor %}
30+
</div><! --/col-lg-8 -->
31+
32+
{% include sidebar.html %}
33+
34+
</div><! --/row -->
35+
</div><! --/container -->

0 commit comments

Comments
 (0)