Skip to content

Commit

Permalink
display tags and categories
Browse files Browse the repository at this point in the history
  • Loading branch information
sylv256 committed Sep 22, 2023
1 parent a7e3064 commit 189b745
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions _includes/post_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
{%- for post in paginator.posts limit: include.limit -%}
<div class="post">
<h2><a href="{{ post.url | relative_url }}">{{ post.title | smartify }}</a></h2>
{%- include tags-categories.html -%}
<h3>{{- post.date | date: site.theme_config.date_format -}}</h3>
<h4><i>{{ post.author | smartify }}</i> - {{ post.description | smartify }}</h4>
<p>{{ post.excerpt | smartify }}</p>
Expand Down
10 changes: 10 additions & 0 deletions _includes/tags-categories.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="post-categories">
{%- for category in post.categories -%}
<span>{{ category }}</span>
{%- endfor -%}
</div>
<div class="post-tags">
{%- for tag in post.tags -%}
<span>#{{ tag }}</span>
{%- endfor -%}
</div>
2 changes: 2 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
---

<h1>{{ page.title | smartify }}</h1>
{%- assign post = page -%}
{%- include tags-categories.html -%}
<sub>{{ page.date | date: site.theme_config.date_format }} - <i>{{ page.author | smartify }}</i></sub>

{{ content | smartify }}
31 changes: 31 additions & 0 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

--code-bg: #3A3A3A;
--code-color: #ccc;
--alt-code-color: #ababab;

--nav-bg: #202020;
--nav-link: #9b9b9b;
Expand Down Expand Up @@ -394,6 +395,36 @@ pre {

/* ********** */

/* blog posts page */

.post-tags, .post-categories {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-bottom: 4px;
}

.post-tags>span, .post-categories>span {
/*spacing*/
margin-bottom: 4px;
margin-right: 0.5em;

/*styling inside padding*/
background-color: var(--code-bg);
color: var(--alt-code-color);
padding: 3px;
}

.post-tags>span {
border-radius: 8px;
}

.post-categories>span {
border-radius: 16px
}

/* *************** */


/* main shit */

Expand Down

0 comments on commit 189b745

Please sign in to comment.