gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
74.78k stars 7.46k forks source link

Need for a spec for config.toml? #2597

Closed kaushalmodi closed 7 years ago

kaushalmodi commented 7 years ago

Hello,

We are in dire need of a spec that states:

Coming from a non-toml and non-go background, the current state does not seem to follow any spec.. some vars are all lower case, some are upper camel case and some are lower camel case.

See my minimum working example here.

There was also a recent commit related to config variables and cases that breaks hugo building that used to work on v0.17:

Started building sites ...
ERROR: 2016/10/17 10:38:29 general.go:236: theme/_default/summary.html is an incomplete or empty template
ERROR: 2016/10/17 10:38:29 general.go:236: theme/_default/li.html is an incomplete or empty template
ERROR: 2016/10/17 10:38:29 general.go:236: Error while rendering page post/generating-a-transparent-favicon.md: template: /home/kmodi/hugo/kaushalmodi.gitlab.io/themes/lanyon/layouts/_default/baseof.html:5:49: executing "main" at <.Site.Params.DateFor...>: invalid value; expected string
ERROR: 2016/10/17 10:38:29 general.go:236: Error while rendering page post/how-i-created-this-blog.md: template: /home/kmodi/hugo/kaushalmodi.gitlab.io/themes/lanyon/layouts/_default/baseof.html:5:49: executing "main" at <.Site.Params.DateFor...>: invalid value; expected string
ERROR: 2016/10/17 10:38:29 general.go:236: Error while rendering page post/elisp-meta-characters-in-string.md: template: /home/kmodi/hugo/kaushalmodi.gitlab.io/themes/lanyon/layouts/_default/baseof.html:5:49: executing "main" at <.Site.Params.DateFor...>: invalid value; expected string

This is what I have in my config.toml:

[params] # This NEEDS to be all lowercase. Capitalized 'Params' will NOT work
# https://github.com/tummychow/lanyon-hugo/issues/2#issuecomment-253274278
  Tagline = "Emacs, scripting and anything text oriented."
  # Go date formats: https://golang.org/pkg/time/#pkg-constants
  DateForm = "Mon Jan 2, 2006"

And these are the contents in my _default/summary.html:

<article class="post">
    <header>
        <h1 class="post-title"><a href='{{ .Permalink }}'> {{ .Title }}</a> </h1>
        <div class="post-date">{{ .Date.Format .Site.Params.DateForm }} - {{ .FuzzyWordCount }} Words</div>
    </header>

    {{ .Summary }}

    <footer>
        <a href='{{ .Permalink }}'><nobr>Read more &rarr;</nobr></a>
    </footer>
</article>
TiTi commented 7 years ago

Yep I'm currently having trouble upgrading to v0.18(.1) because of my custom section in config.toml:

[author] name = "Thibault ROHMER" email = "....@gmail.com" github = "TiTi" gaID = "UA-60799648-1"

[params] notoc = true disqusShortname = "thibaultrohmer"

{{ if .Site.Author.gaID }} ... mailto:{{ .Site.Author.email }} ... {{ if isset .Site.Params "disqusShortname" }}

I manage to solve the author issue by renaming [author] to [Author] in config.toml (because case is now sensitive). Note that: updating template to {{ if .Site.author.gaID }} did NOT help.

Right now I have NO compilation error but the google analytics condition does not work anymore: script is not included!

Definitely weird and breaking-change...

What should I put in both my config and my templates? Uppercase, lowercase ? sub-sections ?

bep commented 7 years ago

@TiTi try discuss.gohugo.io

bep commented 7 years ago

The params casing was fixed in Hugo 0.18.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.