How can I hide empty metafields effectively?

I am trying to hide my metafields when empty, but cant seem to get it right

Add != blank with metafield in if condition

{% if product.metafields.namespace.key != blank %}
  {{ product.metafields.namespace.key }}

{% endif %}

Hi, Thank you for the quick response! Could you please tell if this is the correct section to add in the above bit of code? Is it possible to let me know where to add this in exactly? We have 2 tabs/ metafields we need only to be available on some items, more intricate items that warrant extra information, for other items these extra fields are not necessary or would not have enough information to make it worth while for these to be visible. These 2 are ‘‘Specifications’’ and ‘‘Who is this for?’’

},
“5037f519-1343-4167-a315-31c99471503f”: {
“type”: “tab”,
“settings”: {
“column”: “primary”,
“title”: “Specification”,
“text”: “

{{ product.metafields.custom.specification_wolf_king_gt | metafield_tag }}</p>”,
“image_width”: 1000,
“align”: “center”,
“link”: “”,
“tab_content”: “”,
“open”: false
}
},
“c13717d6-5def-40f5-9684-68f8f103b0d4”: {
“type”: “tab”,
“settings”: {
“column”: “secondary”,
“title”: “Who is this scooter for?”,
“text”: “

{{ product.metafields.custom.who_is_this_for_ | metafield_tag }}</p>

</p>”,
“image_width”: 1000,
“align”: “center”,
“link”: “”,
“tab_content”: “”,
“open”: false

Good day, just following up on this query, would really appreciate assistance on this matter :slightly_smiling_face: