英文:
Markdown support in hugo blog post's title?
问题
Hugo有一个前置数据(front matter)部分,它支持TOML格式。
+++
date = "2016-11-15T09:36:44+05:30"
draft = true
title = "Grab it for <s>$100</s> $40"
+++
在这里,我使用<s>$100</s>
来划掉$100,但是我无法在Hugo的文章中的前置数据部分实现相同效果。所以Hugo不支持在标题中使用Markdown吗?有没有任何解决方法?
英文:
Hugo has its front matter where it supports TOML format.
> +++
> date = "2016-11-15T09:36:44+05:30"
> draft = true
> title = "Grab it for <s>$100</s> $40"
> +++
Here I used <s>$100</s>
to strike through $100, but I am unable to do the same in hugo post, inside that front matter. So Hugo doesn't support markdown in title?, Is there any workaround for it?
答案1
得分: 5
你可以在生成标题的布局中使用以下代码:
{{ .Title | markdownify }}
通常可以在 layouts/
目录下找到该布局文件。
英文:
You could use
{{ .Title | markdownify }}
in your layout that is generating the title. It is usually found at layouts/
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论