refactor: migrate to /blog subdirectory

pull/1/head
Nicolas Doby 2022-11-09 09:45:19 +01:00
parent 1d65e67ca4
commit 782f466ee6
17 changed files with 45 additions and 47 deletions

View File

@ -1,25 +1,25 @@
<div class="post-list"> <div class="post-list">
{% for post in postslist | reverse %} {% for article in articlesList | reverse %}
<article class="post-list-item"> <article class="post-list-item">
<header class="post-list-header"> <header class="post-list-header">
<h2> <h2>
<a href="{{ post.url }}" class="post-list-link">{% if post.data.title %}{{ post.data.title }}{% else %}<code>{{ post.url }}</code>{% endif %}</a> <a href="{{ article.url }}" class="post-list-link">{% if article.data.title %}{{ article.data.title }}{% else %}<code>{{ article.url }}</code>{% endif %}</a>
</h2> </h2>
<div class="post-metadata"> <div class="post-metadata">
<div> <div>
Le <time datetime="{{ post.data.date | htmlDateString }}">{{ post.data.date | readableDate }}</time> {{ post.data.authors | readableAuthors }} Le <time datetime="{{ article.data.date | htmlDateString }}">{{ article.data.date | readableDate }}</time> {{ article.data.authors | readableAuthors }}
</div> </div>
<ul > <ul >
{%- for tag in post.data.tags | filterTagList %} {%- for tag in article.data.tags | filterTagList %}
{%- set tagUrl %}/tags/{{ tag | slugify }}/{% endset %} {%- set tagUrl %}/tags/{{ tag | slugify }}/{% endset %}
<li><a href="{{ tagUrl }}" class="post-tag">#{{ tag }}</a>{%- if not loop.last %} {% endif %}</li> <li><a href="{{ tagUrl }}" class="post-tag">#{{ tag }}</a>{%- if not loop.last %} {% endif %}</li>
{%- endfor %} {%- endfor %}
</ul> </ul>
</div> </div>
</header> </header>
<p>{{ post.data.description }}</p> <p>{{ article.data.description }}</p>
<footer class="post-list-footer"> <footer class="post-list-footer">
<a href="{{ post.url }}">Lire la suite</a> <a href="{{ article.url }}">Lire la suite</a>
</footer> </footer>
</article> </article>
{% endfor %} {% endfor %}

View File

@ -1,6 +1,6 @@
{ {
"title": "Blog IT's on us", "title": "Blog IT's on us",
"url": "https://blog.itsonus.fr/", "url": "https://www.itsonus.fr/blog",
"language": "fr", "language": "fr",
"description": "Blog traitant de numérique responsable" "description": "Blog traitant de numérique responsable"
} }

View File

