Thomas Weller
Thomas Weller

Reputation: 59615

How do I provide files for download?

I have written a post and would like to provide a file as attachment for download.

So far I have

However, the file does not get copied to the correct location.

I have

So neither page gave me an answer on how to provide files for download.

I don't know where to put static files in the directory structure. Once I knew that, it seems I could use some Liquid like {{ site.static_files }}, but even then I'd still need to specify a file name.

Upvotes: 28

Views: 13056

Answers (2)

SabDeM
SabDeM

Reputation: 7200

Here is my solution. I have a "myname".github.io, I created a folder /download inside the myname.github.io and inside this download folder I uploaded the files I want to include in my posts.

In the single post then I created the following code:

some text and [here is possible to download the file in PDF][1]

[1]:{{ site.url }}/download/file.pdf

Upvotes: 27

Jack Humbert
Jack Humbert

Reputation: 137

You can place your download.zip file in the root of your project, and it will get copied over to {{ site.url }}/download.zip. If you'd like it contained in a folder, you can create any folder, eg download/, and any file will be able to accessed via {{ site.url }}/download/*.

Every other directory and file except for [the Jekyll files]—such as css and images folders, favicon.ico files, and so forth—will be copied verbatim to the generated site.

from the Jekyll Docs

Upvotes: 2

Related Questions