HTTP2 preload directive for fingerprinted asset in .htaccess

Thanks for the quick replies.

After some more hack-hackiness, I figured out that my original method of calling resources.* works, specifically resources.ExecuteAsTemplate. I had just messed up the syntax a bit on my first attempts and assumed Hugo couldn’t do it.

For anyone else who wants to do this:

  1. Put .htaccess in assets folder
  2. Call resources.ExecuteAsTemplate on the .htaccess file (from anywhere)
  3. Call .RelPermalink on that resource (from anywhere) so Hugo actually puts it into public. I do this in an HTML comments tag < !-- – >, which I strip out with minify, i.e., it never shows up in source.
2 Likes