Is there a way to create custom commands or customise existing commands?

Hi, I’m new to Hugo so apologies if this was asked before.

Is there a way to add custom commands to hugo, or override existing commands? From what I can see people seem to write CLI wrappers, which I guess are OK but 1/ not cross-platform and 2/ need to be installed on each machine. In jekyll for example you can create a custom Rakefile, and in the JS based static site generators you can just add scripts to the package.json files. Is there a similar mechanism for Hugo?

you cannot add ne commands to the cli without customizinh hugo sources and compile it yourself

1 Like

Thanks, that’s what I feared.

  1. in fact platform independance depends on the wrapper.

  2. every plugin addition has to be either present or configured fto be autoloaded…

and you may achieve things with hugo where others need plugins…

all depends what you need to do

For now I just wanted to add a param to the ‘new’ command so that

hugo new "blog/my-new-post.md" --dated

woudl be translated into the equivalent of

hugo new "blog/$(date +%Y-%m-%d)-my-new-post.md

But it’s not a big deal

You might consider a platform-agnostic approach with npm:
https://discourse.gohugo.io/t/dates-in-post-filenames/26219/7

Disregard.