@ -1,5 +1,5 @@
--- ---
layout: base.njk layout: blog.njk
templateClass: tmpl-post templateClass: tmpl-post
--- ---
<div class="main-content"> <div class="main-content">
@ -21,15 +21,15 @@ templateClass: tmpl-post
<hr> <hr>
{%- if collections.posts %} {%- if collections.articles %}
{# these filters are locale-aware in 2.0.0-canary.14 #} {# these filters are locale-aware in 2.0.0-canary.14 #}
{%- set previousPost = collections.posts | getPreviousCollectionItem %} {%- set previousArticle = collections.articles | getPreviousCollectionItem %}
{%- set nextPost = collections.posts | getNextCollectionItem %} {%- set nextArticle = collections.articles | getNextCollectionItem %}
{%- if nextPost or previousPost %} {%- if nextArticle or previousArticle %}
<nav class="post-nav"> <nav class="post-nav">
<ul> <ul>
{%- if previousPost %}<li class="previous">Précédent : <a href="{{ previousPost.url }}">{{ previousPost.data.title }}</a></li>{% endif %} {%- if previousArticle %}<li class="previous">Précédent : <a href="{{ previousArticle.url }}">{{ previousArticle.data.title }}</a></li>{% endif %}
{%- if nextPost %}<li class="next">Suivant : <a href="{{ nextPost.url }}">{{ nextPost.data.title }}</a></li>{% endif %} {%- if nextArticle %}<li class="next">Suivant : <a href="{{ nextArticle.url }}">{{ nextArticle.data.title }}</a></li>{% endif %}
</ul> </ul>
</nav> </nav>
{%- endif %} {%- endif %}

View File

@ -8,8 +8,8 @@
<meta name="generator" content="{{ eleventy.generator }}"> <meta name="generator" content="{{ eleventy.generator }}">
<link rel="stylesheet" href="/assets/main.css?{{ cacheBust.mainCss }}"/> <link rel="stylesheet" href="/assets/main.css?{{ cacheBust.mainCss }}"/>
<link rel="stylesheet" media="print" href="/assets/print.css?{{ cacheBust.printCss }}" /> <link rel="stylesheet" media="print" href="/assets/print.css?{{ cacheBust.printCss }}" />
<link rel="alternate" href="/feed/feed.xml" type="application/atom+xml" title="{{ metadata.title }}"> <link rel="alternate" href="/blog/feed/feed.xml" type="application/atom+xml" title="{{ metadata.title }}">
<link rel="alternate" href="/feed/feed.json" type="application/json" title="{{ metadata.title }}"> <link rel="alternate" href="/blog/feed/feed.json" type="application/json" title="{{ metadata.title }}">
<link rel="icon" href="/images/favicon.svg"> <link rel="icon" href="/images/favicon.svg">
</head> </head>
<body class="container"> <body class="container">
@ -40,7 +40,7 @@
</a> </a>
</li> </li>
<li> <li>
<a href="/feed/feed.xml" download> <a href="/blog/feed/feed.xml" download>
<svg width="32" height="32" viewBox="0 0 461.432 461.432" xmlns="http://www.w3.org/2000/svg" aria-labelledby="title-rss"><title id="title-rss">Accéder au flux RSS du blog</title><g fill="#fff"><path d="M125.896 398.928c0 33.683-27.308 60.999-61.022 60.999-33.684 0-61.006-27.316-61.006-60.999 0-33.729 27.322-61.038 61.006-61.038 33.714 0 61.022 27.308 61.022 61.038zM0 229.636c0 8.441 6.606 15.379 15.036 15.809 60.318 3.076 100.885 25.031 138.248 62.582 36.716 36.864 60.071 89.759 64.082 137.769.686 8.202 7.539 14.524 15.77 14.524h56.701c4.344 0 8.498-1.784 11.488-4.935a15.852 15.852 0 004.333-11.729c-8.074-158.152-130.669-278.332-289.013-286.23a15.846 15.846 0 00-11.709 4.344A15.848 15.848 0 000 173.247v56.389z"/><path d="M0 73.411c0 8.51 6.713 15.482 15.216 15.819 194.21 7.683 350.315 161.798 358.098 355.879.34 8.491 7.32 15.208 15.818 15.208h56.457c4.297 0 8.408-1.744 11.393-4.834a15.857 15.857 0 004.441-11.552C453.181 199.412 261.024 9.27 16.38 1.121A15.844 15.844 0 004.838 5.568 15.842 15.842 0 000 16.954v56.457z"/></g> <svg width="32" height="32" viewBox="0 0 461.432 461.432" xmlns="http://www.w3.org/2000/svg" aria-labelledby="title-rss"><title id="title-rss">Accéder au flux RSS du blog</title><g fill="#fff"><path d="M125.896 398.928c0 33.683-27.308 60.999-61.022 60.999-33.684 0-61.006-27.316-61.006-60.999 0-33.729 27.322-61.038 61.006-61.038 33.714 0 61.022 27.308 61.022 61.038zM0 229.636c0 8.441 6.606 15.379 15.036 15.809 60.318 3.076 100.885 25.031 138.248 62.582 36.716 36.864 60.071 89.759 64.082 137.769.686 8.202 7.539 14.524 15.77 14.524h56.701c4.344 0 8.498-1.784 11.488-4.935a15.852 15.852 0 004.333-11.729c-8.074-158.152-130.669-278.332-289.013-286.23a15.846 15.846 0 00-11.709 4.344A15.848 15.848 0 000 173.247v56.389z"/><path d="M0 73.411c0 8.51 6.713 15.482 15.216 15.819 194.21 7.683 350.315 161.798 358.098 355.879.34 8.491 7.32 15.208 15.818 15.208h56.457c4.297 0 8.408-1.744 11.393-4.834a15.857 15.857 0 004.441-11.552C453.181 199.412 261.024 9.27 16.38 1.121A15.844 15.844 0 004.838 5.568 15.842 15.842 0 000 16.954v56.457z"/></g>
</svg> </svg>
</a> </a>

View File

@ -1,5 +1,5 @@
--- ---
layout: base.njk layout: blog.njk
templateClass: tmpl-home templateClass: tmpl-home
--- ---
{{ content | safe }} {{ content | safe }}

View File

@ -9,8 +9,8 @@ eleventyNavigation:
<nav> <nav>
{% include "tagslist.njk" %} {% include "tagslist.njk" %}
</nav> </nav>
{% set postslist = collections.posts %} {% set articlesList = collections.articles %}
{% include "postslist.njk" %} {% include "articlesList.njk" %}
</div> </div>
<aside class="right-side"> <aside class="right-side">
{% include "other_links.njk" %} {% include "other_links.njk" %}

View File

@ -1,5 +1,5 @@
{ {
"tags": [ "tags": [
"posts" "articles"
] ]
} }

View File

@ -8,14 +8,14 @@ tags:
- écoconception - écoconception
authors: authors:
- John Doe - John Doe
layout: post.njk layout: article.njk
--- ---
## Introduction ## Introduction
Leverage agile Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Semper quis lectus nulla at volutpat. Est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Duis tristique sollicitudin nibh sit amet commodo nulla facilisi. Enim diam vulputate ut pharetra sit amet. Placerat orci nulla pellentesque dignissim. Gravida rutrum quisque non tellus. Condimentum mattis pellentesque id nibh tortor id aliquet lectus proin. Diam sollicitudin tempor id eu nisl nunc mi ipsum faucibus. Tempor id eu nisl nunc mi. Cras pulvinar mattis nunc sed blandit libero volutpat sed cras. Eget magna fermentum iaculis eu non diam phasellus. Est lorem ipsum dolor sit amet consectetur adipiscing. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Velit scelerisque in dictum non consectetur a. Lectus sit amet est placerat. Viverra aliquet eget sit amet tellus cras adipiscing enim eu. Ut tristique et egestas quis ipsum suspendisse ultrices. Bibendum est ultricies integer quis auctor elit. Aliquam sem et tortor consequat id porta nibh. Leverage agile Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Semper quis lectus nulla at volutpat. Est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Duis tristique sollicitudin nibh sit amet commodo nulla facilisi. Enim diam vulputate ut pharetra sit amet. Placerat orci nulla pellentesque dignissim. Gravida rutrum quisque non tellus. Condimentum mattis pellentesque id nibh tortor id aliquet lectus proin. Diam sollicitudin tempor id eu nisl nunc mi ipsum faucibus. Tempor id eu nisl nunc mi. Cras pulvinar mattis nunc sed blandit libero volutpat sed cras. Eget magna fermentum iaculis eu non diam phasellus. Est lorem ipsum dolor sit amet consectetur adipiscing. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Velit scelerisque in dictum non consectetur a. Lectus sit amet est placerat. Viverra aliquet eget sit amet tellus cras adipiscing enim eu. Ut tristique et egestas quis ipsum suspendisse ultrices. Bibendum est ultricies integer quis auctor elit. Aliquam sem et tortor consequat id porta nibh.
to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.
![Un chaton](/images/blog/kitty_1.jpeg "Un chaton tout mignon 😍") ![Un chaton](/images/articles/kitty_1.jpeg "Un chaton tout mignon 😍")
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Semper quis lectus nulla at volutpat. Est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Duis tristique sollicitudin nibh sit amet commodo nulla facilisi. Enim diam vulputate ut pharetra sit amet. Placerat orci nulla pellentesque dignissim. Gravida rutrum quisque non tellus. Condimentum mattis pellentesque id nibh tortor id aliquet lectus proin. Diam sollicitudin tempor id eu nisl nunc mi ipsum faucibus. Tempor id eu nisl nunc mi. Cras pulvinar mattis nunc sed blandit libero volutpat sed cras. Eget magna fermentum iaculis eu non diam phasellus. Est lorem ipsum dolor sit amet consectetur adipiscing. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Velit scelerisque in dictum non consectetur a. Lectus sit amet est placerat. Viverra aliquet eget sit amet tellus cras adipiscing enim eu. Ut tristique et egestas quis ipsum suspendisse ultrices. Bibendum est ultricies integer quis auctor elit. Aliquam sem et tortor consequat id porta nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Semper quis lectus nulla at volutpat. Est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Duis tristique sollicitudin nibh sit amet commodo nulla facilisi. Enim diam vulputate ut pharetra sit amet. Placerat orci nulla pellentesque dignissim. Gravida rutrum quisque non tellus. Condimentum mattis pellentesque id nibh tortor id aliquet lectus proin. Diam sollicitudin tempor id eu nisl nunc mi ipsum faucibus. Tempor id eu nisl nunc mi. Cras pulvinar mattis nunc sed blandit libero volutpat sed cras. Eget magna fermentum iaculis eu non diam phasellus. Est lorem ipsum dolor sit amet consectetur adipiscing. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Velit scelerisque in dictum non consectetur a. Lectus sit amet est placerat. Viverra aliquet eget sit amet tellus cras adipiscing enim eu. Ut tristique et egestas quis ipsum suspendisse ultrices. Bibendum est ultricies integer quis auctor elit. Aliquam sem et tortor consequat id porta nibh.

View File

@ -7,7 +7,7 @@ tags:
authors: authors:
- Alice - Alice
- Bob - Bob
layout: post.njk layout: article.njk
--- ---
## Introduction ## Introduction
@ -54,6 +54,6 @@ console.log('Test');
## Conclusion ## Conclusion
![Un chaton](/images/blog/kitty_2.jpeg) ![Un chaton](/images/articles/kitty_2.jpeg)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Semper quis lectus nulla at volutpat. Est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Duis tristique sollicitudin nibh sit amet commodo nulla facilisi. Enim diam vulputate ut pharetra sit amet. Placerat orci nulla pellentesque dignissim. Gravida rutrum quisque non tellus. Condimentum mattis pellentesque id nibh tortor id aliquet lectus proin. Diam sollicitudin tempor id eu nisl nunc mi ipsum faucibus. Tempor id eu nisl nunc mi. Cras pulvinar mattis nunc sed blandit libero volutpat sed cras. Eget magna fermentum iaculis eu non diam phasellus. Est lorem ipsum dolor sit amet consectetur adipiscing. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Velit scelerisque in dictum non consectetur a. Lectus sit amet est placerat. Viverra aliquet eget sit amet tellus cras adipiscing enim eu. Ut tristique et egestas quis ipsum suspendisse ultrices. Bibendum est ultricies integer quis auctor elit. Aliquam sem et tortor consequat id porta nibh. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Semper quis lectus nulla at volutpat. Est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat. Duis tristique sollicitudin nibh sit amet commodo nulla facilisi. Enim diam vulputate ut pharetra sit amet. Placerat orci nulla pellentesque dignissim. Gravida rutrum quisque non tellus. Condimentum mattis pellentesque id nibh tortor id aliquet lectus proin. Diam sollicitudin tempor id eu nisl nunc mi ipsum faucibus. Tempor id eu nisl nunc mi. Cras pulvinar mattis nunc sed blandit libero volutpat sed cras. Eget magna fermentum iaculis eu non diam phasellus. Est lorem ipsum dolor sit amet consectetur adipiscing. Orci porta non pulvinar neque laoreet suspendisse interdum consectetur. Velit scelerisque in dictum non consectetur a. Lectus sit amet est placerat. Viverra aliquet eget sit amet tellus cras adipiscing enim eu. Ut tristique et egestas quis ipsum suspendisse ultrices. Bibendum est ultricies integer quis auctor elit. Aliquam sem et tortor consequat id porta nibh.

View File

@ -6,7 +6,7 @@ tags:
- accessibilité - accessibilité
authors: authors:
- John Murdock - John Murdock
layout: post.njk layout: article.njk
--- ---
## Introduction ## Introduction

View File

@ -1,6 +1,6 @@
--- ---
# Metadata comes from _data/metadata.json # Metadata comes from _data/metadata.json
permalink: /feed/feed.xml permalink: /blog/feed/feed.xml
--- ---
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ metadata.language }}"> <feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ metadata.language }}">
@ -8,20 +8,20 @@ permalink: /feed/feed.xml
<subtitle>{{ metadata.description }}</subtitle> <subtitle>{{ metadata.description }}</subtitle>
<link href="{{ permalink | htmlBaseUrl(metadata.url) }}" rel="self"/> <link href="{{ permalink | htmlBaseUrl(metadata.url) }}" rel="self"/>
<link href="{{ metadata.url | addPathPrefixToFullUrl }}"/> <link href="{{ metadata.url | addPathPrefixToFullUrl }}"/>
<updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated> <updated>{{ collections.articles | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<id>{{ metadata.url }}</id> <id>{{ metadata.url }}</id>
<author> <author>
<name>{{ metadata.author.name }}</name> <name>{{ metadata.author.name }}</name>
<email>{{ metadata.author.email }}</email> <email>{{ metadata.author.email }}</email>
</author> </author>
{%- for post in collections.posts | reverse %} {%- for article in collections.articles | reverse %}
{% set absolutePostUrl %}{{ post.url | htmlBaseUrl(metadata.url) }}{% endset %} {% set absolutePostUrl %}{{ article.url | htmlBaseUrl(metadata.url) }}{% endset %}
<entry> <entry>
<title>{{ post.data.title }}</title> <title>{{ article.data.title }}</title>
<link href="{{ absolutePostUrl }}"/> <link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | dateToRfc3339 }}</updated> <updated>{{ article.date | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id> <id>{{ absolutePostUrl }}</id>
<content type="html">{{ post.templateContent | transformWithHtmlBase(absolutePostUrl, post.url) }}</content> <content type="html">{{ article.templateContent | transformWithHtmlBase(absolutePostUrl, article.url) }}</content>
</entry> </entry>
{%- endfor %} {%- endfor %}
</feed> </feed>

View File

@ -1,6 +1,6 @@
--- ---
# Metadata comes from _data/metadata.json # Metadata comes from _data/metadata.json
permalink: /feed/feed.json permalink: /blog/feed/feed.json
--- ---
{ {
"version": "https://jsonfeed.org/version/1.1", "version": "https://jsonfeed.org/version/1.1",
@ -14,14 +14,14 @@ permalink: /feed/feed.json
"url": "{{ metadata.author.url }}" "url": "{{ metadata.author.url }}"
}, },
"items": [ "items": [
{%- for post in collections.posts | reverse %} {%- for article in collections.articles | reverse %}
{%- set absolutePostUrl = post.url | htmlBaseUrl(metadata.url) %} {%- set absoluteArticleUrl = article.url | htmlBaseUrl(metadata.url) %}
{ {
"id": "{{ absolutePostUrl }}", "id": "{{ absoluteArticleUrl }}",
"url": "{{ absolutePostUrl }}", "url": "{{ absoluteArticleUrl }}",
"title": "{{ post.data.title }}", "title": "{{ article.data.title }}",
"content_html": {% if post.templateContent %}{{ post.templateContent | transformWithHtmlBase(absolutePostUrl, post.url) | dump | safe }}{% else %}""{% endif %}, "content_html": {% if article.templateContent %}{{ article.templateContent | transformWithHtmlBase(absoluteArticleUrl, article.url) | dump | safe }}{% else %}""{% endif %},
"date_published": "{{ post.date | dateToRfc3339 }}" "date_published": "{{ article.date | dateToRfc3339 }}"
} }
{% if not loop.last %},{% endif %} {% if not loop.last %},{% endif %}
{%- endfor %} {%- endfor %}

View File

@ -5,15 +5,13 @@ eleventyNavigation:
order: 1 order: 1
--- ---
<div class="main-content"> <div class="main-content">
{% set maxPosts = collections.posts.length | min(5) %}
<h1 class="main-title">Blog numérique responsable</h1> <h1 class="main-title">Blog numérique responsable</h1>
<p class="sub-title">par le collectif IT's on us</p> <p class="sub-title">par le collectif IT's on us</p>
<nav> <nav>
{% include "tagslist.njk" %} {% include "tagslist.njk" %}
</nav> </nav>
{% set postslist = collections.posts | head(-5) %} {% set articlesList = collections.articles | head(-5) %}
{% set postslistCounter = collections.posts | length %} {% include "articlesList.njk" %}
{% include "postslist.njk" %}
</div> </div>
<aside class="right-side"> <aside class="right-side">
{% include "other_links.njk" %} {% include "other_links.njk" %}

View File

@ -17,8 +17,8 @@ permalink: /tags/{{ tag | slugify }}/
<div class="main-content"> <div class="main-content">
<h1>#{{ tag }}</h1> <h1>#{{ tag }}</h1>
{% set postslist = collections[ tag ] %} {% set articlesList = collections[ tag ] %}
{% include "postslist.njk" %} {% include "articlesList.njk" %}
</div> </div>
<aside class="right-side"> <aside class="right-side">
{% include "tagslist.njk" %} {% include "tagslist.njk" %}

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB