wjh18 / hugo-liftoff

Minimal blog/portfolio theme with a focus on content creation and SEO best practices. An ideal choice for technical users jump-starting a personal brand.
https://hugo-liftoff.netlify.app
MIT License
93 stars 27 forks source link

Language Error #21

Closed karl-cardenas-coding closed 1 year ago

karl-cardenas-coding commented 1 year ago

Describe the bug Following the steps in the Getting Started results in an error when using the config values. I keep getting language errors:

$ hugo server -D
Error: command error: failed to create config from result: failed to decode "languages": no languages configured

To Reproduce Steps to reproduce the behavior:

  1. Follow the getting started guide.
  2. Start development server hugo server
  3. Review output.

Expected behavior I expected the example site to come up with the example content.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Is this maybe due to a new Hugo version behavior? I reviewed the following docs page from Hugo about languages, but none of the work around work for me.

karl-cardenas-coding commented 1 year ago

Update: If I create a hugo.toml in the root of the project and past over all the config values from all the files, it works. I also tried the command hugo server --configDir config but no luck. It's very possible I'm being a complete n00b here 😅

wjh18 commented 1 year ago

I will take a look when I get to a computer. Hugo 0.110.0 changed the file (config to hugo). Version 0.99.0 is the latest I tested with, but plan to update it soon.

wjh18 commented 1 year ago

Okay, so I think the issue is related to an update released in late May. I haven't tested the corresponding version yet which is why this happened (it's quite difficult to keep up with all updates and follow any sort of version pinning, so generally I put a min version in the theme's config.toml and try my best).

The original approach I took with theme config was to create a placeholder languages.toml to illustrate how to add additional config files. I haven't yet implemented translations/i18n which is why that file is blank. However, it has no defaultContentLanguage field defined. In the following merged pull request, I see that detection for this field was added and the reported error will be thrown if this field isn't defined.

Try either removing the languages.toml file from the config directory, defining a defaultContentLanguages field, or using an earlier version to mitigate the issue.

As for the config, I will be changing it from config.toml to hugo.toml to match expectations moving forward. However, in the meantime config.toml should be backwards compatible and not cause any regressions.

Edit: Just tested on the latest version. Deleting config/languages.toml did in fact fix the issue.

karl-cardenas-coding commented 1 year ago

I think you're right @wjh18. As much as I love Hugo, it's tough to keep up with all the changes. Backwards compatibility seems to be a common issue 😞

wjh18 commented 1 year ago

The nice thing about Hugo is how little maintenance it requires once you deploy your site. It's just a matter of having the time to keep up with all the updates.

Anyway, HL v3.2.3 bumped the min Hugo version to 0.115.2 as a fresh start and removed the languages.toml that was causing the issue. I'll close this for now but if you still need help feel free to re-open.

karl-cardenas-coding commented 1 year ago

Thanks for all your help @wjh18 🎉