Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding emoji to a Hugo page variable

Tags:

hugo

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:"
like image 946
mircealungu Avatar asked Dec 08 '16 20:12

mircealungu


1 Answers

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 }}

like image 108
bep Avatar answered Oct 26 '22 13:10

bep