Skip to content

Commit

Permalink
handle meta property
Browse files Browse the repository at this point in the history
  • Loading branch information
jemikanegara committed Jun 18, 2024
1 parent 7f5f778 commit 2f4e125
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,14 @@ function modifyHtmlStrings(rootElement, language, apiKey, shouldOptimizeSEO) {
if (!(meta.content || "").trim()) return false;

const validMetaTagNames = ["description", "og:title", "og:description", "twitter:title", "twitter:description"];
if (!validMetaTagNames.includes(meta.name.toLowerCase())) return false;

function isValidMeta() {
const metaName = meta.name.toLowerCase();
const metaProperty = (meta.getAttribute('property') || "").toLowerCase();
return validMetaTagNames.includes(metaName) || validMetaTagNames.includes(metaProperty);
}

if (!isValidMeta()) return false;

const isTheContentAnUrl = isUrl(meta.content);
if (isTheContentAnUrl) return false;
Expand Down

0 comments on commit 2f4e125

Please sign in to comment.