index lié aux articles

This commit is contained in:
Tykayn 2025-02-19 22:52:44 +01:00 committed by tykayn
parent b31dcd6f8a
commit 7c88fb7314
2 changed files with 45 additions and 22 deletions

View file

@ -91,17 +91,6 @@ for basename, info in files_dict.items():
print(f"Nombre d'articles mis à jour après le 01 01 2024 : {count_articles_updated}")
# Afficher le dictionnaire pour vérification
# for basename, info in files_dict.items():
# print(f"Article: {basename}")
# print(f" Path: {info['path']}")
# print(f" tags: {info['tags']}")
# print(f" title: {info['title']}")
# print(f" Previous: {info['previous']}")
# print(f" Next: {info['next']}")
# print("-" * 40)
def generate_blog_index(json_file, template_file, output_file):
"""
Génère la page d'index du blog à partir des informations JSON et d'un template Jinja2.
@ -125,7 +114,8 @@ def generate_blog_index(json_file, template_file, output_file):
output_html = template.render(
template_content=configs_sites[args.blog],
articles=sorted_articles[:global_config['posts_per_page']],
articles_info=articles_info
articles_others=sorted_articles[10:]
)
# Écrire le fichier de sortie

View file

@ -4,11 +4,11 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:image" content="{{template_content['SITE_ICON']}">
<meta property="og:locale" content="{{template_content['LOCALE']}">
<meta property="og:description" content="{{template_content['BLOG_SUBTITLE']}">
<meta property="og:url" content="{{template_content['NDD']}">
<meta property="og:site_name" content="{{template_content['TITLE']}">
<meta property="og:image" content="{{template_content['SITE_ICON']}}">
<meta property="og:locale" content="{{template_content['LOCALE']}}">
<meta property="og:description" content="{{template_content['BLOG_SUBTITLE']}}">
<meta property="og:url" content="{{template_content['NDD']}}">
<meta property="og:site_name" content="{{template_content['TITLE']}}">
<link rel="alternate" type="application/atom+xml" title="Cipher Bliss » Flux"
href="{{template_content['NDD']}}/feed/">
<link href="/style.css" rel="stylesheet">
@ -30,13 +30,13 @@
<body>
<div id="page" class="page__{{template_content[" PAGE_SLUG"]}}">
<header id="masthead" class="site-header">
<div class="header-image"
style="background-image: url({{template_content['BANNIERE_ENTETE']}}); background-repeat: no-repeat; background-size: cover;">
<div class="header-image" style="background-image: url('{{template_content[" BANNIERE_ENTETE"]}}');
background-repeat: no-repeat; background-size: cover;">
<a href="/">
<img src="{{template_content['SITE_ICON']}}" class="site-icon img">
</a>
<h1 class="blog-title">{template_content['BLOG_TITLE']}</h1>
<p class="blog-subtitle">{template_content['BLOG_SUBTITLE']}</p>
<h1 class="blog-title">{{template_content['BLOG_TITLE']}}</h1>
<p class="blog-subtitle">{{template_content['BLOG_SUBTITLE']}}</p>
<div class="template-header">
</div>
@ -71,10 +71,43 @@
<main class="body-wrap boxed-container">
{% for article in articles %}
<article class="content">
<a href="{{ article.slug }}">{{ article.title }}</a>
<div class="article-title">
<a href="{{ article.slug_with_year }}">{{ article.title }}</a>
</div>
<div class="article-date">
{{article.date}}
</div>
<div>{{ article.html_content | safe }}</div>
<div class="article-tags">
{% if articles_others %}
Tags:
{% for tag in article.tags %}
<a href="/tags/{{ tag }}">{{ tag }}</a>
{% endfor %}
{% endif %}
</div>
</article>
{% endfor %}
<hr />
{% if articles_others %}
<div class="more-articles">
<p>Y'en a un peu plus, je vous le mets...</p>
</div>
{% endif %}
{% for article in articles_others %}
<article class="content">
<div class="article-title">
<a href="{{ article.slug_with_year }}">
<span class="article-date-inline">
{{article.date}}
</span> {{ article.title }}
</a>
</div>
</article>
{% endfor %}
</main>
<footer class="site-footer has-top-divider">
<div class="container">