mirror of
https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
synced 2025-06-20 09:04:42 +02:00
ajout d'image og dans les articles si existant
This commit is contained in:
parent
ce6eb680b7
commit
e1f8bf93e0
3 changed files with 25 additions and 7 deletions
|
@ -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'<h1>.*?</h1>', '', 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
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue