2 ms·
And how do I upload an image of my cat to my all new Hugo site? WP lets me drag/drop or upload media very very easily. Has done for years. Hugo? or indeed mos
by markx2 2y ago
And how do I upload an image of my cat to my all new Hugo site?
WP lets me drag/drop or upload media very very easily. Has done for years.
Hugo? or indeed most SSG's?
- lewiscollard 2y agoYou copy it into the same directory as the post you want to put it in, and reference it as a resource from your post. I made a shortcode for this for my own Hugo site, adding auto thumbnailing & WebP support: https://gist.github.com/lewiscollard/c6651648d1c20144ed89e16431e967b1 https://gist.github.com/lewiscollard/c6651648d1c20144ed89e16... Copy that into your "layouts/shortcodes/image.html" and use it as {{< image src="my cat.jpg" alt="add a description here" >}} If you just want to upload it to _not_ reference it in a post/page, copy it into your `static` directory and it'll be passed through when the site is built. Hope that helps!
- smitelli 2y agoPlain old markdown image syntax also works, although there is no way to preprocess the file or add any additional HTML attributes beyond what you see here: 
- lewiscollard 2y agoYep, that works too. I wrote the shortcode because I didn't want to have to manually resize pictures. That's effort and it means if I change my layout to require wider pictures I have to go find the originals. I think you could do this with a render hook if you want to get fancy (with the benefit that the Markdown for your posts stays as plain Markdown): https://werat.dev/blog/automatic-image-size-attributes-in-hugo/ https://werat.dev/blog/automatic-image-size-attributes-in-hu...
- dewey 2y agoThat’s my main issue with SSG, it’s always a pain.