rothsandro / eleventy-notes

A template for Eleventy to publish your personal notes or docs.
https://eleventy-notes.sandroroth.com/
138 stars 16 forks source link

Support for using emojis as tags #38

Closed xavierroy closed 1 year ago

xavierroy commented 1 year ago

I use a lot of emojis as tags. I use the map emoji (πŸ—ΊοΈ) for MoCs, books (πŸ“š) for books.

Currently using emojis as tags breaks. Could you provide support for that?

rothsandro commented 1 year ago

Thanks for bringing this up. Tags can contain emojis when combined with text but it breaks when using only an emoji (or other special char) as tag. The reason is that each tag gets its own page and because the emoji is removed when generating the url, you end up with invalid/duplicate urls.

I see three possible solutions for this:

  1. Keep emojis: We could keep the emoji in the url. Modern browsers support emojis in url but it could still break other software like read-it later apps if they don't support it. So this is probably not a good idea.
  2. Replace emojis: We could replace emojis with their name, e.g. "πŸ“š" to "books" and "πŸ—ΊοΈ" to "world-map". But I couldn't find an up to date list of emojis with their name that would allow this transformation and new emojis are added regularly which makes it even harder. In addition, the name may not always be suitable, e.g. "πŸ“˜" would result in "blue-book" but simply "book" would probably be better.
  3. Mapping tags: We could allow renaming tags via app.json. In the example below, the notes can use the tag "πŸ—ΊοΈ" which would then be displayed as "πŸ—ΊοΈ Map of Content" and result in the url /tags/map-of-content.
{
  "tags": {
    "map": {
      "πŸ—ΊοΈ": "πŸ—ΊοΈ Map of Content",
      "πŸ“š": "πŸ“š Books"
    }
  }
}

What do you think?

xavierroy commented 1 year ago

The tag mapping would work fine. In Obsidian, I could still use emoji-tags and map it via app.json. This allows customizing the title. 1 is browser dependent. Option 2 is dependent on user context - what an emoji means to them.

rothsandro commented 1 year ago

Thanks for the feedback. I'll add support for this with the next minor version.

rothsandro commented 1 year ago

Feature shipped πŸŽ‰ It's available in v0.18.0 that has just been released.