¡Esta es una revisión vieja del documento!
Tabla de Contenidos
Hugo
Generador de sitios webs estáticos.
Crear un nuevo sitio
hugo new site nombre-sitio
Congratulations! Your new Hugo site is created in /home/tempwin/www/hugo/foo. Just a few more steps and you're ready to go: 1. Download a theme into the same-named folder. Choose a theme from https://themes.gohugo.io/ or create your own with the "hugo new theme <THEMENAME>" command. 2. Perhaps you want to add some content. You can add single files with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>". 3. Start the built-in live server via "hugo server". Visit https://gohugo.io/ for quickstart guide and full documentation.
Esto creará una carpeta llamada nombre-sitio en la ruta en la que nos encontremos:
archetypesconfig.tomlcontentdatalayoutsstaticthemes
Instalar tema
Nos movemos dentro de la carpeta del nuevo sitio e inicializamos un repositorio Git vacío:
git init
Descargamos, en este caso, el tema Ananke a la carpeta themes:
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
Indicamos en la configuración (config.toml) que queremos usar ese tema:
theme = "ananke"
Añadir contenido
Manual
Creamos el contenido dentro de la carpeta content siguiendo la nomenclatura:
<CATEGORIA>/<FICHERO>.<FORMATO> y añadiendo metadatos.
Asistido
Lo más cómodo es usar el comando new para facilitar ciertos datos:
hugo new posts/hola-mundo.md
Esto hará que se cree el fichero content/posts/hola-mundo.md con el contenido:
--- title: "Hola Mundo" date: 2021-04-03T16:12:51+02:00 draft: true ---
titleindica el título que tendrá la página. Corresponde también a un h1 dentro de la etiqueta headerdate: fechadraft: indica si el contenido es un borrador o no. Si está entrue, cuando vayamos a generar el contenido estático, Hugo se saltará su generación.
Arrancando el servidor
hugo server -D
Esto iniciará un servidor web accesible desde http://localhost:1313/
Podemos ir haciendo cambios y el servidor los detectará y actualizará la web. Procesará tanto la configuración como el contenido en Markdown.
Crear páginas estáticas
hugo -D
