diff --git a/linking_articles_prev_next.py b/linking_articles_prev_next.py
index 7fa38557..32f7821d 100644
--- a/linking_articles_prev_next.py
+++ b/linking_articles_prev_next.py
@@ -87,7 +87,7 @@ Navigation:
try:
with open(destination_gmi+'/'+output_filename_slug+'.gmi', 'w', encoding='utf-8') as f:
f.write(output)
- # print(f"Fichier GMI sauvegardé avec succès : {output_filename_slug}")
+ print(f"Fichier GMI sauvegardé avec succès : {output_filename_slug}")
except OSError as e:
print(f"Erreur lors de la sauvegarde du fichier : {e}")
return output
@@ -188,7 +188,7 @@ if generate_linkings_json :
'last_gemini_build': last_gemini_build,
'org_content': content, # Contenu Org original
'html_content_without_h1': re.sub(r'
.*?
', '', html_content), # Contenu HTML converti sans le titre de premier niveau
- 'html_content': html_content # Contenu HTML converti
+ 'html_content': html_content # Contenu first_picture_urlHTML converti
}
# Trier les basenames par ordre décroissant
@@ -336,11 +336,18 @@ def generate_article_pages(json_file, template_file, output_dir):
# Configurer Jinja2
env = Environment(loader=FileSystemLoader('.'))
template = env.get_template(template_file)
-
+ template_content = get_blog_template_conf(args.blog)
+
# Générer les pages pour chaque article
for article in articles_info.values():
+
+ if article['first_picture_url']:
+ template_content['OG_IMAGE'] = article['first_picture_url']
+ else:
+ template_content['OG_IMAGE'] = template_content['SITE_ICON']
+
output_html = template.render(
- template_content=get_blog_template_conf(args.blog),
+ template_content=template_content,
article=article,
all_articles=articles_info
)
diff --git a/new_article.py b/new_article.py
index 339886d4..21abe043 100644
--- a/new_article.py
+++ b/new_article.py
@@ -11,11 +11,13 @@ parser = argparse.ArgumentParser(description="Générer un nouvel article en mod
parser.add_argument("--title", nargs="?", help="Le titre de l'article.")
parser.add_argument("--lang", nargs="?", default="fr", help="La langue de l'article (par défaut : fr pour Français ou en pour English).")
parser.add_argument("--blog_dir", nargs="?", default=None, help="Le nom du dossier de blog (sous source/). Si non spécifié, une liste de dossiers disponibles sera proposée.")
+parser.add_argument("--year_prefix_in_slug", nargs="?", default=True, help="Ajouter l'année au début du slug.")
args = parser.parse_args()
# Définition du dossier de base pour les blogs
base_blog_dir = "sources/"
+year_prefix_in_slug = args.year_prefix_in_slug
# Si aucun dossier de blog n'est spécifié, proposer une sélection
if args.blog_dir is None:
@@ -67,6 +69,12 @@ if args.title:
slug = args.title.lower().replace(" ", "-")
slug = slug.replace("--", "-")
slug = slug.replace("--", "-")
+
+if year_prefix_in_slug:
+ schema_slug = f"{now.year}/{slug}"
+else:
+ schema_slug = slug
+
file_abs_path = os.path.abspath(os.path.dirname(__file__))
if args.lang == 'fr' or args.lang == 'en':
@@ -91,13 +99,16 @@ with open(filename, "w") as f:
#+title: {args.title}
#+post_ID:
-#+post_slug: organisation-de-taches-orgmode
-#+post_url: https://www.ciperbliss.com/{now.year}/{slug}
+#+post_slug: {slug}
+
+
+#+post_url: https://www.ciperbliss.com/{schema_slug}
#+post_title: {args.title}
#+post_tags:
#+post_series:
#+post_type: post
#+post_status: publish
+#+post_picture:
#+post_date_published: <{date_string_full}>
#+post_date_modified: <{date_string_full}>
#+post_index_page_roam_id: {uuid}
diff --git a/templates/html/article.html.jinja b/templates/html/article.html.jinja
index da238ccc..9efb7020 100644
--- a/templates/html/article.html.jinja
+++ b/templates/html/article.html.jinja
@@ -4,7 +4,7 @@
-
+