Search code examples
pdfembeddingbolt-cms

Embedding a pdf into a webpage


I'm trying to embed a pdf into a page and I'm using the 'file' field in contenttypes.yml

file:  
    type: file  
    extensions: [ pdf, doc, docx, ppt, pptx ]  

The field appears in the content editor and it evens insert some code into the page. However the result is disappointing, the navigator only outputs a line that goes like that :

file:2014/12/doc.pdf

Can someone tell me what did I do wrong ?


Solution

  • You should add your own HTML around the file field, to allow users to download it. Something like this:

    {% if record.file is not empty %} 
    Click to download: <a href="{{ paths.files }}{{ record.file }}">{{record.file}}<a>
    {% endif %}