Emoji Support

artist.jpg

Emoji can be enabled in a Hugo project in a number of ways.

The [emojify](https://gohugo.io/functions/emojify/) function can be called directly in templates or Inline Shortcodes.

To enable emoji globally, set enableEmoji to true in your site’s configuration and then you can type emoji shorthand codes directly in content files; e.g.

πŸ™ˆ :see_no_evil: πŸ™‰ :hear_no_evil: πŸ™Š :speak_no_evil:


The Emoji cheat sheet is a useful reference for emoji shorthand codes.


N.B. The above steps enable Unicode Standard emoji characters and sequences in Hugo, however the rendering of these glyphs depends on the browser and the platform. To style the emoji you can either use a third party emoji font or a font stack; e.g.

Inline CSS

 1<style>
 2  .emojify {
 3    font-family: Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols;
 4    font-size: 2rem;
 5    vertical-align: middle;
 6  }
 7  @media screen and (max-width:650px) {
 8    .nowrap {
 9      display: block;
10      margin: 25px 0;
11    }
12  }
13</style>

Javascript

 1function createEl(element) {
 2  return document.createElement(element);
 3}
 4
 5function elem(selector, parent = document){
 6  let elem = parent.querySelector(selector);
 7  return elem != false ? elem : false;
 8}
 9
10let navBar = elem(`.${bar}`);
11let nav = elem('.nav-body');
12let open = 'nav-open';
13let exit = 'nav-exit';
14let drop = 'nav-drop';
15let pop = 'nav-pop';
16let navDrop = elem(`.${drop}`);
17let hidden = 'hidden';
18

Swift

 1class Person {
 2  var residence: Residence?
 3}
 4
 5class Residence {
 6  var rooms = [Room]()
 7  var numberOfRooms: Int {
 8    return rooms.count
 9  }
10
11  
12  subscript(i: Int) -> Room {
13    get {
14      return rooms[i]
15    }
16    set {
17      rooms[i] = newValue
18    }
19  }
20  
21  func printNumberOfRooms() {
22    print("The number of rooms is \(numberOfRooms)")
23  }
24
25  var address: Address?
26
27}