How can I add 'noindex' tag to blog posts with target tag?

Hello community,

Example: add ‘noindex’ element to blog posts which contained the tag ‘vip’.

referred code:

{% if article.tags.size > 0 %}

   <meta name = "robots" content = "noindex">

{% endif %}

--*--*---

 {%- if article.tags.size > 0 -%} 
<ul> 
{{ 'blogs.article.posted_in' }} 
<li> 
{%- for tag in article.tags -%}
 <a href="{{ blog.url }}/tagged/{{ tag | handle }}">{{ tag }}</a>{% unless forloop.last %}, {% endunless %} {%- endfor -%}
 </li> 
</ul> 
{%- endif -%}

Thank you!

Anyone can help this?