I am using Hugo site generator for my site.
Problem
Sometimes you are in the need of disabling a website; in this case, Hugo should generate a different index.html
and do not generate any other page. The content of public/
should only be the landing page and its dependencies.
- Can this be achieved in the Hugo environment?
- Is this scenario even included in Hugo?
Scenarios
Some, but mainly when the site undergoes maintenance and we want to display just a bare landing page with some basic info, alerting the visitor that the site is temporarily down.
Hi and welcome to Hugo.
Have a read at the docs page about configuring Hugo: https://gohugo.io/getting-started/configuration/
You could set up different configs, for example having one for the landing page scenario. In this config, you might want to configure disableKinds
to disable all except the home
kind (full list of disable-able Kinds in the same docs page as above).
Then perhaps point to a different layoutDir
and/or contentDir
as well, so you can use a different set of templates and content files as necessary.
2 Likes
At some point I will try @pointyfar’s hugoish way, but there is also the way of using redirects via your web server. For example redirecting all traffic via an Apache .htaccess
file.
1 Like
This seems promising… I am trying it 
Not really, but it seems an interesting reading. Thanks