1.4 KiB
title, linktitle, description, godocref, date, publishdate, lastmod, categories, tags, signature, workson, hugoversion, relatedfuncs, deprecated
| title | linktitle | description | godocref | date | publishdate | lastmod | categories | tags | signature | workson | hugoversion | relatedfuncs | deprecated | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| emojify | 2017-02-01 | 2017-02-01 | 2017-02-01 |
|
|
false |
Runs the string through the Emoji emoticons processor. The result will be declared as "safe" to prevent Go templates from filtering it as unsafe HTML.
See the Emoji cheat sheet for available emoticons.
{{ "I :heart: Hugo" | emojify }}
The emojify function can be called in your templates but not directly in your content files. However, emojis are most often seen inline. The following is a very simple shortcode template you can use to add emojis quickly while you write content. It is also the emo shortcode used for the Hugo docs. (See Hugo Docs Shortcodes Source.)
{{% code file="layouts/shortcodes/emo.html" download="emo.html" %}}
{{< readfile file="layouts/shortcodes/emo.html" >}}
{{% /code %}}
You can then call the shortcode directly in your content using the following:
{{% code file="content/functions/emojify.md" %}}
I {{</* emo ":heart:" */>}} Hugo!
{{% /code %}}
The preceding use of the emo shortcode called in content will display as follows:
I {{< emo "❤️" >}} Hugo!