gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.52k stars 7.51k forks source link

archetypes: Copy empty directories #9766

Open roschelle63 opened 2 years ago

roschelle63 commented 2 years ago

What version of Hugo are you using (hugo version)?

$ hugo version  v0.96.0+extended 

For a gallery type page, I would like my page bundle to have the structure

page /

correspondingly, I made an archetype with this structure

gallery /

I then use the command: hugo new --kind gallery my-path

This works partially -- it makes a new page bundle with the index.md file. However, if the archetype directory "images" is empty, then no directory named "images" is created in the page bundle. Conversely, if I put something like readme.txt into images in the archetype, then the new page bundle that is created does have the images directory as well as the readme.txt file it contains.

I would like to be able to have an archetype with an empty directory inside, because there is no default image that I want in my gallery. And beyond my use case, its just non-obvious that empty directories in archetype page bundles will not be copied.

jeremy

bep commented 2 years ago

And beyond my use case, its just non-obvious that empty directories in archetype page bundles will not be copied.

Similar to other similar tools, Hugo care about files, not so much directories. Your empty directories will not be included if you push it to Git and similar. We may fix this, but I would suggest that you fill all your archetype directories with some sample files (even an empty .gitkeep or similar).

roschelle63 commented 2 years ago

Thanks for the time to respond, Bjorn. Indeed, my workaround is to put a readme.txt into the directory so now it is not empty. If I get fancy I can make a little shell script to do the whole three step workaround I need:

a) make the new page bundle from the archetype b) rm the readme.txt from my page bundle c) cp a directory of images from elsewhere into the empty images directory in my page bundle

— Jeremy

On Apr 10, 2022, at 1:06 PM, Bjørn Erik Pedersen @.***> wrote:

And beyond my use case, its just non-obvious that empty directories in archetype page bundles will not be copied.

Similar to other similar tools, Hugo care about files, not so much directories. Your empty directories will not be included if you push it to Git and similar. We may fix this, but I would suggest that you fill all your archetype directories with some sample files (even an empty .gitkeep or similar).

— Reply to this email directly, view it on GitHub https://github.com/gohugoio/hugo/issues/9766#issuecomment-1094328680, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYQ45VOUU4KIZRRVU4ZFRADVEMC7TANCNFSM5TA6PE7Q. You are receiving this because you authored the thread.