HUGO

Is there a Hugo command to create page bundle?

Hi,

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
    index.md

Anything like that exist?

Thanks

1 Like

I have a small bash script to help with that:

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

        hugo new post/$DATE-$SLUG/index.md

        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/;
 fi

The usage is ./new post $title

3 Likes

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.