HELP: What did I just do with this convert command?! [ --unsafe flag scope ]

So I create a new hugo site and changed into it.

I then created a new hugo theme.

The default config file was config.toml, but I wanted congi.yaml - because I am used to YAML.

On the command line from the project root, I attempted to change the config using Hugo’s convert tool by typing:

hugo convert toYAML --config /config.toml --unsafe

I added unsafe because without it said something about not having permission - yes, I am not too bright.

That didn’t change the config.toml as I had hoped, but it said “processing 3 content files”.

I can’t see any content files to process, let alone 3 of them.

My questions are:

  1. With the --unsafe flag, did I just let hugo process some files OUTSIDE of the project?

  2. What did I just get Hugo to do? (Because it didn’t seem to change my config.toml, but it did ‘something’.)

  3. Is there a way to get hugo to convert files (not just front matter), or is it manual only?


Looking at the docs for that command, it appears to be for converting frontmatter of files in the content folder of your project.

But I don’t have any content in the content/ folder - that is why I am concerned that it tells me 3 files have been processed.

And could you find docs for the --unsafe flag? Because I couldn’t. I’d be happy just knowing that it doesn’t expose the filesystem outside of the project root - then I’ll just kill the project and start again as a reset.

Though, if your cited command is correct, you told it to go look in the root, by specifying the path as /config.toml. At any rate, it is not really for converting the config file anyway, confirming via some posts in here. I haven’t looked for any docs on --unsafe and, after a quick look I don’t find any either.

1 Like

Thank you. I haven’t actually marked it as the correct answer because I still don’t know the answers to my questions - but I appreciate your replies.

My current suspicions (hopes?) are:

  1. The --unsafe tag doesn’t give Hugo file system access, and the “3 processed files” are some project based settings for Hugo - not sure because the docs aren’t clear to me.
  2. Again, I THINK it changed some project settings - not files elsewhere.
  3. No. It will only convert frontmatter of Markdown files, and will not convert config files - so manual needed - again, not 100% sure from the docs either.

I might propose a PR to change DOCS to say at the begining of the various convert pages to that it only converts frontmatter and config/theme files have to be done manually - perhaps I will do it to one and see if that is actually the case by the response!

FYI - PR made and accepted for docs clarifying Hugo convert is only for frontmatter and not for config files (i.e. the third question).