0

I tried to preview my website with

hugo server -D

when I got

Error: "C:\<directory>\Website\config.toml:1:1": unmarshal failed: Near line 0 (last key parsed ''): bare keys cannot contain '�'

I don't know what to do with this. I haven't the slightest clue in fact.

I've worked in a command line environment a decent few times before, but static websites and Hugo are both completely new to me.

Yes, that last symbol did appear as a symbol placeholder for in PowerShell too (I'm doing this in Windows (not out of choice, mind you)).

Also, the website is almost completely blank at this point, so if it's completely necessary for me to make a new site, that's fine (I can backport all of my work so far anyhow).

Edit: Here are the contents of the config file for the curious.

baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "grayscale"

As you can see, I haven't even changed the defaults yet, I've only gotten so far as installing and trying a theme.

  • What editor did you use? It probably needs to be reconfigured to act sanely. – Michael Hampton Jul 25 '20 at 04:46
  • @MichaelHampton I don't rightly follow. I echoed in everything I added to config.toml (just the theme so far) and haven't touched it further. – Jannette Lovely Jul 25 '20 at 05:52
  • Seeing the .toml file might help. – Gerald Schneider Jul 25 '20 at 12:02
  • That .toml file is working for me. It is possible that your file contains some invisible utf8 characters that were filtered out when posting here. The only effective way I know is basically retyping the problematic lines (no copy&paste). – Gerald Schneider Jul 26 '20 at 08:01
  • Are you trying to say that you never edited this file in an editor? It sure looks like it has a BOM, and that only comes from editing the file in a misconfigured editor. – Michael Hampton Jul 26 '20 at 12:29
  • @GeraldSchneider Rewriting the config.toml fixed it, can you repost your comment as an answer so I can label it as the solution? Thank you. – Jannette Lovely Jul 28 '20 at 02:47
  • @NamesNetworkNic Just accept the answer by T0xicCode, it's better than one of mine would have been and it's most probably better on track about the reason. – Gerald Schneider Jul 28 '20 at 05:37

1 Answers1

1

Your config.toml likely contains a BOM (or Byte Order Mark). It's automatically inserted by some editors on Windows (such as notepad) when saving files in some character sets. The simplest way to get rid of it is to use an editor like Notepad++ to open the file, change the character set to UTF8 without BOM, remove the BOM (one or two characters at the start of the file, if they weren't automatically removed), and save the file again.

T0xicCode
  • 1,291
  • 1
  • 10
  • 11