How to download file from Hugo site?

Hi,

I have built Hugo website that works great.
What I want to do now is provide possibility for users who land on my website to download a PDF file.

I have a button that looks like this

<div class="button_cont">
   <a class="example_d" href="">
    {{ i18n "CTAbutton"}}
   </a>
</div>

It says “DOWNLOAD” and when user clicks on it it suppose to download a PDF file to his computer.
How can I do this with Hugo?

Any tips highly appreciated :slight_smile:

Put the file into static/path/to/file.pdf and then add the path to the href attribute like href="/path/to/file.pdf"

1 Like

Thank you for your answer.

So I put my PDF file to static/docs/Pozivnica.pdf
23%20PM

And I changed my href to
href="/static/docs/Pozivnica.pdf"

But when I click on download button I get 404 page not found error

EDIT

Ohh it was my bad I should have put href="/docs/Pozivnica.pdf" and not href="/static/docs/Pozivnica.pdf"

It works just fine now, Thank you :slight_smile: