0

I want to add MDB icon to the h2 tag - so that it display next to the text. However, I need to use thymeleaf to display one variable, and therefore, everything that is inside my tag is being replaced.

<h2 class="mt-5 text-center text-white" th:text="|${category} - newest posts|">politics - newest posts</h2>

If I try to do it that way

<h2 class="mt-5 text-center text-white" th:text="|${category} - newest posts|">
politics - newest posts <i class="fas fa-landmark text-warning mx-2"></i>
</h2>

nothing is gonna change - because it will be replaced by th:text. If I try to add this icon outside the h2 tag, it's gonna be under it, so it is not my desired outcome.

My desired outcome in h2: "Politics - newest posts THE_ICON", or "Sport - newest posts THE_ICON". The problem is just to connect thymeleaf variable with the icon.

Dybol
  • 1

0 Answers0