我正在尝试将pdf嵌入到页面中,并且我正在使用contenttypes.yml中的“文件”字段
file:
type: file
extensions: [ pdf, doc, docx, ppt, pptx ]
该字段出现在内容编辑器中,它会在页面中插入一些代码。然而结果是令人失望的,导航器只输出一行如下:
file:2014/12/doc.pdf
有人可以告诉我,我做错了什么吗?
答案 0 :(得分:1)
您应该在文件字段周围添加自己的HTML,以允许用户下载它。像这样:
{% if record.file is not empty %}
Click to download: <a href="{{ paths.files }}{{ record.file }}">{{record.file}}<a>
{% endif %}
答案 1 :(得分:0)