From 34084f14812cf431f4ea4394ea69a230b514e389 Mon Sep 17 00:00:00 2001 From: kbe Date: Mon, 18 Aug 2025 15:45:20 +0200 Subject: [PATCH] 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 --- .gitignore | 6 +++++ content/_index.md | 11 +++++++++ hugo.toml | 9 +++++++- layouts/_default/baseof.html | 27 ++++++++++++++++++++++ layouts/_default/list.html | 3 ++- layouts/index.html | 27 ++++++++++++++++++++++ package-lock.json | 6 +++++ docs/package.json => package.json | 5 ++-- scripts/fetch-wordpress.js | 2 +- yarn.lock | 38 +++++++++++++++++++++++++++++++ 10 files changed, 128 insertions(+), 6 deletions(-) create mode 100644 content/_index.md create mode 100644 layouts/_default/baseof.html create mode 100644 layouts/index.html create mode 100644 package-lock.json rename docs/package.json => package.json (98%) diff --git a/.gitignore b/.gitignore index e2ed74a..39c68f0 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,9 @@ dist # 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 + diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..01e81fa --- /dev/null +++ b/content/_index.md @@ -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. \ No newline at end of file diff --git a/hugo.toml b/hugo.toml index 09c3547..15acea7 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1,7 +1,14 @@ -baseURL = 'https://www.mistergeek.net/' +baseURL = 'http://localhost:1313/' languageCode = 'fr-fr' title = 'Mistergeek' # theme = "your-theme" +ignoreLogs = ["warning-goldmark-raw-html"] + +[permalinks] + posts = "/posts/:slug/" + +[markup.goldmark.renderer] + unsafe = true # WordPress API Configuration [params.wordpress] diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..6e72a20 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,27 @@ + + + + + + {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} - {{ .Site.Title }}{{ end }} + + + + + +
+ +
+ +
+ {{ block "main" . }}{{ end }} +
+ + + + \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index f65c8d1..9b1b22a 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,6 +1,7 @@ +{{ define "main" }}

{{ .Title }}

- + {{ range .Pages }}

{{ .Title }}

diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..02c1ae2 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,27 @@ +{{ define "main" }} +
+
+

{{ .Site.Title }}

+

{{ .Content }}

+
+ +
+

Articles récents

+ {{ range first 10 .Site.RegularPages }} +
+

{{ .Title }}

+ + {{ if .Params.excerpt }} +

{{ .Params.excerpt }}

+ {{ end }} + Lire la suite → +
+ {{ end }} +
+
+{{ end }} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..022addb --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "mistergeek", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/docs/package.json b/package.json similarity index 98% rename from docs/package.json rename to package.json index 27d8d95..12a99f7 100644 --- a/docs/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "hugo-wordpress-blog", "version": "1.0.0", "description": "Hugo static site with WordPress content", - { "scripts": { "fetch-data": "node scripts/fetch-wordpress.js", "generate-content": "node scripts/generate-content.js", @@ -10,8 +9,8 @@ "build": "hugo --minify", "dev": "npm run fetch-data && npm run generate-content && hugo server -D", "clean": "rm -rf data/wordpress content/posts public" - } + }, "dependencies": { "node-fetch": "^3.3.2" } -} \ No newline at end of file +} diff --git a/scripts/fetch-wordpress.js b/scripts/fetch-wordpress.js index 41e1712..290e176 100644 --- a/scripts/fetch-wordpress.js +++ b/scripts/fetch-wordpress.js @@ -1,6 +1,6 @@ const fs = require('fs'); 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 OUTPUT_DIR = path.join(__dirname, '..', 'data', 'wordpress'); diff --git a/yarn.lock b/yarn.lock index fb57ccd..2fea345 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,3 +2,41 @@ # 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==