User Tools

Site Tools


staticgenerators:hugo

This is an old revision of the document!


Hugo

Essai de remplacement de mon site type-one.net en Drupal.

Installation

sudo apt install hugo

Premiers pas

Créer le site et importer le thème (xmin) :

hugo new site type1
cd type1
git init
git submodule add https://github.com/yihui/hugo-xmin.git themes/xmin

adapter le fichier de configuration hugo.toml :

baseURL = 'https://type-one.net/' 
languageCode = 'en-us' 
title = 'type-one.net' 
theme = "xmin" 
paginate = 10 
enableRobotsTXT = true 
 
[params] 
  description = "Vintage Magic: the Gathering tournament reports of yore" 
 
[taxonomies] 
  category = "categories" 
  tag = "tags" 
 
[menu] 
  [[menu.main]] 
    name = "home" 
    url = "/" 
    weight = 1 
 
  [[menu.main]] 
    name = "reports" 
    url = "/reports" 
    weight = 2 
 
  [[menu.main]] 
    name = "Articles" 
    url = "/posts/" 
    weight = 3

Avertissement

Quand je veux ajouter une page, j'obtiens ceci :

WARN  Module "xmin" is not compatible with this Hugo version: Min 0.146.0; run "hugo mod graph" for more information.

Solution, dans theme/xmin/theme.toml, changer la version minimale à 0.20.0 :

#min_version = "0.146.0"
min_version = "0.146.0"

Créer une nouvelle page

hugo new content/reset2026.md

La page s'ouvre dans vi. Ensuite, on peut la rééditer avec vi par la suite.

Il faut utiliser le markdown qui génèrera le code HTML.

# titre H1
## titre H2
### titre H3

*italique*
**gras**
***italique + gras***

[Texte du lien](https://example.com)
![Texte alternatif](chemin/vers/image.jpg)

- élément 1
- élément 2
- élément 3

1. Premier
2. Deuxième
3. Troisième

> Ceci est une citation.

```bash
hugo server -D
```

HR : ---

| Colonne 1 | Colonne 2 |
|----------|-----------|
| Valeur A | Valeur B  |

Voici une phrase avec une note.[^1]

[^1]: Ceci est la note.

Changement de thème

Apparemment, il vaut mieux choisir un autre thème pour commencer, j'opte pour PaperMod. Mais vu que j'ai la version Debian stable, c'est la version 0.131.0 d'hugo, il faut donc utiliser la version 7.0 de PaperMod.

cd type1
cd themes
git clone https://github.com/adityatelange/hugo-PaperMod.git PaperMod
cd PaperMod
git checkout v7.0

Pour vérifier :

git describe --tags

Tester en local

hugo server -D

Puis surfer sur http://localhost:1313/

Liens

staticgenerators/hugo.1775676195.txt.gz · Last modified: by carl