Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add functionality to display categories, like tags, in blog home page #1482

Merged
merged 2 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ jekyll-archives:
category: '/blog/category/:name/'

display_tags: ['formatting', 'images', 'links', 'math', 'code'] # these tags will be displayed on the front page of your blog
display_categories: ['blockquotes'] # these categories will be displayed on the front page of your blog

# -----------------------------------------------------------------------------
# Jekyll Scholar
Expand Down
2 changes: 1 addition & 1 deletion _sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ footer.sticky-bottom {
}
}

.tag-list {
.tag-category-list {
border-bottom: 1px solid var(--global-divider-color);
text-align: center;
padding-top: 1rem;
Expand Down
15 changes: 13 additions & 2 deletions blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ <h2>{{ site.blog_description }}</h2>
</div>
{% endif %}

{% if site.display_tags %}
<div class="tag-list">
{% if site.display_tags or site.display_categories %}
<div class="tag-category-list">
<ul class="p-0 m-0">
{% for tag in site.display_tags %}
<li>
Expand All @@ -36,6 +36,17 @@ <h2>{{ site.blog_description }}</h2>
<p>&bull;</p>
{% endunless %}
{% endfor %}
{% if site.display_categories.size > 0 and site.display_tags.size > 0 %}
<p>&bull;</p>
{% endif %}
{% for category in site.display_categories %}
<li>
<i class="fas fa-tag fa-sm"></i> <a href="{{ category | slugify | prepend: '/blog/category/' | relative_url }}">{{ category }}</a>
</li>
{% unless forloop.last %}
<p>&bull;</p>
{% endunless %}
{% endfor %}
</ul>
</div>
{% endif %}
Expand Down