Files
learn/scripts/ajouterSujet.js
T
Puechberty Arthur 5bf8a8d60f feat: add new features including SEO, sitemap, and subjects management
- Create robots.txt to allow search engine indexing and specify sitemap location.
- Implement ajouterSujet.js for adding new subjects to sujets.json.
- Develop dynamic subject pages in page.tsx using static generation with metadata.
- Add contact, error, not found, and privacy policy pages for improved user experience.
- Generate sitemap.xml for better search engine visibility.
- Create SEO component for managing page metadata.
- Populate sujets.json with detailed subject information for dynamic content rendering.
2026-03-30 22:42:27 +02:00

25 lines
633 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import fs from 'fs';
/**
* Ajoute un nouveau sujet au fichier sujets.json
* @param {object} sujet - Objet sujet à ajouter
*/
export function ajouterSujet(sujet) {
const filePath = './src/data/sujets.json';
const data = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
data.push(sujet);
fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
}
/**
* Exemple dutilisation :
* ajouterSujet({
* slug: 'nouveau-sujet',
* title: 'Titre',
* description: 'Description',
* image1: { src: '/images/xxx.jpg', alt: '...' },
* image2: { src: '/images/yyy.jpg', alt: '...' },
* sections: [ ... ]
* });
*/