I am using Github to host a small blog with Hugo. I have some audio and video files that I would like to embed into a post. I have stored the audio under static/audio/albumname/filename
and the video under `static/video/filename’. However, when I push the repo to GitHub, the files are not being found, and I get an empty video/audio player.
I was wondering if I am missing something because I am hosting everything on github. I know that, files in the static directory are being copied into the public directory when the page is being built. But I do not understand if hosting everything via github adds any idiosyncrasies that prevent the files from being found/displayed.
Addendum: I discovered the cause of the error. Github pages does not include the repo name for the project for assets in the static folder (i.e. a video that should be referenced as username.github.io/repo_name/video/filename.mp4
get the link: username.github.io/video/filename.mp4
) nd hence produces a 404 error. The appears to be true for all types of media.
Temporary Solution: The problem can be circumvented by adding the missing repo name in the markdown files (i.e. {{< video src="/repo_name/video/weights.mp4"autoplay="true" loop="true" >}}
instead of {{< video src="/video/weights.mp4"autoplay="true" loop="true" >}}
. This will break the display of the assets with hugo server
but it will allow correct deployment on github pages.