【发布时间】:2020-12-12 18:14:01
【问题描述】:
我希望能够定义一个针对打印进行了优化的 HTML 模板。看起来 Hugo 自定义输出格式正是我所需要的,但我很难理解如何使它工作。
以下是定义新格式的 config.yaml 文件的摘录:
outputFormats:
printFormat:
name: print
mediaType: text/html
isHTML: true
path: print
outputs:
page:
- HTML
- print
home:
- HTML
- RSS
section:
- HTML
- RSS
taxonomy:
- HTML
- RSS
term:
- HTML
- RSS
我还创建了<theme>/layouts/_default/baseof.print.html 和<theme>/layouts/_default/single.print.html。
我在尝试构建时没有收到任何错误,但是我也没有看到任何生成的打印模板。
我也不完全理解以资源为目标的 url 结构是什么样的。这是我尝试过的
https://<domain-name>/posts/<post-name>.print
https://<domain-name>/posts/<post-name>.print.html
https://<domain-name>/posts/print/<post-name>
https://<domain-name>/posts/<post-name>/print/index.html
有人可以帮助我了解我在配置中做错了什么以及访问自定义输出的 URL 是什么样的吗?
【问题讨论】:
标签: templates hugo printing-web-page