tummychow / lanyon-hugo

Port of poole/lanyon, to spf13/hugo
tummychow.github.io/lanyon-hugo
MIT License
162 stars 78 forks source link

New Hugo install, errors loading lanyon #2

Closed RichardDooling closed 10 years ago

RichardDooling commented 10 years ago

On Mac OSX Mavericks, if I do

hugo server --theme=lanyon --buildDrafts --watch

ERROR: 2014/09/30 Rendering error: template: theme/post/single.html:5:47: executing "theme/post/single.html" at <.Site.Params.DateFor...>: invalid value; expected string

ERROR: 2014/09/30 Rendering error: template: theme/index.html:10:53: executing "theme/index.html" at <.Site.Params.DateFor...>: invalid value; expected string

tummychow commented 10 years ago

Disclaimer: it's been months since I used hugo. The last time I used it, the themes hadn't been implemented yet, so I don't really know how this feature works... I'll see what I can do about this issue regardless.

Error suggests DateForm is the wrong type... could I see your config.json (or equivalent yaml/toml)? Looks like I never wrote any documentation for this, but basically the DateForm is an entry in the global configuration for the theme. It controls the way dates are printed and formatted.

RichardDooling commented 10 years ago

I just changed it to a date string. I just wanted to see what it looked like and it would not build. Now I got it working. Thanks. Looks nice!

tummychow commented 10 years ago

Phew, glad you got it fixed! For future reference, you can read about the valid strings here.

dopplesoldner commented 9 years ago

Hi, I am facing the same problem. I added the "DateForm"="ANSIC" to my config.toml file but it doesn't work still. Is there anything else I should do?

Thanks.

tummychow commented 9 years ago

The thing is that ANSIC is a Go constant that happens to equal a valid date/time format string. It's not a valid string in and of itself. You need to set DateForm to the value of ANSIC, ie "Mon Jan _2 15:04:05 2006".

mostafahussein commented 9 years ago

how we should fix <.Site.Params.DateFor...>: invalid value; expected string ??

tummychow commented 9 years ago

What's in your config.json or equivalent?

mostafahussein commented 9 years ago

config.toml

baseurl = "http://yourSiteHere"
languageCode = "en-us"
title = "My Blog"
tummychow commented 9 years ago

You need a DateForm key in there, eg DateForm = "Jan 2 2006". Take a look at the config.json in this repository.

Btw PRs are welcome to set a default dateform in the layouts, but I don't use Hugo anymore so making this easier is really not a priority for me.

mxcl commented 8 years ago

I added this (DateForm = "Jan 2 2006") to my config.toml, restarted the server and nothing is fixed. I tried the other values here too.

tummychow commented 8 years ago

what's the error message you're seeing and what's the full content of your config file?

mxcl commented 8 years ago

It was the same error message†, config.toml:

baseurl = "http://promisekit.org/"
languageCode = "en-us"
title = "PromiseKit"
PygmentsCodeFences = true 
DateForm = "Mon Jan _2 15:04:05 2006"

ERROR: 2016/07/15 17:59:55 general.go:222: Error while rendering page fundamentals/introduction.md: template: theme/_default/single.html:5:47: executing "theme/_default/single.html" at <.Site.Params.DateFor...>: invalid value; expected string

tummychow commented 8 years ago

Ah, DateForm needs to be under params, not the top level. Try:

baseurl = "http://promisekit.org/"
languageCode = "en-us"
title = "PromiseKit"
PygmentsCodeFences = true 

[params]
DateForm = "Mon Jan _2 15:04:05 2006"
mxcl commented 8 years ago

Terrific, thanks.

kaushalmodi commented 8 years ago

I already had this:

[params]
  DateForm = "Mon Jan 2, 2006"

But that did not work!

Turns out that even though you call it .Site.Params.DateForm, that params needs to be lower case in config.toml.

Summary

Worky

[params]
  DateForm = "Mon Jan 2, 2006"

No Worky

[Params] # capitalized does not work
  DateForm = "Mon Jan 2, 2006"
luizdepra commented 8 years ago

I got the same problem with Hugo v.0.18-DEV. My configuration file:

baseurl = "http://luizdepra.com/"
title = "luizdepra"

theme = "lanyon"

languagecode = "en-us"
canonifyurls = true
pygmentsuseclasses = true
pygmentscodefences = true

[permalinks]
    post = ":year/:month/:day/:title/"
    fixed = ":title/"

[params]
    Title = "luizdepra"
    Tagline = "a sip of FUNgramming"
    Author = "Luiz de Prá"
    DateForm = "Jan 2, 2006"

I solved it changing .Site.Params.DateForm to .Site.Params.dateform. Have Hugo changed something in this last version?