Skip to content

Commit 2766047

Browse files
authored
Merge pull request #90 from skipgu/84-add-tags-to-blogs
Add tags to blogs
2 parents ab50159 + af5fa5e commit 2766047

29 files changed

Lines changed: 404 additions & 32 deletions

_includes/blog-filters.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{% assign postsByYear = site.posts | group_by_exp: 'post', 'post.date | date: "%Y"' %}
2+
{% assign all_tags = site.posts | map: 'tags' | flatten | uniq | sort %}
3+
4+
<h2>Filters</h2>
5+
<div class="filter-bar">
6+
<div class="filter-group" data-filter-type="year">
7+
<span class="filter-label">Year:</span>
8+
<button class="filter-button active" data-filter="all">All</button>
9+
{% for year in postsByYear %}
10+
<button class="filter-button" data-filter="{{ year.name }}">{{ year.name }}</button>
11+
{% endfor %}
12+
</div>
13+
<div class="filter-group" data-filter-type="tag">
14+
<span class="filter-label">Tag:</span>
15+
<button class="filter-button active" data-filter="all">All</button>
16+
{% if all_tags.size > 0 %}
17+
{% for tag in all_tags %}
18+
<button class="filter-button" data-filter="{{ tag }}">{{ tag }}</button>
19+
{% endfor %}
20+
{% endif %}
21+
<button class="filter-button" data-filter="Other">Other</button>
22+
</div>
23+
</div>
24+
25+
<h1 class="no-results">No blogs found!</h1>
26+
27+
<script src="{{ '/assets/js/filter.js' | relative_url }}"></script>

_includes/entry.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{% if post.id %}
2+
{% assign title = post.title | markdownify | strip_html %}
3+
{% else %}
4+
{% assign title = post.title %}
5+
{% endif %}
6+
7+
<article class="entry" data-year="{{ post.date | date: '%Y' }}" data-tags="{% if post.tags.size > 0 %}{{ post.tags | join: ',' }}{% else %}Other{% endif %}">
8+
<header class="entry-header">
9+
<h3 class="entry-title">
10+
<a href="{{ post.url | relative_url }}" rel="bookmark">{{ title }}</a>
11+
</h3>
12+
{% if post.image.thumbnail %}
13+
{% assign entry_image = post.image.thumbnail | relative_url | escape %}
14+
<img class="entry-image u-photo" src="{{ entry_image }}" alt="">
15+
{% endif %}
16+
</header>
17+
<footer class="entry-meta">
18+
<ul>
19+
{% if post.date %}
20+
<li><span class="icon">{% include icon-calendar.svg %}</span><time class="entry-time" datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: "%B %-d, %Y" }}</time></li>
21+
{% endif %}
22+
</ul>
23+
{% if post.tags.size > 0 %}
24+
<div class="entry-tags">
25+
<span class="icon">{% include icon-tag.svg %}</span>
26+
{% for tag in post.tags %}
27+
<span class="entry-time" style="margin-right: 0.75rem;">{{ tag }}</span>
28+
{% endfor %}
29+
</div>
30+
{% else %}
31+
<div class="entry-tags">
32+
<span class="icon">{% include icon-tag.svg %}</span>
33+
<span class="entry-time" style="margin-right: 0.75rem;">Other</span>
34+
</div>
35+
{% endif %}
36+
</footer>
37+
<div class="entry-excerpt">
38+
{% if post.excerpt %}
39+
{{ post.excerpt | markdownify }}
40+
<p><a href="{{ post.url | relative_url }}" class="more-link">{{ site.data.theme.t.read_more | default: 'Read More' }} <span class="icon icon--arrow-right">{% include icon-arrow-right.svg %}</span></a></p>
41+
{% endif %}
42+
</div>
43+
</article>

_includes/icon-tag.svg

Lines changed: 58 additions & 0 deletions
Loading

