diff --git a/_includes/badge.html b/_includes/badge.html
new file mode 100644
index 00000000..ac2a8a7e
--- /dev/null
+++ b/_includes/badge.html
@@ -0,0 +1,20 @@
+{% if include.link %}
+ {{ include.text }}
+{% else %}> {{ include.text }}{% endif %}
+
+{% else %}
+ {{include.text}}
+ {% else %}
+ > {% if include.icon %}{% endif %} {{include.text}}
+ {% endif %}
+
+{% endif %}
diff --git a/_includes/cardv2.html b/_includes/cardv2.html
index 3b88f05a..87066b83 100644
--- a/_includes/cardv2.html
+++ b/_includes/cardv2.html
@@ -45,7 +45,7 @@
{% assign label_data = label | split:"::" %}
{% for label_attr in label_data %}
{% assign attr = label_attr | split:"==" %}
- {% if attr[0] == "color" }
+ {% if attr[0] == "color" %}
{% assign color = attr[1] %}
{% elsif attr[0] == "link" %}
{% assign link = attr[1] %}
@@ -57,26 +57,13 @@
{% assign tooltip = attr[1] %}
{% endif %}
{% endfor %}
- {% if link %}
- {{ text }}
- {% else %}> {{ text }}{% endif %}
-
- {% else %}
- {{text}}
- {% else %}
- > {% if icon %}{% endif %} {{text}}
- {% endif %}
-
- {% endif %}
+ {% include badge.html
+ link=link
+ color=color
+ text=text
+ icon=icon
+ tooltip=tooltip
+ %}
{% endfor %}
{% endif %}