fix links for next and previous articles

This commit is contained in:
Tykayn 2025-02-20 16:30:08 +01:00 committed by tykayn
parent 072eafc751
commit b1c8937fc9
9 changed files with 69 additions and 52 deletions

View file

@ -71,7 +71,7 @@ for file_name in os.listdir(directory):
files_dict[f"{annee}/{slug}"] = {
'path': file_path,
'basename': basename,
'slug': slug,
'slug': f"{slug}/",
'slug_with_year': f"{annee}/{slug}",
'date': boom[0],
'date_modified' : date_modified,
@ -142,7 +142,7 @@ 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_others=sorted_articles[10:]
articles_others=sorted_articles
)
# Écrire le fichier de sortie
@ -181,6 +181,11 @@ def generate_article_pages(json_file, template_file, output_dir):
# Construire le chemin de sortie en fonction du slug avec l'année
output_subdir = os.path.join(output_dir, article['slug_with_year'])
print('make subdir: ',output_subdir)
os.makedirs(output_subdir, exist_ok=True)
output_file = os.path.join(output_subdir ,"index.html")