Difference between emoji string and literal emoji?

I’m wondering if literal emoji characters :vulcan_salute: can be typed into the raw markdown and then rendered on the page as emoji, or must they be given by the :smile: string syntax? Because not all emojis can be given by the string syntax.

I read somewhere in this forum that the string syntax is simply a shortcut for Hugo to use to convert to the unicode, am I wrong to think that the literal emoji character is inserting the literal unicode?

Would this work the same?

you can use emoji like that :+1: into markdown, you don’t need syntax.

Just be aware that some are not working on windows despite working fine on macos/ios/android like flags: :poland:

Emoji are unicode blocks inserted as literally :pretzel:

1 Like

Each emoji has a “string version”, also called CLDR.

Hugo uses a Go emoji library for converting string to emoji unicode. I have bookmarked this for reference:

Here’s another useful reference:

  • Emoji List, v15.1
    • Here, you will find that each emoji can be described in more than one way, but Hugo might not recognize all those strings. So I use the first link above for reference.

This technique of referencing is not at all elegant. But I have a handful of emojis that I typically use, so I don’t need those references that often.

2 Likes

I suspect the :smile: syntax is easier to remember … Which is probably why we added it to Hugo some moons ago.

I prefer to just use the search for the emoji and copy/paste the unicode char into my document. It’s slightly harder, but it’s 1. More portable and 2. Makes me think twice before using an emoji.

3 Likes

You can definitely. Personally, I prefer it than CLDR because it’s how it should be in the first place–just that our keyboards are not enough to handle all of it.

If I’m on desktop, I use emojipedia.com to search. If mobile, I use Google Keyboard since it’s the only keyboard in Android with a constantly updated emoji set–regardless if the Android version doesn’t have it yet.

  • For desktop, you just need an appropriate font. I use twemoji-color-font.

  • For websites, you can check Twemoji Github itself. (Even if your visitor doesn’t have an updated emoji font, they’ll still see the emoji, especially useful for desktop visitors.)

You can also check my Unicode and Emoji Test Page–typed directly and uses Twemoji embed. (content source–just copied over from my old WordPress)

Thank you all for the insight!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.