From 918498c377d33b42609e82162584afc4dc9224af Mon Sep 17 00:00:00 2001 From: Manfred Tremmel Date: Mon, 18 Jun 2018 21:12:05 +0200 Subject: [PATCH] set meta tag name and not property for specified attributes --- src/main/java/com/arcbees/seo/TagsInjector.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/arcbees/seo/TagsInjector.java b/src/main/java/com/arcbees/seo/TagsInjector.java index dadfe44..0c402a2 100644 --- a/src/main/java/com/arcbees/seo/TagsInjector.java +++ b/src/main/java/com/arcbees/seo/TagsInjector.java @@ -16,7 +16,9 @@ package com.arcbees.seo; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; import com.arcbees.seo.widget.OgType; @@ -29,6 +31,8 @@ public class TagsInjector { private static final String REL_CANONICAL = "canonical"; + private static final List META_WITH_NAME = Arrays.asList("description", "keywords", "robots", + "twitter:title", "twitter:description", "twitter:image", "twitter:card", "twitter:site"); private final Document document; public TagsInjector() { @@ -102,7 +106,11 @@ private void setMetaTag( if (metaElement == null) { metaElement = document.createMetaElement(); - metaElement.setAttribute("property", property); + if (META_WITH_NAME.contains(property)) { + metaElement.setName(property); + } else { + metaElement.setAttribute("property", property); + } document.getHead().insertFirst(metaElement);