How to display the TID of a term reference field in a content type? In Drupal 8, I have a blog content type with a taxonomy term reference field called category.

How can I print out the Term ID of the taxonomy term of the category field in my node.html.twig file.

I can print the term name using {{ content.field_category }} but I also want to print out the term ID which should be a unique number. How should I go about doing this as I have search for days without any clue?
One "hacky" way to do this:

{# First step: capture the rendered output of the internal path link for a term #}  
{% set tid %}{{ content.field_category.0['#url'] }}{% endset %}

{# Second step: do some string processing on the captured output, removing the /taxonomy/term/ prefix and getting the TID #}  
{{ tid|trim|replace({ '/taxonomy/term/' : '' }) }}


Good luck!