theNewDynamic / gohugo-theme-ananke

Ananke: A theme for Hugo Sites
https://gohugo-ananke-theme-demo.netlify.com/
MIT License
1.09k stars 1.12k forks source link

gohugo-default-sample-hero-image.jpg copied into public build #613

Closed whyboris closed 1 year ago

whyboris commented 1 year ago

The file gohugo-default-sample-hero-image.jpg gets copied into /images folder when I build my website:

/public/images/gohugo-default-sample-hero-image.jpg

I don't need this in my /public folder. There must be some way of avoiding it but I'm unsure how. In fact I don't even need a /images folder as I use /img.

My repo: https://github.com/whyboris/utilitarianism.net

If you have a suggestion, please let me know 🙇 ❤️

regisphilibert commented 1 year ago

Hi @whyboris this image has been added way back to the static dir as this was the only way to serve a default image. Removing it at this point is a breaking change we don't want to impose on our current users.

Now there is a solution but it involves non-trival changes to your setup. You would need to import the theme as a Hugo module (rather than git submodule like you are now).

Then you project would need to be init as a module so you can benefit from the module mounts settings of Hugo. Then in your config file:

# config.yaml
module:
  imports:
    - path: github.com/theNewDynamic/gohugo-theme-ananke
      mounts:
        - source: layouts
          target: layouts
        - source: static
          target: static
          excludeFiles:
          - images/*
whyboris commented 1 year ago

Thank you for the details. I think I will just add to my build script to rm -rf public/images 😅
Cheers ❤️

regisphilibert commented 1 year ago

Ah ah yes sounds better!