How do I serve binary assets at root without placing the file at root in my project structure?

See title for summary - the rest of the post is long, but detailed and specific.


I have a file called ‘resume.pdf’; PDF files are binary and thus I can’t do anything like placing 2 lines of triple dashes at the front to have it processed and/or use the permalink directive to make sure it gets processed at the correct location.

So, if I want my site to serve the PDF at root in the URL like example.com/resume.pdf, I have to literally place it at root within my project structure, i.e. ./resume.pdf/. I find this to be rather inconvenient for making my project structure look nice on GitHub, as well as organizing it properly. I’d like to look into methods for moving it out of the root and into a subfolder where my other pages live at, like _pages.

Files at _pages can either use permalink within the file or a especially scoped defaults entry to set the permalink. It looks like this for me:

  -
    scope:
      path: "_pages"
    values:
      permalink: "/:title:output_ext"

Unfortunately, it did not work on my resume.pdf file and I’m stuck. I could either

  1. Use a redirect at example.com/resume to a file in ./assets/pdf/resume.pdf
  2. Simply place the file in my project root as I have been doing.

Both would do the trick, but I’d rather place it in _pages and get the permalink directive to work - sites like LinkedIn are unlikely to be able to process the redirect when their site workers check it to cache/download the PDF. Giving it the URL of the PDF in assets is not preferable in this situation.

Edit: A perfect solution would also be useful for serving favicon assets, which also reside in numerous numbers at the root of my project structure.

static files get copied to where ever they are relative to the root - as long as the root is something that GH will copy over. Folders that start with an underscore may not be copied by default so it isn’t a great example.

If you make a folder in the root of the repo called resume and put a file named myresume.pdf in there you can link to it from mysite.com/resume/myresume.pdf

I don’t think permalinks don’t work for static files.