Hugo Static site generator: Script to generate the initial configuration.
Table of contents
Script Code
This script has helped me to generate mi website at initial moment since for me it was a bit awkward to editing all the files one by one to tests and see results of Hugo’s configuration . With this script we have all the initial configuration in a single file to be able to make configuration tests with Hugo relatively easy.
hugo-script-create-basic-site.sh
Testing the script
Download
root@kali:~# wget https://raw.githubusercontent.com/VielLosero/scripts/master/hugo-SSG/hugo-script-create-basic-site.sh
--2019-10-15 13:59:20-- https://raw.githubusercontent.com/VielLosero/scripts/master/hugo-SSG/hugo-script-create-basic-site.sh
Resolviendo raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Conectando con raw.githubusercontent.com (raw.githubusercontent.com)[151.101.0.133]:443... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: 10006 (9,8K) [text/plain]
Grabando a: “hugo-script-create-basic-site.sh”
hugo-script-create-basic-site.sh 100%[=============================================================================>] 9,77K --.-KB/s en 0s
2019-10-15 13:59:21 (39,1 MB/s) - “hugo-script-create-basic-site.sh” guardado [10006/10006]
root@kali:~#
Execution
We change the permissions
root@kali:~# chmod +x hugo-script-create-basic-site.sh
We edit the paths and execute the script
root@kali:~# ./hugo-script-create-basic-site.sh
[*] Generating basic structure with hugo templates
Congratulations! Your new Hugo site is created in /home/user/mi_new_static_website/mi_blog.
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.
Creating theme at /home/user/mi_new_static_website/mi_blog/themes/mi_theme
[*] Creating baseof.html
[*] Creating index.html
[*] Creating list.html
[*] Creating single.html
[*] Creating head.html
[*] Creating header.html
[*] Creating footer.html
[*] Creating config.toml
[*] Generating css
[*] Creating content files
/home/user/mi_new_static_website/mi_blog/content/_index.en.md created
/home/user/mi_new_static_website/mi_blog/content/posts/post1.md created
[*] Making dir for images
[*] Generating pygments
[*] Generating Multilanguage Menu
[*] Making dir for static images like logo
[*] Starting Hugo Server
| EN | ES
+------------------+----+----+
Pages | 11 | 8
Paginator pages | 0 | 0
Non-page files | 0 | 0
Static files | 2 | 2
Processed images | 0 | 0
Aliases | 1 | 0
Sitemaps | 2 | 1
Cleaned | 0 | 0
Total in 16 ms
Watching for changes in /home/user/mi_new_static_website/mi_blog/{archetypes,content,data,layouts,static,themes}
Watching for config changes in /home/user/mi_new_static_website/mi_blog/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
Result
Here we have the result.
back
References:
Licence: CC-BY-SA