[SOLVED] Static file in theme not copied to `public`

I’m a frontend designer new to Hugo and creating a theme from scratch.

In the documentation it says:

Everything in the static directory will be copied directly into the final site when rendered

But nothing in /themes/indiego/static is being copied to /public/ :disappointed:, despite this encouraging message from hugo serve:

Static file changes detected
2018-02-06 13:14:12.066 +0000
Syncing logo-thumbnail.png to /

My guess is that I need to configure this behaviour in config.yml? I’ll keep searching through the docs in the meantime :slight_smile:

Site repo: http://github.com/growdigital/indiego.org.uk
Theme repo: http://github.com/growdigital/indiego

Permissions! I thought to run $ hugo serve --verbose and received these messages:

INFO 2018/02/06 13:25:13 Received System Events: ["/Users/growdigital/Sites/indiego.org.uk/static/logo-thumbnail.png": CREATE]

Static file changes detected
2018-02-06 13:25:13.436 +0000
Syncing logo-thumbnail.png to /
INFO 2018/02/06 13:25:14 Received System Events: ["/Users/growdigital/Sites/indiego.org.uk/static/logo-thumbnail.png": CHMOD]
INFO 2018/02/06 13:25:18 Received System Events: ["/Users/growdigital/Sites/indiego.org.uk/static/.DS_Store": CHMOD "/Users/growdigital/Sites/indiego.org.uk/static/.DS_Store": WRITE "/Users/growdigital/Sites/indiego.org.uk/static/.DS_Store": WRITE]
INFO 2018/02/06 13:25:33 Received System Events: ["/Users/growdigital/Sites/indiego.org.uk/static/.DS_Store": WRITE]

I installed Hugo with brew, so would be surprised if there’s a permissions issue. But not that surprised!

Not sure if I understand correctly, but the files won’t get copied into the public/ dir when running hugo server (they actually are, but in some temp directory).

Do the files get copied when you run just hugo?

Or another question would be: How did you deduce that the files aren’t getting copied? Because they don’t show up physically in the public/ directory? Or because you don’t find the localhost reflect the should-be-copied files?

And finally: Do you see the same behavior between hugo and hugo server?

1 Like

Use --renderToDisk with hugo server to get it to save to disk. It defaults to caching in memory. (see hugo server --help)

1 Like

“When rendered” implies, when you run hugo, not hugo server.

My zsh functions hugodeploy... and hugoserver... might be helpful. Poke around here:

@kaushalmodi and @RickCogley bingo! :tada:

I just ran hugo and files were generated – I didn’t realise about the memory caching, which is why no physical files appearing when running hugo serve.

thanks for swift reply :smile: really enjoying working with Hugo (superfast) and this kind of support makes it sweeter still