_includes/page-intro.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<header class="intro">
2+
{% if page.image %}
3+
{% assign intro_image = page.image.path | default: page.image | relative_url | escape %}
4+
<div class="intro-image">
5+
<img src="{{ intro_image }}" alt="{{ page.title }}">
6+
</div>
7+
{% endif %}
8+
9+
<div class="inner">
10+
<div class="intro-text">
11+
<h1 id="page-title" class="intro-title">{{ page.alt_title | default: page.title | default: site.title | markdownify | strip_html }}</h1>
12+
{% if page.sub_title %}
13+
<p class="intro-subtitle">{{ page.sub_title | markdownify | strip_html }}</p>
14+
{% endif %}
15+
16+
{% if page.date %}
17+
{% include author %}
18+
<p class="entry-meta">
19+
{% if author_name %}<span class="byline-item">{{ author_name | prepend: 'by ' }}</span>{% endif %}<span class="byline-item"><span class="icon">{% include icon-calendar.svg %}</span><time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: "%B %-d, %Y" }}</time></span><span class="byline-item">{% if page.tags %}{% include page-tags.html %}{% endif %}</span>
20+
</p>
21+
{% endif %}
22+
23+
{% if page.introduction %}
24+
<div class="intro-more">
25+
{{ page.introduction | markdownify }}
26+
</div>
27+
{% endif %}
28+
29+
{% if page.actions %}
30+
<ul class="intro-actions">
31+
{% for action in page.actions %}
32+
<li><a href="{{ action.url }}" class="btn">{% if action.icon %}<span class="icon">{% include {{ action.icon | prepend: 'icon-' | append: '.svg' }} %}</span>{% endif %}{{ action.label }}</a></li>
33+
{% endfor %}
34+
</ul>
35+
{% endif %}
36+
</div>
37+
</div>
38+
</header>

_includes/page-tags.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% if page.tags.size > 0 %}
2+
<span class="entry-tags">
3+
<span class="icon">{% include icon-tag.svg %}</span>
4+
{% for tag in page.tags %}
5+
<span class="entry-time" style="margin-right: 0.75rem;">{{ tag }}</span>
6+
{% endfor %}
7+
</span>
8+
{% else %}
9+
<span class="entry-tags">
10+
<span class="icon">{% include icon-tag.svg %}</span>
11+
<span class="entry-time" style="margin-right: 0.75rem;">Other</span>
12+
</span>
13+
{% endif %}

_layouts/home.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ <h1>{{ page.alt_title }}</h1>
1313

1414
{{ content }}
1515

16-
<div class="home-posts">
16+
<div class="home-recent-posts">
1717

18-
<div class="posts-inner">
18+
<h2>Recent blogs</h2>
19+
<div class="entries-list posts-inner">
1920
{% assign recent_posts = site.posts | slice: 0, 3 %}
2021

2122
{% for post in recent_posts %}

_layouts/post.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
layout: default
3+
---
4+
5+
{% include page-intro.html %}
6+
7+
<main id="main" class="page-content" aria-label="Content">
8+
<div class="inner">
9+
<article class="entry-wrap">
10+
<div class="entry-content">
11+
{{ content }}
12+
</div>
13+
{% if site.disqus.shortname %}
14+
{% include disqus_comments.html %}
15+
{% endif %}
16+
</article>
17+
</div>
18+
</main>

_layouts/posts.html

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,10 @@
44

55
{{ content }}
66

7-
<ul class="taxonomy-index">
8-
{% assign postsInYear = site.posts | group_by_exp: 'post', 'post.date | date: "%Y"' %}
9-
{% for year in postsInYear %}
10-
<li>
11-
<a href="#{{ year.name }}">
12-
<strong>{{ year.name }}</strong> <span class="taxonomy-count">{{ year.items | size }}</span>
13-
</a>
14-
</li>
15-
{% endfor %}
16-
</ul>
17-
18-
19-
{% assign postsByYear = site.posts | group_by_exp: 'post', 'post.date | date: "%Y"' %}
20-
{% for year in postsByYear %}
21-
<section id="{{ year.name }}" class="taxonomy-section">
22-
<h2 class="taxonomy-title">{{ year.name }}</h2>
23-
<div class="entries-{{ page.entries_layout | default: 'list' }}">
24-
{% for post in year.items %}
25-
{% include entry.html %}
26-
{% endfor %}
27-
</div>
28-
</section>
29-
{% endfor %}
7+
{% include blog-filters.html %}
308

9+
<div class="entries-{{ page.entries_layout | default: 'list' }}">
10+
{% for post in site.posts %}
11+
{% include entry.html %}
12+
{% endfor %}
13+
</div>

_posts/2023-11-23-oopsex-movie-boardgames-night.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ title: Movie and Board Games Night with OOPsex &#127909; &#127922;
33
alt_title: An new event co-hosted by SKIP.
44
sub_title: A night full of laughter, excitement, and endless entertainment!
55

6+
tags:
7+
- Game Night
8+
- Movie Night
9+
- OOPsex
10+
611
author:
712
name: SKIP
813
comments: false

_posts/2023-12-07-christmas-themed-events-with-skip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ title: Two new exciting events with SKIP &#128293;
33
alt_title: Christmas themed events for students with FIKA!
44
sub_title: Guest Lecture (Reddit) & Gingerbread Building Contest (+GUWIT)
55

6+
tags:
7+
- Guest Lecture
8+
- Workshop
9+
- GUWIT
10+
611
author:
712
name: SKIP
813
comments: false

0 commit comments

Comments
 (0)