feat: implement Hugo site structure and configuration

- Add base template (baseof.html) for consistent layout
- Create home page (index.html) and content (_index.md)
- Update Hugo configuration (hugo.toml) for local development
- Improve list template with proper block definition
- Update .gitignore to exclude WordPress content
- Add .gitkeep to maintain posts directory structure
- Update package.json and dependencies
- Refactor fetch-wordpress.js to use dynamic import
- Update yarn.lock with latest dependencies
This commit is contained in:
kbe
2025-08-18 15:45:20 +02:00
parent 316e12b98a
commit 34084f1481
10 changed files with 128 additions and 6 deletions

6
.gitignore vendored
View File

@@ -158,3 +158,9 @@ dist
# End of https://www.toptal.com/developers/gitignore/api/node,hugo # End of https://www.toptal.com/developers/gitignore/api/node,hugo
# WordPress fetched content (auto-generated, should not be committed)
/data/wordpress/
/content/posts/
!content/posts/.gitkeep
hugo_stats.json

11
content/_index.md Normal file
View File

@@ -0,0 +1,11 @@
---
title: "Mistergeek - Blog High Tech"
date: 2025-08-18T13:41:00Z
draft: false
---
Bienvenue sur le blog Mistergeek, votre source d'informations sur la high-tech, l'informatique et les nouvelles technologies.
## Articles récents
Découvrez nos derniers articles sur les sujets high-tech du moment.

View File

@@ -1,7 +1,14 @@
baseURL = 'https://www.mistergeek.net/' baseURL = 'http://localhost:1313/'
languageCode = 'fr-fr' languageCode = 'fr-fr'
title = 'Mistergeek' title = 'Mistergeek'
# theme = "your-theme" # theme = "your-theme"
ignoreLogs = ["warning-goldmark-raw-html"]
[permalinks]
posts = "/posts/:slug/"
[markup.goldmark.renderer]
unsafe = true
# WordPress API Configuration # WordPress API Configuration
[params.wordpress] [params.wordpress]

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} - {{ .Site.Title }}{{ end }}</title>
<meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Title }}{{ end }}">
<link rel="canonical" href="{{ .Permalink }}">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<header>
<nav>
<a href="/">{{ .Site.Title }}</a>
<a href="/posts/">Articles</a>
</nav>
</header>
<main>
{{ block "main" . }}{{ end }}
</main>
<footer>
<p>&copy; {{ now.Format "2006" }} {{ .Site.Title }}. Tous droits réservés.</p>
</footer>
</body>
</html>

View File

@@ -1,3 +1,4 @@
{{ define "main" }}
<div class="posts-list"> <div class="posts-list">
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>

27
layouts/index.html Normal file
View File

@@ -0,0 +1,27 @@
{{ define "main" }}
<div class="home">
<section class="hero">
<h1>{{ .Site.Title }}</h1>
<p>{{ .Content }}</p>
</section>
<section class="recent-posts">
<h2>Articles récents</h2>
{{ range first 10 .Site.RegularPages }}
<article class="post-preview">
<h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<div class="post-meta">
<time>{{ .Date.Format "2 Jan 2006" }}</time>
{{ if .Params.author }}
<span>{{ .Params.author.name }}</span>
{{ end }}
</div>
{{ if .Params.excerpt }}
<p class="post-excerpt">{{ .Params.excerpt }}</p>
{{ end }}
<a href="{{ .RelPermalink }}" class="read-more">Lire la suite →</a>
</article>
{{ end }}
</section>
</div>
{{ end }}

6
package-lock.json generated Normal file
View File

@@ -0,0 +1,6 @@
{
"name": "mistergeek",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

View File

@@ -2,7 +2,6 @@
"name": "hugo-wordpress-blog", "name": "hugo-wordpress-blog",
"version": "1.0.0", "version": "1.0.0",
"description": "Hugo static site with WordPress content", "description": "Hugo static site with WordPress content",
{
"scripts": { "scripts": {
"fetch-data": "node scripts/fetch-wordpress.js", "fetch-data": "node scripts/fetch-wordpress.js",
"generate-content": "node scripts/generate-content.js", "generate-content": "node scripts/generate-content.js",
@@ -10,7 +9,7 @@
"build": "hugo --minify", "build": "hugo --minify",
"dev": "npm run fetch-data && npm run generate-content && hugo server -D", "dev": "npm run fetch-data && npm run generate-content && hugo server -D",
"clean": "rm -rf data/wordpress content/posts public" "clean": "rm -rf data/wordpress content/posts public"
} },
"dependencies": { "dependencies": {
"node-fetch": "^3.3.2" "node-fetch": "^3.3.2"
} }

View File

@@ -1,6 +1,6 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const fetch = require('node-fetch'); const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
const WORDPRESS_API = 'https://www.mistergeek.net/wp-json/wp/v2'; const WORDPRESS_API = 'https://www.mistergeek.net/wp-json/wp/v2';
const OUTPUT_DIR = path.join(__dirname, '..', 'data', 'wordpress'); const OUTPUT_DIR = path.join(__dirname, '..', 'data', 'wordpress');

View File

@@ -2,3 +2,41 @@
# yarn lockfile v1 # yarn lockfile v1
data-uri-to-buffer@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==
fetch-blob@^3.1.2, fetch-blob@^3.1.4:
version "3.2.0"
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"
integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==
dependencies:
node-domexception "^1.0.0"
web-streams-polyfill "^3.0.3"
formdata-polyfill@^4.0.10:
version "4.0.10"
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
dependencies:
fetch-blob "^3.1.2"
node-domexception@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
node-fetch@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b"
integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==
dependencies:
data-uri-to-buffer "^4.0.0"
fetch-blob "^3.1.4"
formdata-polyfill "^4.0.10"
web-streams-polyfill@^3.0.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"
integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==