Is there a Hugo command to create page bundle?


I was wondering if there was a command similar to the the hugo new content/<type>/<name>.md that creates a page bundle dir?

I’d like to be able to put something similar to:

hugo new content/project/newproj -bundle

And for that to create

- /newproj

Anything like that exist?


1 Like

I have a small bash script to help with that:

 if [[ $1 = "post" ]]; then
        # POSTS
        export SLUG=$2
        DATE=`date "+%Y-%m-%d"`

        hugo new post/$DATE-$SLUG/

        mkdir -p content/post/$DATE-$SLUG/gallery;
        mkdir -p content/post/$DATE-$SLUG/images/;

        open content/post/$DATE-$SLUG/; subl content/post/$DATE-$SLUG/; cd content/post/$DATE-$SLUG/;

The usage is ./new post $title


Thanks very much @brunoamaral, that’s really useful!

1 Like

THIS is what I was looking for. Thank you. I did something similar, but was struggling with the data format and how to put things into the right places.

The idea of generating the other directories as well is just brilliant. The script works nice and is easily extendable.