I have a rather odd use-case where I need to serve a few short mp4 videos on my Hugo site and I need them not to be external resources (for caching purposes). Now normally I’d just drop the videos into my assets folder and call it a day, but I also don’t want the videos in my git repository since they are big and we already made a big deal about removing all media from our repo a few months ago. Unfortunately it turns out the solution we used (which is geared toward images) won’t cache videos and it’s causing a bunch of problems for us.
So what I’d really like to do is just grab the three videos from our public S3 bucket during builds so that we can have them hosted on the same server as the rest of the site, but we don’t have to store them in our git repo.
I looked at using [[module.mounts]] to grab the videos from the URL during build and put them into the assets folder at that time but that (unsurprisingly) didn’t work. I also know I could use getJSON if this was pure data, but that doesn’t work either since it’s a video.
I can think of a few other solutions like using a pre-build script or implementing git-lfs, but I’d rather not bother with all that for just 3 files if I don’t have to. So I would love to hear if there is in fact a way to just do this with Hugo (or if anyone has a better idea).
355 KB (although to be honest I’ve just realized I was trying to use the 13 MB high quality version this whole time, so if module.mounts works for smaller file sizes then that may have been it).
Thanks @jmooring! Ended up not needing to do this as the underlying issue was different than we originally thought, but this is nonetheless a great solution. Hopefully it will help someone else (or myself) in the future.
I am also very excited for the day we get resources.GetRemote!