Disable html output format

Problem 1

I want to disable HTML outputs for kind pages. But I want to enable it for kind section.
However I see that Hugo generates html files for kind pages even after setting disableKinds = ['page'] in config.toml.

Problem 2

I also observed that Hugo generates the following files on it’s own. I have neither provided any sitemap templates nor configured my site for taxonomy (in my config.toml).

http://localhost:1313/sitemap.xml
http://localhost:1313/tags/index.html
http://localhost:1313/tags/index.xml
http://localhost:1313/categories/index.html
http://localhost:1313/categories/index.xml

Link to repo: techieforgood/hugo-csv (github.com)
To run the site after cloning you need to use:

cd exampleSite; hugo server --cleanDestinationDir --themesDir ../../ -t hugo-theme-console

PS: My work is a fork of hugo-theme-console

https://github.com/techieforgood/hugo-csv/blob/main/exampleSite/config.toml#L17

Move this to the root table. It is currently in the params table.

To disable the others:

disableKinds = ['RSS','sitemap','taxonomy','term']

Hi @jmooring . Thanks a lot for the answer. That worked like a charm.

But for the sake of clarity, I have a question.
Why Hugo generates many things (sitemaps,/tags/,/categories/) on its own? Then we have to disable the automatic generation using disableKinds.

Should it not be other way round? Hugo should not generate all these on its own. We should specify what we want Hugo to generate.

The tags and categories taxonomies are enabled by default, making it easier for a new user to get started. All they have to do is add a tags or categories array to front matter and it just… works.

Most people want a sitemap, and by enabling it by default they don’t have to think about it. It just… works. Same with RSS.

And theme authors rely on these defaults.

We spend a lot of time and energy to make sure that the defaults are sensible, but they will never be right for everyone.

2 Likes

Thanks for the explanation @jmooring .

I understand that.

So, I set disableKinds = ['pages','RSS','sitemap','taxonomy','term'] in the root table.

But that leads to a problem. Looks like the section list pages don’t have access to the markdown files now.

Here is what I mean:

Before setting disableKinds

The list page works as expected.
The csv output format (at section level) works as expected.
The single pages are generated as expected.

After setting disableKinds

The list page shows nothing.
The csv file shows nothing.
The page html pages are not generated as expected.

Here is a screenshot of the 6 things I mentioned above.

Problem

  1. I did not want the CSV and HTML list pages to go blank.
  2. I want to suppress the generation of single page HTML pages

Is there a way to achieve these ?

See docs:
https://gohugo.io/content-management/build-options/

1 Like

And keep in mind you can “cascade” the build options from your site configuration.

config.toml

disableKinds = ['RSS', 'sitemap', 'taxonomy', 'term']

[[cascade]]

[cascade._build]
list = 'local'
render = 'never'
publishResources = 'false'

[cascade._target]
kind = 'page'
path = '/posts/**'

https://gohugo.io/content-management/front-matter/#front-matter-cascade

1 Like

I’m not sure this will add anything of importance to that thread, but by reading the title, it seems what you wanted to do was to disable specifically the html output formats, and maybe you still wanted the RSS or json etc… In which case you should look at the ouputs config.

This can be set in the Front Matter, so also available with cascade.

1 Like