Search code examples
pdfdownloadhyperlinkzotonic

How do you provide download links for attached PDFs in Zotonic?


I would like to let my content authors upload PDFs and provide download links. Unfortunately, they get a page with a preview of the first page of the PDF instead of the PDF itself when they link to it.

How do you provide download links for attached PDFs in Zotonic?


Solution

  • The following snippet (given a RSC id of the media as pdf_rsc) will provide a download link:

    <a href="/media/attachment/{{ m.rsc[pdf_rsc].filename }}">Download {{ m.rsc[pdf_rsc].title }}</a>