Skip to content

Commit 3e076a6

Browse files
committed
Add support for tags to blog posts
Adds simple tag bubbles that can be added to blog posts. In the future we may want to make these selectable for filtering and include a search bar as was done for swift-evolution.
1 parent 222ce98 commit 3e076a6

File tree

3 files changed

+55
-16
lines changed

3 files changed

+55
-16
lines changed

_layouts/post.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@
55
<article class="post">
66
<header>
77
<h1>{{ page.title }}</h1>
8+
<div class="subtitle">
9+
<time pubdate datetime="{{ page.date | date_to_xmlschema }}">
10+
{{ page.date | date: "%B %-d, %Y" }}
11+
</time>
812

9-
<time pubdate datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: "%B %-d, %Y" }}</time>
13+
<div class="tags">
14+
{% for tag in page.tag %}
15+
<div class="tag"><span>{{ tag }}</span></div>
16+
{% endfor %}
17+
</div>
18+
</div>
1019
{% include authors.html authors=page.author compact=true %}
1120
</header>
1221

assets/stylesheets/_screen.scss

+34-14
Original file line numberDiff line numberDiff line change
@@ -570,21 +570,41 @@ article {
570570
padding-top: 0em;
571571
}
572572

573-
time {
574-
display: block;
575-
text-transform: uppercase;
576-
font-size: 14px;
577-
font-weight: 400;
578-
color: var(--color-figure-gray-tertiary);
579-
margin-right: 3em;
580-
margin-bottom: 1.25em;
581-
}
573+
.subtitle {
574+
display: flex;
575+
justify-content: space-between;
576+
margin-bottom: 1em;
582577

583-
.tags {
584-
display: block;
585-
font-size: 12px;
586-
font-weight: 400;
587-
margin-top: 0;
578+
time {
579+
flex-shrink: 0;
580+
margin-top: 0.2em + 0.15em;
581+
text-transform: uppercase;
582+
font-size: 0.8em;
583+
font-weight: 400;
584+
color: var(--color-figure-gray-tertiary);
585+
}
586+
587+
.tags {
588+
display: flex;
589+
flex-direction: row;
590+
/* Allow tags to wrap to additional lines */
591+
flex-wrap: wrap;
592+
/* Add a small gap between additional lines */
593+
gap: 0.4em;
594+
/* Align to trailing edge */
595+
justify-content: flex-end;
596+
597+
.tag {
598+
text-transform: uppercase;
599+
font-size: 0.8em;
600+
font-weight: 400;
601+
margin-left: 0.5em; /* Adjust margin as needed for spacing between tags */
602+
color: var(--color-figure-gray-tertiary);
603+
border: 0.15em solid var(--color-nav-rule);
604+
border-radius: 0.5rem;
605+
padding: 0.15em 0.4em;
606+
}
607+
}
588608
}
589609
}
590610

blog/index.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@
88
<article id="{{ post.id }}" class="summary">
99
<header>
1010
<h2 class="title"><a href="{{ post.url }}">{{ post.title }}</a></h2>
11-
<time pubdate datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: "%B %-d, %Y" }}</time>
11+
<div class="subtitle">
12+
<time pubdate datetime="{{ post.date | date_to_xmlschema }}">
13+
{{ post.date | date: "%B %-d, %Y" }}
14+
</time>
15+
16+
<div class="tags">
17+
{% for tag in post.tag %}
18+
<div class="tag"><span>{{ tag }}</span></div>
19+
{% endfor %}
20+
</div>
21+
</div>
1222
</header>
1323
<section class="excerpt">
1424
{{ post.excerpt }}

0 commit comments

Comments
 (0)