Adding emoji to a Hugo page variable

只谈情不闲聊 提交于 2021-01-22 09:43:46

问题


How to add an emoji to a Hugo page variable? E.g. inside the title in the following code snippet:

date = "2016-11-20T12:00:00"
draft = false
tags = ["Fun"]
title = "Went sporting :heart:"

回答1:


Hugo has two ways of handling Emojis.

Setting enableEmoji=true in your site config will handle emoji syntax like :heart: in your markdown content.

For titles etc. you must use the emojify template func, so in your template:

{{ .Title | emojify }}



来源:https://stackoverflow.com/questions/41047920/adding-emoji-to-a-hugo-page-variable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!