Update hugo new

omar 2024-07-10 14:17:43 +00:00
parent d46d3d553a
commit dd13ec90ad

@ -1,57 +1,57 @@
## Hugo new [command] ## Hugo new [command]
La guida riguarda l'uso in un ambiente locale, in cui sia stato clonato il repo del sito **BgLUG/bglug.it** [clicca qui per scaricarlo in formato .zip](https://git.libreschool.org/BgLUG/bglug.it/archive/main.zip)) e sia presente l'[eseguibile di Hugo](https://github.com/gohugoio/hugo/releases/latest). La guida riguarda l'uso in un ambiente locale, in cui sia stato clonato il repo del sito **BgLUG/bglug.it** ([clicca qui per scaricarlo in formato .zip](https://git.libreschool.org/BgLUG/bglug.it/archive/main.zip)) e sia presente l'[eseguibile di Hugo](https://github.com/gohugoio/hugo/releases/latest).
Se vuoi creare contenuti usando Gitea da browser [leggi qua](hugo-new-manualmente.md). Se vuoi creare contenuti usando Gitea da browser [leggi qua](hugo-new-manualmente.md).
### Creare un nuovo contenuto usando un archetipo ### Creare un nuovo contenuto usando un archetipo
Per utilizzare un archetipo personalizzato, per esempio per creare un **evento**, dalla root del progetto eseguire il comando: Per utilizzare un archetipo personalizzato, per esempio per creare un **evento**, dalla root del progetto eseguire il comando:
`hugo new events/2024-07-10-evento-di-prova -k evento` `hugo new events/2024-07-10-evento-di-prova -k evento`
Nella posizione indicata, in questo caso dentro la cartella _events_, verrà creata una sottocartella contenente i due file index, generati come indicato nell'archetipo **evento**. Nella posizione indicata, in questo caso dentro la cartella _events_, verrà creata una sottocartella contenente i due file index, generati come indicato nell'archetipo **evento**.
![Albero cartella archetipi e content](hugo-contrib/hugo-new-evento-tree.png) ![Albero cartella archetipi e content](hugo-contrib/hugo-new-evento-tree.png)
Per maggiori dettagli sul comando riferirsi alla guida `hugo new -h` Per maggiori dettagli sul comando, riferirsi alla guida `hugo new -h`
``` ```
Create a new content file and automatically set the date and title. Create a new content file and automatically set the date and title.
It will guess which kind of file to create based on the path provided. It will guess which kind of file to create based on the path provided.
You can also specify the kind with `-k KIND`. You can also specify the kind with `-k KIND`.
If archetypes are provided in your theme or site, they will be used. If archetypes are provided in your theme or site, they will be used.
Ensure you run this within the root directory of your site. Ensure you run this within the root directory of your site.
Usage: Usage:
hugo new content [path] [flags] hugo new content [path] [flags]
Flags: Flags:
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/ -b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
--cacheDir string filesystem path to cache directory --cacheDir string filesystem path to cache directory
-c, --contentDir string filesystem path to content directory -c, --contentDir string filesystem path to content directory
--editor string edit new content with this editor, if provided --editor string edit new content with this editor, if provided
-f, --force overwrite file if it already exists -f, --force overwrite file if it already exists
-h, --help help for content -h, --help help for content
-k, --kind string content type to create -k, --kind string content type to create
--renderSegments strings named segments to render (configured in the segments config) --renderSegments strings named segments to render (configured in the segments config)
-t, --theme strings themes to use (located in /themes/THEMENAME/) -t, --theme strings themes to use (located in /themes/THEMENAME/)
Global Flags: Global Flags:
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
--config string config file (default is hugo.yaml|json|toml) --config string config file (default is hugo.yaml|json|toml)
--configDir string config dir (default "config") --configDir string config dir (default "config")
--debug debug output --debug debug output
-d, --destination string filesystem path to write files to -d, --destination string filesystem path to write files to
-e, --environment string build environment -e, --environment string build environment
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
--logLevel string log level (debug|info|warn|error) --logLevel string log level (debug|info|warn|error)
--quiet build in quiet mode --quiet build in quiet mode
-M, --renderToMemory render to memory (mostly useful when running the server) -M, --renderToMemory render to memory (mostly useful when running the server)
-s, --source string filesystem path to read files relative from -s, --source string filesystem path to read files relative from
--themesDir string filesystem path to themes directory --themesDir string filesystem path to themes directory
-v, --verbose verbose output -v, --verbose verbose output
``` ```