Converting to Hugo
Updating the site from pure HTML to Hugo
Creating a menu bar
https://harrycresswell.com/writing/menus-in-hugo/
Creating a Downloads page
https://bwaycer.github.io/hugo_tutorial.hugo/extras/localfiles/
Install htpasswd package
https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
apache
on arch
apache2-utils
on debian
create .htpasswd file:
sudo htpasswd -c /etc/nginx/.htpasswd user1
-c
will create a new file, do not use it when adding a second user
Since we are updating the site with rsync, we can also update the htpasswd file in the same script, so there is no need to configure users serverside.
Creating the Downloads page
Nginx has the autoindex on
feature which will allow a user to browse a web directory as if it were any other filesystem. This is functional but not very appealing to look at, especially since we have been spending so much time getting the rest of the site to look nice.
When we inspect the source of a page generated with autoindex on
, we see that all Nginx is doing is making a list of all of the files in a target directory. Can we do that ourselves and put the output into a hugo template file?
It turns out we can.
autoindex on the AUR
By using hugo shortcodes, we can generate a list of files in a target directory:
{{- $pathURL := .Get "pathURL" -}}
{{- $path := .Get "path" -}}
{{- $files := readDir $path -}}
<table>
<th>Size</th>
<th>Name</th>
{{- range $files }}
<tr>
<td>{{ printf "%.2f" (div .Size 1048576.0) }} MiB</td>
<td><a href="{{ $pathURL }}{{ .Name | relURL }}"> {{ .Name }}</a></td>
</tr>
{{- end }}
</table>