Skip to content

Commit

Permalink
Adds support for tag-list (alshedivat#734)
Browse files Browse the repository at this point in the history
* Adds support for tag-list

* Update _sass/_base.scss

Co-authored-by: Maruan <alshedivat@users.noreply.github.com>

* Made tags optional

* Responsive deign for tag-list

Co-authored-by: Maruan <alshedivat@users.noreply.github.com>
  • Loading branch information
2 people authored and zkotti committed Dec 10, 2022
1 parent 747aee5 commit d5e7ea3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ jekyll-archives:
tag: '/blog/tag/:name/'
category: '/blog/category/:name/'

display_tags: ['formatting', 'images', 'links', 'math', 'code'] # this tags will be dispalyed on the front page of your blog

# -----------------------------------------------------------------------------
# Jekyll Scholar
# -----------------------------------------------------------------------------
Expand Down
20 changes: 19 additions & 1 deletion _sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,31 @@ footer.sticky-bottom {
border-bottom: 1px solid var(--global-divider-color);
text-align: center;
padding-top: 2rem;
padding-bottom: 5rem;
padding-bottom: 3rem;
h1 {
color: var(--global-theme-color);
font-size: 5rem;
}
}

.tag-list {
border-bottom: 1px solid var(--global-divider-color);
text-align: center;
padding-top: 1rem;

ul {
justify-content: center;
display: flow-root;

p, li {
list-style: none;
display: inline-block;
padding: 1rem 0.5rem;
color: var(--global-text-color-light);
}
}
}

.post-list {
margin: 0;
margin-bottom: 40px;
Expand Down
14 changes: 14 additions & 0 deletions blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ <h1>{{ site.blog_name }}</h1>
<h2>{{ site.blog_description }}</h2>
</div>

{% if site.display_tags %}
<div class="tag-list">
<ul class="list-group list-group-horizontal">
{% for tag in site.display_tags %}
<li>
<i class="fas fa-hashtag fa-sm"></i> <a href="{{ tag | prepend: '/blog/tag/' | relative_url }}">{{ tag }}</a>
</li>
{% unless forloop.last %}
<p>&bull;</p>
{% endunless %}
{% endfor %}
</ul>
</div>
{% endif %}

<ul class="post-list">
{% for post in paginator.posts %}
Expand Down

0 comments on commit d5e7ea3

Please sign in to comment.