This tool automatically generates dynamic cover images for blog articles and pages, and updates their metadata to reference those images for social network display.
Ensure you have ImageMagick installed for optimal image generation:
# macOS
brew install imagemagick
# Ubuntu/Debian
sudo apt-get install imagemagick
# Windows
# Download from: https://imagemagick.org/script/download.php
Install dependencies:
npm install
# Generate images for all blog articles and pages
npm run build:social-images
# Or run directly
node generate_social_images.js
You can also import and use the generator in other scripts:
const SocialImageGenerator = require('./generate_social_images.js');
const generator = new SocialImageGenerator();
generator.run().catch(console.error);
The generator can be configured by modifying the CONFIG object in generate_social_images.js:
const CONFIG = {
sourceDirs: [
'blogue/**/*.md',
'pages/**/*.md'
],
outputDir: 'static/images/social',
imageWidth: 1200,
imageHeight: 630,
fontPath: 'static/fonts/FiraSans',
defaultColors: {
background: '#1a1a2e',
text: '#ffffff',
accent: '#f39c12'
},
processedMarker: 'social_image_generated'
};
Different categories use different color themes:
You can customize these in the COLOR_SCHEMES object.
Images are saved to static/static/images/social/ with filenames based on the source markdown file paths.
Each processed file gets its frontmatter updated with:
social_image: static/images/social/blogue-2025-2025-10-19-utilisation-de-grands-modeles-de-langage-localement-en-recherche.png
social_image_width: 1200
social_image_height: 630
social_image_alt: "Article Title - Social media cover image"
social_image_generated: true
A .processed.json file is created in the output directory to track processed files and avoid duplicate work.
---
title: Communauté DALIAS - Utilisation de grands modèles de langage localement en recherche
date: '2025-10-05'
categories:
- collaborations
tags:
- intelligence-artificielle
- academique
- python
- ollama
- transformers
- dalias
- communaute
- sante
- donnees
- vie-privee
---
---
title: Communauté DALIAS - Utilisation de grands modèles de langage localement en recherche
date: '2025-10-05'
categories:
- collaborations
tags:
- intelligence-artificielle
- academique
- python
- ollama
- transformers
- dalias
- communaute
- sante
- donnees
- vie-privee
social_image: static/images/social/blogue-2025-2025-10-19-utilisation-de-grands-modeles-de-langage-localement-en-recherche.png
social_image_width: 1200
social_image_height: 630
social_image_alt: "Communauté DALIAS - Utilisation de grands modèles de langage localement en recherche - Social media cover image"
social_image_generated: true
---
The generated social image metadata can be used in your Eleventy templates:
If ImageMagick is not installed, the generator will fall back to creating simple placeholder images. For best results, install ImageMagick.
Ensure you have write permissions for:
static/static/images/social/ directoryRun npm install to ensure all required dependencies are installed.
This project is licensed under the same terms as the main project.