Hugo common pitfalls and cheat sheet
Ryan Fan 2017-11-25
program
web
hugo
Why language specific params defined in "[lanuage]" missing some information defined outside "[lanuage]"
[params] [params.home] var1 ="1" var2 ="2" [languages] [languages.en] [languages.en.params.home] var1="changed"
The language specific params will override the variable with the same name defined outside of "[language]", In above example, there is no var2 availble, and
Site.Params.Home
only can see var1="changed"
- Why
baseURL
defined in config file doesn't take effect when running inhugo server
mode?
All the
baseURL
will withbaseUrl
"http://localhost:port" when run inhugo server
mode, but if you runhugo
command, you can see the baseUrl you specified contains in geneated pages. the workaround is runhugo server -b [baseURL]
to explicitly specify thebaseURL
- How to list all the pages under specific subdir without using taxonomy?
There is no easy way to do that, especially if you want to paginator the pages. I wrote a document to detail desribe how to do it here: Hugo list all the pages under sub directories