Skip to content

Commit

Permalink
Merge pull request #72 from devlille/fix/press
Browse files Browse the repository at this point in the history
fix(press): display articles by year.
  • Loading branch information
EmmanuelDemey authored Oct 14, 2024
2 parents 29111e6 + 004c570 commit fdafc79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ export default function (eleventyConfig) {
eleventyConfig.addCollection("press", async () => {
return Object.entries(press)
.sort(([year], [year2]) => year2 - year)
.map(([year, articles]) => articles)
.flat();
.map(([year, articles]) => {
return {
year: year,
articles: articles
}
});
});
eleventyConfig.addCollection("faqs", async () => {
try {
Expand Down
11 changes: 7 additions & 4 deletions press.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
<article class="page-body">
<h2>On parle de nous</h2>

<h3>2024</h3>
{%- for press in collections.press -%}
<h3>{{ press.year }}</h3>

<dl class="press">
{%- for p in collections.press -%}
{%- for article in press.articles -%}
<div>
<dt>
<a href="{{p.url}}">{{p.title }}</a>
<a href="{{p.url}}">{{ article.title }}</a>
</dt>
<dd>Publié sur {{p.publishedBy}} le {{p.publishedAt}}</dd>
<dd>Publié sur {{article.publishedBy}} le {{article.publishedAt}}</dd>
</div>
{%- endfor -%}
</dl>

{%- endfor -%}
</article>

0 comments on commit fdafc79

Please sign in to comment.