英文:
When uploading a file via metafield "File reference", how can I display it to the front theme?
问题
如下文档所示,可以使用文件引用元字段上传PDF文件。然而,在主题中显示时,我无法使其正常工作。是否有关于此的有效示例?谢谢。
英文:
As seen in the documentation below, it is possible to upload a PDF file using File referance metafield. However, I cannot get it to work when displaying it to the front end in a theme. Are there any working examples for this? Thank you.
答案1
得分: 1
在Liquid中,您可以使用file_url
过滤器获取URL,并使用iframe显示PDF文档预览:
<iframe src="{{ product.metafields.my_fields.name_of_pdf_field | file_url }}"></iframe>
英文:
In Liquid you can use file_url
filter to get the URL and use iframe to display the PDF document preview:
<iframe src="{{ product.metafields.my_fields.name_of_pdf_field | file_url }}"></iframe>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论