Access disableKinds from template

I’m trying to access .Site.DisableKinds from template, but I always get the following error message: can't evaluate field DisableKinds in type page.Site. Any ideas? The same template file no problem accessing .Site.BaseURL. disableKinds is present in hugo.toml and I see “RSS” is indeed disabled (I have disableKinds = ["RSS"]).

Actually we are talking about methods you can use to access values for a site.
.Site.BaseURL is a defined method. Theres no such method for disableKinds.

Not all options you can set in the site config are considered relevant for a running site. So no method has been exposed for these.

DisableKind is a build option to tell hugo to omit some kinds on site generation. No need to test your running site fot that. In fact you know the values cause you configured it.

Thanks for the answer. However, a theme author would not know. For example, a theme author can decide whether to generate a link to RSS feed depending on whether RSS is enabled or disabled. What do you think?

(Maybe the right request is to support RSS in page kinds.)

For this use case, use the example from the documentation:

https://gohugo.io/templates/rss/#include-feed-reference

It works well for most pages. But on a non-post page, this doesn’t seem to be working because these pages would not be included in the RSS feed?

With such a generic question the answer will be also generic.

Hugo allows to configure which output formats should be created for which types of content. And define custom layouts for rss templates.

So in general you can.

Depending on the definition of your ‘non-post’ page site layout and config it might be easy or more complex.

Pages of interest in the docs

  • rss templates
  • output types
  • template lookup order