问题
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