bigsmooth68.github.io

Créer un Blog sur github.io

Pour ce premier post, je vais expliquer comment j’ai mis en place ce blog sur gitpage.

Créer deux repo: BlogSources et Bigsmooth68.github.io. Activer github pages pour ce dernier.

Dans le répertoire de son choix, créer le nouveau site avec la commande hugo (le binaire d’hugo doit être installé au préalable avec, par exemple, chocolatey: choco install hugo).

hugo new site BlogSources
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/Bigsmooth68/BlogSources.git
git push -u origin main

Créer un fichier .gitignore à l’aide de toptal.com gitignore:

https://www.toptal.com/developers/gitignore/api/visualstudiocode,hugo

Cloner le repo du thème de son choix:

git clone https://github.com/lukeorth/poison.git themes/poison --depth=1

Mettre à jour le config.toml (notamment le thème). Lien ici.

Ajouter le repo github dans public:

git submodule add -f https://github.com/Bigsmooth68/Bigsmooth68.github.io public

Générer le site:

hugo -t poison

Ajouter l’about:

hugo new page/about.md

Ajouter un post:

mkdir blog
hugo new posts/créer_un_blog_sur_github.io.md

Ajouter le code généré dans le repo:

cd public
git commit -m 'Initial commit'
git push

Patienter quelques secondes que le pipeline mettent à jour le contenu …

Référence: Creating a Free Blog or Static Content Website with Hugo and GitHub Pages with Custom Domain and Ads