Why is site description not a site variable?

What was the decision behind having .Site.Title as a Site Variable and not .Site.Description as well?

  • Self-describing site titles
  • Title being a descriptor for the project and description being just another SEO tag
  • Title being shown in a browser as a label for the currently loaded URI
  • Description tags being created by the summary routine of the generator when it was not too important to discern between SEO and descriptors.
  • Description being page focused while a site could make good use of a global title.

There probably hasn’t being a fact-finding mission and decision committee for that.

Hugo generates your website for you, but it doesn’t decide your SEO and special markup requirements

I have a use case for global site description, even though defining it in params.toml works as well. Just thought it would have been better to have it defined as a site variable.

I have a use case for global site description

And that is why GoHugo has a [params] section in the configuration. Add your description there and use site.Params.description where needed.

1 Like

Is there a difference between site.Params.description and .Site.Params.Description?

Yes there is. As per the doc:

site is a global function which returns the same data as the .Site page method

ref: site | Hugo

However it provides access to the top level irrespective of context.

On the other hand when trying to access the top level for example from within a partial or a shortcode with the .Site page method, one will need to prepend the dollar sign to access it, i.e. $.Site.params.description

ref: Templating | Hugo

Okay. Coz I used .Site a lot when moving from Jekyll but everything works though. Will look through that documentation. Cheers!

This topic was automatically closed after 4 days. New replies are no longer allowed.