File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ Changes made to fulfil my needs:
123123* Added [PDF viewer](https://github.com/alesordo/alesordo.github.io)
124124* Added scss and modified ` ` ` portfolYOU.scss` ` `
125125* Customized landing page with dynamic message
126+ * Added date dropdown page to list posts in blog
126127
127128< div align= " center" >
128129< sub>< sup> © 2025 Alejandro Garnung Menéndez, licensed under the < a href= " ./LICENSE" > MIT License< /a> .< /sup>< /sub>
Original file line number Diff line number Diff line change 1+ <!-- Group posts by date -->
2+ {%- assign posts_by_date = {} -%}
3+ {%- for post in site.posts -%}
4+ {%- assign post_date = post.date | date: "%Y-%m" -%} <!-- Group by year and month -->
5+ {%- if posts_by_date[post_date] == nil -%}
6+ {%- assign posts_by_date[post_date] = "" -%}
7+ {%- endif -%}
8+ {%- assign posts_by_date[post_date] = posts_by_date[post_date] | append: post.url | append: "|" -%}
9+ {%- endfor -%}
10+
11+ <!-- Create a dropdown list by date -->
12+ {% for date, posts in posts_by_date %}
13+ < div class ="py-3 ">
14+ < h4 id ="{{ date }} "> {{ date }}</ h4 >
15+ < button class ="btn btn-primary " type ="button " data-toggle ="collapse " data-target ="#posts-{{ date }} " aria-expanded ="false " aria-controls ="posts-{{ date }} ">
16+ Ver posts
17+ </ button >
18+ < div class ="collapse " id ="posts-{{ date }} ">
19+ < ol >
20+ {% assign post_urls = posts | split: '|' %}
21+ {% for post_url in post_urls %}
22+ {%- assign post = site.posts | where: "url", post_url | first -%}
23+ < li > < a href ="{{ post.url | relative_url }} "> {{ post.title }}</ a > </ li >
24+ < small class ="text-muted "> - {{ post.date | date_to_long_string }}</ small >
25+ < br />
26+ {% endfor %}
27+ </ ol >
28+ </ div >
29+ </ div >
30+ < hr class ="bg-light ">
31+ {% endfor %}
Original file line number Diff line number Diff line change 77 < i class ="fas fa-search "> </ i >
88 </ span >
99 </ div >
10+ < button class ="btn btn-outline-primary ml-1 " onclick ="location.href = '{{ '/blog/calendar' | relative_url }}'; ">
11+ < i class ="fas fa-calendar "> </ i >
12+ </ button >
1013 < button class ="btn btn-outline-primary ml-1 " onclick ="location.href = '{{ '/blog/tags' | relative_url }}'; ">
1114 < i class ="fas fa-tags "> </ i >
1215 </ button >
You can’t perform that action at this time.
0 commit comments