I have a problem where the “gallery” section of my content folder is only meant to display on the homepage of the site, thus the section’s index page and each page in the section serve no purpose, but are still being built.
Right now in layouts/section/gallery.html, I have this redirect: <meta http-equiv="refresh" content="0; URL='{{ .Site.BaseURL }}'">
And in config.toml:
[permalinks]
gallery = "/"
But this creates some funky problems every other time hugo or hugo server is run. The site builds wrong and the home page is replaced by the latest “gallery” page that was built. Some strange redirect loop possibly.
Is there a way to stop certain pages from being built? Or a better way to do redirects in the theme?
Created layouts/gallery/list.html and layouts/gallery/single.html with <meta http-equiv="refresh" content="0; URL='{{ .Site.BaseURL }}'"> in each.
Then got rid of the permalink section in the config file. Hugo seems to be building fine right now with no weird redirection mishaps, but still building all of those gallery pages my site doesn’t need.