Compare commits
3 Commits
3cc9d535ff
...
bd803eda00
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd803eda00 | ||
|
|
ac76ba32f6 | ||
|
|
c84ca1d538 |
43
.editorconfig
Normal file
43
.editorconfig
Normal file
@@ -0,0 +1,43 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# 4 space indentation (no tabs)
|
||||
[*.{js,jsx,ts,tsx,html,css,scss,md}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Set charset
|
||||
[*.{js,jsx,ts,tsx,html,css,scss,md}]
|
||||
charset = utf-8
|
||||
|
||||
# For Go files
|
||||
[*.go]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# For Python files
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# For JSON files
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# For YAML files
|
||||
[*.{yaml,yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# For TOML files
|
||||
[*.toml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
@@ -14,8 +14,8 @@ ignoreLogs = ["warning-goldmark-raw-html"]
|
||||
languageName = 'French'
|
||||
weight = 1
|
||||
|
||||
[taxonomies]
|
||||
category = "categories"
|
||||
# [taxonomies]
|
||||
# category = "categories"
|
||||
|
||||
[markup.goldmark.renderer]
|
||||
unsafe = true
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
<h1 class="fw-normal">{{ .Title }}</h1>
|
||||
<ul class="list-inline-dash">
|
||||
{{ if .Params.author }}
|
||||
<li><a href="/author/{{ .Params.author | urlize }}">{{ .Params.author }}</a></li>
|
||||
<li>Par <a href="/author/{{ .Params.author | urlize }}">{{ .Params.author }}</a></li>
|
||||
{{ end }}
|
||||
{{ with .Params.categories }}
|
||||
{{ range . }}
|
||||
<li><a href="/categories/{{ . | urlize }}">{{ . }}</a></li>
|
||||
<li>dans <a href="/categories/{{ . | urlize }}">{{ . }}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<li><a href="#">{{ .Date.Format "02/01/2006" }}</a></li>
|
||||
<li> le {{ .Date.Format "02/01/2006" }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div><!-- end row -->
|
||||
|
||||
161
layouts/author/index.html.old
Normal file
161
layouts/author/index.html.old
Normal file
@@ -0,0 +1,161 @@
|
||||
{{ define "main" }}
|
||||
<!-- Page Header -->
|
||||
<div class="section-sm bg-gray-lighter">
|
||||
<div class="container text-center">
|
||||
<h3 class="font-family-playfair">Authors</h3>
|
||||
<p class="mt-2">Discover all our talented authors and their contributions</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Authors Section -->
|
||||
<div class="section">
|
||||
<div class="container">
|
||||
<div class="row g-4">
|
||||
{{ $authors := slice }}
|
||||
{{ $authorMap := dict }}
|
||||
|
||||
<!-- Collect all unique authors -->
|
||||
{{ range .Site.RegularPages }}
|
||||
{{ if .Params.author }}
|
||||
{{ $authorName := .Params.author }}
|
||||
{{ $authorSlug := .Params.author_slug | default ($authorName | urlize) }}
|
||||
|
||||
<!-- Check if author already exists -->
|
||||
{{ $existing := false }}
|
||||
{{ range $authors }}
|
||||
{{ if eq .name $authorName }}
|
||||
{{ $existing = true }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<!-- Add new author if not exists -->
|
||||
{{ if not $existing }}
|
||||
{{ $author := dict
|
||||
"name" $authorName
|
||||
"slug" $authorSlug
|
||||
"bio" .Params.author_bio
|
||||
"photo" .Params.author_photo
|
||||
"website" .Params.author_website
|
||||
"twitter" .Params.author_twitter
|
||||
"linkedin" .Params.author_linkedin
|
||||
"posts" (slice)
|
||||
}}
|
||||
{{ $authors = $authors | append $author }}
|
||||
{{ $authorMap = merge $authorMap (dict $authorName $author) }}
|
||||
{{ end }}
|
||||
|
||||
<!-- Add post to author's posts -->
|
||||
{{ if $author := index $authorMap $authorName }}
|
||||
{{ $post := dict
|
||||
"title" .Title
|
||||
"permalink" .Permalink
|
||||
}}
|
||||
{{ $author := merge $author (dict "posts" ($author.posts | append $post)) }}
|
||||
{{ $authorMap = merge $authorMap (dict $authorName $author) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<!-- Display authors -->
|
||||
{{ if gt (len $authors) 0 }}
|
||||
{{ range $authors }}
|
||||
<div class="col-12 col-md-6 col-lg-4">
|
||||
<div class="team-box team-box-style-2">
|
||||
<div class="team-box-img">
|
||||
{{ if .photo }}
|
||||
<img src="{{ .photo }}" alt="{{ .name }}">
|
||||
{{ else }}
|
||||
<img src="/assets/images/avatar-placeholder.jpg" alt="{{ .name }}">
|
||||
{{ end }}
|
||||
<div class="team-box-content">
|
||||
<h5 class="font-family-poppins">{{ .name }}</h5>
|
||||
{{ if .bio }}
|
||||
<p class="font-small">{{ .bio | truncate 120 }}</p>
|
||||
{{ end }}
|
||||
|
||||
<div class="team-box-social">
|
||||
{{ if .website }}
|
||||
<a href="{{ .website }}" target="_blank" rel="noopener noreferrer">
|
||||
<i class="fas fa-globe"></i>
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ if .twitter }}
|
||||
<a href="https://twitter.com/{{ .twitter }}" target="_blank" rel="noopener noreferrer">
|
||||
<i class="fab fa-twitter"></i>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ if .linkedin }}
|
||||
<a href="https://linkedin.com/in/{{ .linkedin }}" target="_blank" rel="noopener noreferrer">
|
||||
<i class="fab fa-linkedin-in"></i>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
<a href="/author/{{ .slug }}" class="button-text-1">
|
||||
{{ len .posts }} {{ if eq (len .posts) 1 }}Article{{ else }}Articles{{ end }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<div class="col-12 text-center py-5">
|
||||
<h4>No authors found</h4>
|
||||
<p>No authors have been added yet. Check back soon!</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Additional Author Information Section -->
|
||||
{{ if gt (len $authors) 0 }}
|
||||
<div class="section bg-gray-lighter">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12 text-center">
|
||||
<h4 class="font-family-playfair mb-4">Our Authors</h4>
|
||||
<p class="max-width-600 mx-auto">
|
||||
Meet the talented writers and contributors who bring you insightful content across various topics.
|
||||
Each author brings their unique perspective and expertise to create valuable content for our readers.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-5">
|
||||
<div class="col-12">
|
||||
<div class="row g-3">
|
||||
{{ range $authors }}
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="d-flex align-items-center p-3 bg-white rounded">
|
||||
<div class="flex-shrink-0">
|
||||
{{ if .photo }}
|
||||
<img src="{{ .photo }}" alt="{{ .name }}" class="rounded-circle" width="60" height="60">
|
||||
{{ else }}
|
||||
<div class="bg-gray rounded-circle d-flex align-items-center justify-content-center" style="width: 60px; height: 60px;">
|
||||
<i class="fas fa-user"></i>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="flex-grow-1 ms-3">
|
||||
<h6 class="mb-1">{{ .name }}</h6>
|
||||
<small class="text-muted">{{ len .posts }} {{ if eq (len .posts) 1 }}publication{{ else }}publications{{ end }}</small>
|
||||
</div>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="/author/{{ .slug }}" class="btn btn-sm btn-outline-primary">
|
||||
<i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<div class="section-sm bg-gray-lighter">
|
||||
<div class="container text-center">
|
||||
<h3 class="font-family-playfair">Articles by {{ $authorName }}</h3>
|
||||
<h3 class="font-family-playfair">{{ .Title }}</h3>
|
||||
<p class="mt-2">Tous les articles écrits par {{ $authorName }}</p>
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
34
layouts/categories/list.html
Normal file
34
layouts/categories/list.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{{ define "main" }}
|
||||
{{ $defaultCategory := "General" }}
|
||||
{{ if .Site.Params.defaultCategory }}{{ $defaultCategory = .Site.Params.defaultCategory }}{{ end }}
|
||||
|
||||
<div class="section-sm bg-gray-lighter">
|
||||
<div class="container text-center">
|
||||
<h3 class="font-family-playfair">{{ .Title }}</h3>
|
||||
<p class="mt-3">Cette page répertorie toutes les catégories de notre site, offrant une vue d'ensemble structurée de notre contenu.</p>
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
|
||||
<!-- Blog section -->
|
||||
<div class="section">
|
||||
<div class="container">
|
||||
<div class="row g-4">
|
||||
<div class="col-12 col-sm-10 offset-sm-1 col-md-8 offset-md-2">
|
||||
{{ range $.Site.Data.wordpress.categories }}
|
||||
<div class="mb-5">
|
||||
<div class="mt-4">
|
||||
<h4><a class="text-link-1" href="{{ .link | relURL }}">{{ .name }}</a></h4>
|
||||
<p>{{ .description | safeHTML }}</p>
|
||||
<div class="mt-3">
|
||||
<a class="button-text-1" href="{{ .link | relURL }}">Voir la catégorie</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ if not .IsLast }}<hr class="my-5">{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div><!-- end row -->
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
<!-- end Blog section -->
|
||||
{{ end }}
|
||||
56
layouts/pages/list.html
Normal file
56
layouts/pages/list.html
Normal file
@@ -0,0 +1,56 @@
|
||||
{{ define "main" }}
|
||||
{{ $authorName := .Params.author }}
|
||||
{{ $authorSlug := .Params.author_slug }}
|
||||
{{ $authorPosts := where .Site.RegularPages "Params.author" $authorName }}
|
||||
|
||||
<div class="section-sm bg-gray-lighter">
|
||||
<div class="container text-center">
|
||||
<h3 class="font-family-playfair">{{ .Title }}</h3>
|
||||
<p class="mt-2">Retrouvez toutes les pages utiles du site ici.</p>
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
|
||||
<!-- Blog section -->
|
||||
<div class="section">
|
||||
<div class="container">
|
||||
<div class="row g-4">
|
||||
<div class="col-12 col-sm-10 offset-sm-1 col-md-8 offset-md-2">
|
||||
{{ $paginationLimit := 10 }}
|
||||
{{ if .Site.Params.paginationLimit }}{{ $paginationLimit = .Site.Params.paginationLimit }}{{ end }}
|
||||
{{ $paginator := .Paginate $authorPosts $paginationLimit }}
|
||||
|
||||
{{ if gt (len $authorPosts) 0 }}
|
||||
{{ range $paginator.Pages }}
|
||||
<!-- Blog Post box -->
|
||||
<div class="mb-5">
|
||||
<div class="mt-4">
|
||||
<h4><a class="text-link-1" href="{{ .RelPermalink }}">{{ .Title }}</a></h4>
|
||||
{{ if .Params.excerpt }}
|
||||
<p>{{ .Params.excerpt }}</p>
|
||||
{{ else if .Summary }}
|
||||
<p>{{ .Summary }}</p>
|
||||
{{ else }}
|
||||
<p>{{ truncate 200 .Content }}</p>
|
||||
{{ end }}
|
||||
<div class="mt-3">
|
||||
<a class="button-text-1" href="{{ .RelPermalink }}">Lire la suite</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Blog Post box -->
|
||||
{{ end }}
|
||||
|
||||
<!-- Pagination -->
|
||||
{{ partial "pagination.html" (dict "Paginator" .Paginator "Page" .) }}
|
||||
{{ else }}
|
||||
<div class="text-center py-5">
|
||||
<h4>Aucun article trouvé</h4>
|
||||
<p>Aucun article n'a été trouvé pour cet auteur.</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div><!-- end row -->
|
||||
</div><!-- end container -->
|
||||
</div>
|
||||
<!-- end Blog section -->
|
||||
{{ end }}
|
||||
@@ -28,7 +28,7 @@
|
||||
{{ $count := 0 }}
|
||||
{{ range $index, $element := .Site.Data.wordpress.categories }}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/categories/{{ $element.slug }}">{{ $element.name }}</a>
|
||||
<a class="nav-link" href="/{{ $element.slug }}">{{ $element.name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
@@ -68,12 +68,63 @@ async function generateData() {
|
||||
modified: page.modified
|
||||
}));
|
||||
|
||||
// Create author-post mapping
|
||||
const authorPosts = {};
|
||||
posts.forEach(post => {
|
||||
if (post.status === 'publish') {
|
||||
const author = post._embedded?.author?.[0];
|
||||
if (author) {
|
||||
const authorSlug = author.slug;
|
||||
if (!authorPosts[authorSlug]) {
|
||||
authorPosts[authorSlug] = {
|
||||
id: author.id,
|
||||
name: author.name,
|
||||
slug: author.slug,
|
||||
description: author.description || '',
|
||||
avatar: author.avatar_urls || {},
|
||||
link: author.link,
|
||||
posts: []
|
||||
};
|
||||
}
|
||||
authorPosts[authorSlug].posts.push({
|
||||
id: post.id,
|
||||
title: post.title.rendered,
|
||||
slug: post.slug,
|
||||
date: post.date,
|
||||
excerpt: post.excerpt.rendered,
|
||||
featured_image: post._embedded?.['wp:featuredmedia']?.[0]?.source_url || '',
|
||||
categories: (post._embedded?.['wp:term']?.[0] || []).map(cat => ({
|
||||
id: cat.id,
|
||||
name: cat.name,
|
||||
slug: cat.slug
|
||||
})),
|
||||
tags: (post._embedded?.['wp:term']?.[1] || []).map(tag => ({
|
||||
id: tag.id,
|
||||
name: tag.name,
|
||||
slug: tag.slug
|
||||
}))
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Save data as JSON files
|
||||
fs.writeFileSync(path.join(OUTPUT_DIR, 'posts.json'), JSON.stringify(posts, null, 2));
|
||||
fs.writeFileSync(path.join(OUTPUT_DIR, 'pages.json'), JSON.stringify(publishedPages, null, 2));
|
||||
// Extract category descriptions
|
||||
const categoriesWithDescriptions = categories.map(cat => ({
|
||||
id: cat.id,
|
||||
name: cat.name,
|
||||
slug: cat.slug,
|
||||
description: cat.description || '',
|
||||
count: cat.count || 0
|
||||
}));
|
||||
|
||||
// Also save to wordpress directory
|
||||
fs.writeFileSync(path.join(OUTPUT_DIR, 'categories.json'), JSON.stringify(categories, null, 2));
|
||||
fs.writeFileSync(path.join(OUTPUT_DIR, 'tags.json'), JSON.stringify(tags, null, 2));
|
||||
fs.writeFileSync(path.join(OUTPUT_DIR, 'authors.json'), JSON.stringify(authors, null, 2));
|
||||
fs.writeFileSync(path.join(OUTPUT_DIR, 'author-posts.json'), JSON.stringify(authorPosts, null, 2));
|
||||
fs.writeFileSync(path.join(OUTPUT_DIR, 'navigation.json'), JSON.stringify(navigationData, null, 2));
|
||||
|
||||
console.log(`✅ Fetched ${posts.length} posts, ${publishedPages.length} pages, ${categories.length} categories, ${tags.length} tags, ${authors.length} authors`);
|
||||
|
||||
@@ -161,22 +161,47 @@ function generateAuthorDirectories(posts) {
|
||||
fs.mkdirSync(AUTHORS_DIR, { recursive: true });
|
||||
}
|
||||
|
||||
// Group posts by author
|
||||
// Group posts by author using proper author data
|
||||
const postsByAuthor = {};
|
||||
|
||||
posts.forEach(post => {
|
||||
const authorName = post._embedded?.author?.[0]?.name || 'Unknown';
|
||||
const authorSlug = authorName.toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]/g, '');
|
||||
const author = post._embedded?.author?.[0];
|
||||
if (author) {
|
||||
const authorSlug = author.slug;
|
||||
const authorName = author.name;
|
||||
|
||||
if (!postsByAuthor[authorSlug]) {
|
||||
postsByAuthor[authorSlug] = {
|
||||
name: authorName,
|
||||
slug: authorSlug,
|
||||
posts: []
|
||||
};
|
||||
if (!postsByAuthor[authorSlug]) {
|
||||
postsByAuthor[authorSlug] = {
|
||||
id: author.id,
|
||||
name: authorName,
|
||||
slug: authorSlug,
|
||||
description: author.description || '',
|
||||
avatar: author.avatar_urls || {},
|
||||
link: author.link,
|
||||
posts: []
|
||||
};
|
||||
}
|
||||
|
||||
postsByAuthor[authorSlug].posts.push(post);
|
||||
} else {
|
||||
// Handle unknown author
|
||||
const unknownSlug = 'unknown';
|
||||
const unknownName = 'Unknown';
|
||||
|
||||
if (!postsByAuthor[unknownSlug]) {
|
||||
postsByAuthor[unknownSlug] = {
|
||||
id: 0,
|
||||
name: unknownName,
|
||||
slug: unknownSlug,
|
||||
description: '',
|
||||
avatar: {},
|
||||
link: '',
|
||||
posts: []
|
||||
};
|
||||
}
|
||||
|
||||
postsByAuthor[unknownSlug].posts.push(post);
|
||||
}
|
||||
|
||||
postsByAuthor[authorSlug].posts.push(post);
|
||||
});
|
||||
|
||||
// Create author directories and index pages
|
||||
@@ -187,13 +212,17 @@ function generateAuthorDirectories(posts) {
|
||||
fs.mkdirSync(authorDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Generate author index page
|
||||
// Generate author index page with proper metadata
|
||||
const frontmatter = {
|
||||
title: `Lise des articles de ${author.name}`,
|
||||
title: `Articles de ${author.name}`,
|
||||
type: 'authors',
|
||||
layout: 'list',
|
||||
author: author.name,
|
||||
author_slug: author.slug
|
||||
author_slug: author.slug,
|
||||
description: author.description,
|
||||
avatar: author.avatar,
|
||||
link: author.link,
|
||||
post_count: author.posts.length
|
||||
};
|
||||
|
||||
const content = `---
|
||||
|
||||
Reference in New Issue
Block a user