Use Icon instead of String for Category Name in Front Matter

I want to use FontAwesome Icons instead of category names for blog posts. For example, let’s say I have this blog post front matter

draft = false
date = 2020-08-07T23:00:02+02:00
title = "Test"
description = "Test Description"
slug = "" 
tags = ["Tag1"]
categories = ["Car"]
externalLink = ""
series = []

but instead of the name Car I want to display only a Car Icon, e.g. categories = ["<i class='fas fa-car'></i>"] which is not working. Where would I need to declare that and how?

I saw this here about icons in the title which is somehow different as categories is a map ([ ]) and also I want to replace the whole string with an icon.

Can you use emojis?

categories = ["🚗"]
1 Like

You also can do this

  name = "Menu"
  URL = "/menu/"
  pre = "<i class='fas fa-utensils'></i>"
  weight = 20
    class = "menu-specialcolor"

And use it with something like this in your navigation template

<a class="text-color {{ .Params.class }}" href="{{ .URL | relLangURL }}">{{ .Pre }} {{ .Name }}</a>
1 Like