gohugoio / hugo

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

Default baseurl in config.toml throws errors because it's not a valid URL #1301

Closed rootwork closed 9 years ago

rootwork commented 9 years ago

Hi,

I'm new to Hugo, so forgive me if this is already addressed elsewhere (I didn't see it in other issues). When I was first trying out Hugo, I followed the quickstart guide. When running step 5, I got the following errors:

ERROR: 2015/07/26 template: theme/partials/head.html:14:39: executing "theme/partials/head.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/head.html
ERROR: 2015/07/26 template: theme/partials/sidebar.html:4:23: executing "theme/partials/sidebar.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/sidebar.html
ERROR: 2015/07/26 template: theme/partials/head.html:14:39: executing "theme/partials/head.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/head.html
ERROR: 2015/07/26 template: theme/partials/sidebar.html:4:23: executing "theme/partials/sidebar.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/sidebar.html
ERROR: 2015/07/26 template: theme/partials/head.html:14:39: executing "theme/partials/head.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/head.html
ERROR: 2015/07/26 template: theme/partials/head.html:14:39: executing "theme/partials/head.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/head.html
ERROR: 2015/07/26 template: theme/partials/sidebar.html:4:23: executing "theme/partials/sidebar.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/sidebar.html
ERROR: 2015/07/26 template: theme/partials/sidebar.html:4:23: executing "theme/partials/sidebar.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/sidebar.html
ERROR: 2015/07/26 template: theme/partials/head.html:14:39: executing "theme/partials/head.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/head.html
ERROR: 2015/07/26 template: theme/partials/sidebar.html:4:23: executing "theme/partials/sidebar.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/sidebar.html
ERROR: 2015/07/26 template: theme/partials/head.html:14:39: executing "theme/partials/head.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/head.html
ERROR: 2015/07/26 template: theme/partials/sidebar.html:4:23: executing "theme/partials/sidebar.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo in theme/partials/sidebar.html
ERROR: 2015/07/26 Error while rendering 404 page: template: theme/404.html:8:123: executing "theme/404.html" at <.Site.BaseURL>: BaseURL is not a field of struct type *hugolib.SiteInfo

After reading more, I realized it was because baseurl in config.toml was set to "YourSiteHere", which is not a valid URL.

It only took a few minutes for me to figure it out, but it wasn't the best introduction to Hugo :) Maybe it's worth changing it to "example.com", or at least "YourSiteHere.com"?

rootwork commented 9 years ago

Update: Turns out changing that value didn't fix things; it still throws errors and doesn't really compile.

I ran through all the themes and only a few of them work. I'm not sure if that's because some syntax changed and these are the only themes that have updated, or if there's some typo in the default Hugo config on first install. These are the ones that work without errors on first install, following the quickstart guide:

I guess I'll have to learn more about Hugo to figure out why the other ones are throwing errors and what I need to change to fix that, but in the meantime it might be good to change the quickstart guide to using a theme that doesn't throw errors.

bep commented 9 years ago

I have run through all the themes on a regular basis lately and fixed a lot of issues, so the "only a few of them work" isn't correct.

This is, however, not the correct issue tracker for issues with a given theme.

bep commented 9 years ago

Just tested the Hyde theme, to make sure I wasn't posting bullocks: Works perfectly! Beautiful theme, btw.

rootwork commented 9 years ago

Well, I followed the quickstart guide exactly as written, and those were the errors I got. I tried it again from scratch and got the same thing. Determining that most themes threw the same errors was not a suggestion that all those themes had an error; it implied (to me, at least) that either some syntax had recently changed and not been documented, or that there was a typo in the default Hugo configuration set up as an example.

If you're not interested in investigating or fixing it that's your decision, but it doesn't make me feel very secure about continuing to work with Hugo.

rootwork commented 9 years ago

OK, I figured it out. I installed Hugo via homebrew. Homebrew installs v0.13. I guess a lot of syntax was changed in v0.14.

Removing the homebrew version, manually downloading the binary and running it compiles everything fine.

Given that v0.13 thus can't compile the site described in the quickstart guide, it seems like it would be good to either get the homebrew version updated, or remove the suggestion to install via homebrew on the installation guide and elsewhere.

I'm not sure if this issue will be seen since I don't have the power to re-open it or change the title to match the real problem. But if anyone else comes across this, installing Hugo manually is the solution.

sharmavivek commented 8 years ago

Thanks @rootwork . Even i trying few things, but your answer saved the day. The reason I left MetalSmith, and came to hugo, was Metalsmith has poor documentation. Now i am working, that is bad no documentation or wrong documentation. Version 14 is out for a while, folks should update the HUGO's quickstart guides.

rootwork commented 8 years ago

@sharmavivek Glad it was helpful. I hope they are able to either update homebrew itself, or if that's not possible, change the docs to stop recommending homebrew, since it will fail.

cfjedimaster commented 8 years ago

Add me to the list. I also installed via Brew and also ran into this same issue. This really needs to be corrected imo, although even with 0.15 I'm stuck (https://github.com/spf13/hugo/issues/1750).

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.