Skip to content

Commit

Permalink
Sort categories
Browse files Browse the repository at this point in the history
  • Loading branch information
alkemist committed Mar 18, 2024
1 parent 717ef2d commit 55c01e1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 119 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ gem "wdm", :install_if => Gem.win_platform?
gem "webrick", "~> 1.7"

gem 'jekyll-date-localization', group: :jekyll_plugins
gem 'jekyll-multiple-languages-plugin'
gem 'jekyll-multiple-languages-plugin'
gem 'jekyll_sort_natural', group: :jekyll_plugins
106 changes: 0 additions & 106 deletions _Gemfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ author-image: /assets/images/avatar_bleu.png
# 60 Words About the Author
author-about: >
Développeur web freelance spécialisé Symfony et Angular.
Introverti hypersensible, idéaliste en quête de sens #ChildFree. #TDAH
Introverti hypersensible, idéaliste en quête de sens #ChildFree #TDAH #NonBinaire
author-url: https://jaden-achain.dev

# SASS
Expand Down
9 changes: 5 additions & 4 deletions _includes/categories.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{% if post %}
{% assign categories = post.categories %}
{% assign categories = post.categories | sort_natural %}
{% else %}
{% assign categories = page.categories %}
{% assign categories = page.categories | sort_natural %}
{% endif %}

{%- unless categories.size == 0 -%}
<p class="subtitle is-uppercase post-categories">
<a href="{{site.baseurl}}/archives"><i class="fas fa-tags"></i></a>

{% for category in categories %}
<a class="tag is-link" href="{{site.baseurl}}/archives/#{{category|slugize}}">{{category}}</a>
{% unless forloop.last %}&nbsp;{% endunless %}
<a class="tag is-link" href="{{site.baseurl}}/archives/#{{category|slugize}}">{{category}}</a>
{% unless forloop.last %}&nbsp;{% endunless %}
{% endfor %}
</p>
{%- endunless -%}
13 changes: 6 additions & 7 deletions _layouts/categories.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
---
layout: page
permalink: /categories/
title: Categories
---

{% assign sorted_cats = site.categories | sort_natural %}

<div id="archives">
{% for category in site.categories %}
{% for category in sorted_cats %}
<div class="archive-group">
{% capture category_name %}{{ category | first }}{% endcapture %}
<div id="#{{ category_name | slugize }}"></div>
<p></p>

<h3 class="category-head">{{ category_name }}</h3>
<a id="{{ category_name | slugize }}"></a>

{% for post in site.categories[category_name] %}
<article class="archive-item">
<h4><a href="{{ site.baseurl }}{{ post.url }}">{{post.title}}</a></h4>
</article>
<article class="archive-item">
<h4><a href="{{ site.baseurl }}{{ post.url }}">{{ post.date | localize: "%d %B %Y" }} - {{post.title}}</a></h4>
</article>
{% endfor %}
</div>
{% endfor %}
Expand Down

0 comments on commit 55c01e1

Please sign in to comment.