Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma] / docs / config / custom_emoji.md
1 # Custom Emoji
2
3 Before you add your own custom emoji, check if they are available in an existing pack.
4 See `Mix.Tasks.Pleroma.Emoji` for information about emoji packs.
5
6 To add custom emoji:
7 * Create the `STATIC-DIR/emoji/` directory if it doesn't exist
8 (`STATIC-DIR` is configurable, `instance/static/` by default)
9 * Create a directory with whatever name you want (custom is a good name to show the purpose of it).
10 This will create a local emoji pack.
11 * Put your `.png` emoji files in that directory. In case of conflicts, you can create an `emoji.txt`
12 file in that directory and specify a custom shortcode using the following format:
13 `shortcode, file-path, tag1, tag2, etc`. One emoji per line. Note that if you do so,
14 you'll have to list all other emojis in the pack too.
15 * Either restart pleroma or connect to the iex session pleroma's running and
16 run `Pleroma.Emoji.reload/0` in it.
17
18 Example:
19
20 image files (in `instance/static/emoji/custom`): `happy.png` and `sad.png`
21
22 content of `emoji.txt`:
23 ```
24 happy, /emoji/custom/happy.png, Tag1,Tag2
25 sad, /emoji/custom/sad.png, Tag1
26 foo, /emoji/custom/foo.png
27 ```
28
29 The files should be PNG (APNG is okay with `.png` for `image/png` Content-type) and under 50kb for compatibility with mastodon.
30
31 Default file extentions and locations for emojis are set in `config.exs`. To use different locations or file-extentions, add the `shortcode_globs` to your secrets file (`prod.secret.exs` or `dev.secret.exs`) and edit it. Note that not all fediverse-software will show emojis with other file extentions:
32 ```elixir
33 config :pleroma, :emoji, shortcode_globs: ["/emoji/custom/**/*.png", "/emoji/custom/**/*.gif"]
34 ```
35
36 ## Emoji tags (groups)
37
38 Default tags are set in `config.exs`. To set your own tags, copy the structure to your secrets file (`prod.secret.exs` or `dev.secret.exs`) and edit it.
39 ```elixir
40 config :pleroma, :emoji,
41 shortcode_globs: ["/emoji/custom/**/*.png"],
42 groups: [
43 Finmoji: "/finmoji/128px/*-128.png",
44 Custom: ["/emoji/*.png", "/emoji/custom/*.png"]
45 ]
46 ```
47
48 Order of the `groups` matters, so to override default tags just put your group on top of the list. E.g:
49 ```elixir
50 config :pleroma, :emoji,
51 shortcode_globs: ["/emoji/custom/**/*.png"],
52 groups: [
53 "Finmoji special": "/finmoji/128px/a_trusted_friend-128.png", # special file
54 "Cirno": "/emoji/custom/cirno*.png", # png files in /emoji/custom/ which start with `cirno`
55 "Special group": "/emoji/custom/special_folder/*.png", # png files in /emoji/custom/special_folder/
56 "Another group": "/emoji/custom/special_folder/*/.png", # png files in /emoji/custom/special_folder/ subfolders
57 Finmoji: "/finmoji/128px/*-128.png",
58 Custom: ["/emoji/*.png", "/emoji/custom/*.png"]
59 ]
60 ```
61
62 Priority of tags assigns in emoji.txt and custom.txt:
63
64 `tag in file > special group setting in config.exs > default setting in config.exs`
65
66 Priority for globs:
67
68 `special group setting in config.exs > default setting in config.exs`