For the installation you only need the Static Site Generator Hugo and the apache2-utils to restrict access to the editor if you want to use it online. On Debian and distributions derived from it, you can do this with
apt install hugo
and
apt install apache2-utils
You can also use the current tarball for Hugo.
Create a new website with hugo if you don’t want to use an existing one.
hugo new site <directory>
or to set the right write permissions
sudo -u <www-server-user> hugo new site <directory>
Note that by default Hugo uses the ‘public/’ directory to create the website. Now create the configuration file config.json and clone in the directory ‘static/edit/’ the editor repo.
mkdir static/edit && cd static/edit && git clone https://github.com/hugoeditor/hugocms.git .
or for the Pro version:
mkdir static/edit && cd static/edit && git clone https://github.com/hugoeditor/hugocms-pro.git .
Tip: The following command can be used to create the config.json. Then you can use the editor to edit the configuration file.
Attention that overwrites an existing config.json!
echo "{}" > config.json && mv config.toml config.toml.bak
To protect the directory with Editor use htpasswd from apache2-utils and then configure your Nginx or Apache2 server. To create a new htpasswd file:
htpasswd -c <password-file> <user>
for example for Nginx:
htpasswd -c /etc/nginx/.htpasswd.<domain> <user>
and in the configuration file for Nginx add the following (replace
location /edit/ {
auth_basic "Restricted and Password Protected App";
auth_basic_user_file /etc/nginx/.htpasswd.<domain>;
}
Now use Hugo to create the website. Switch to the work directory for Hugo.
hugo -DEF
or
sudo -u <www-server-user> hugo -DEF
and the editor can be called up via your domain with the ‘/edit/’ appended.