Is there an alternative to putting resource files in the page bundle directories / having hugo copy the files on each build?
This is less of a “I can’t make it work” and more of a “what are the best practices here.”
I am building a site where there are lots of pages (right now there are page bundles) with big resources. Basically, each page represents a topic with a bunch of PDF files. The page describes the topic, and the templates build nice lists of all the PDF files that are resources.
Everything works great on my local machine. On the server, dealing with all of these large files is problematic. It might be the file system on the server I am using (it is AFS), but I get no control over that. Not only do site builds take a long time, they often fail (either with a “bus error” or “interrupted system call” - examples at the end of this note). Plus, it seems wasteful to do all the excess copying.
I would also prefer to have these files in a different place (the site is maintained using GIT, and managing these large binary files in GIT is not ideal for my desired workflow).
Hugo doesn’t do anything with the contents of these files other than copy them. I do make use of the list of page resources (for example, to generate a list of links to them). For each resource, I get the name, get a link to the item, …
Is there a good alternative to having page resources? Is there a way that I could add a “resource-like” file (or URL) to the resources list in the page front matter? Are there best practices for dealing with these kinds of large resource files?
Here is an example of what I am trying to achieve:
It does work well - when the sever actually builds things (which it did this one time).
I appreciate any suggestions. I guess I could just be happy that I have gotten it to work, but I’d like to make it be happier with my server infrastructure.
Often, when I build, I get something like…
ERROR 2020/06/28 15:32:47 Failed to publish Resource for page "/u/g/l/gleicher/private/Hugo/HugoHome/content/talks/2004_11_gametech/index.md": read /u/g/l/gleicher/private/Hugo/HugoHome/content/talks/2004_11_gametech/Gdsem-notes.pdf: interrupted system call
unexpected fault address 0x11a2fe9
fatal error: fault
[signal SIGBUS: bus error code=0x2 addr=0x11a2fe9 pc=0x11a2fe9]
goroutine 1 [running, locked to thread]: runtime.throw(0x1d9d409, 0x5) /usr/local/go/src/runtime/panic.go:1116 +0x72 fp=0xc000db25e8 sp=0xc000db25b8 pc=0x4f1712 runtime.sigpanic() /usr/local/go/src/runtime/signal_unix.go:692 +0x443 fp=0xc000db2618 sp=0xc000db25e8 pc=0x508203 github.com/aws/aws-sdk-go/aws/endpoints.init() /email@example.com/aws/endpoints/defaults.go:3087 +0x88839 fp=0xc000dbfe98 sp=0xc000db2618 pc=0x11a2fe9 runtime.doInit(0x306b800) /usr/local/go/src/runtime/proc.go:5414 +0x8a fp=0xc000dbfec8 sp=0xc000dbfe98 pc=0x50097a runtime.doInit(0x3070000) /usr/local/go/src/runtime/proc.go:5409 +0x57 fp=0xc000dbfef8 sp=0xc000dbfec8 pc=0x500947 runtime.doInit(0x3078040) /usr/local/go/src/runtime/proc.go:5409 +0x57 fp=0xc000dbff28 sp=0xc000dbfef8 pc=0x500947 runtime.doInit(0x307d340) /usr/local/go/src/runtime/proc.go:5409 +0x57 fp=0xc000dbff58 sp=0xc000dbff28 pc=0x500947 runtime.doInit(0x3064e80) /usr/local/go/src/runtime/proc.go:5409 +0x57 fp=0xc000dbff88 sp=0xc000dbff58 pc=0x500947 runtime.main() /usr/local/go/src/runtime/proc.go:190 +0x1ce fp=0xc000dbffe0 sp=0xc000dbff88 pc=0x4f3d4e runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000dbffe8 sp=0xc000dbffe0 pc=0x524331