Skip to content

Commit

Permalink
fix unfiltered url
Browse files Browse the repository at this point in the history
  • Loading branch information
jemikanegara committed May 28, 2024
1 parent 0631ac7 commit 608eee4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,14 @@ function modifyHtmlStrings(rootElement, language, apiKey, shouldOptimizeSEO) {

if (shouldOptimizeSEO) {
const metaTags = Array.from(document.getElementsByTagName('meta'));
const cleanMetaTags = metaTags.filter((meta) =>
(meta.content || "").trim() &&
meta.name != "X-UA-Compatible" &&
meta.name != "viewport" &&
!isUrl(meta.content)
);
const cleanMetaTags = metaTags.filter((meta) => {
if (!(meta.content || "").trim()) return false;
if (meta.name == "X-UA-Compatible") return false;
if (meta.name == "viewport") return false;
const isTheContentAnUrl = isUrl(meta.content);
if (!isTheContentAnUrl) return false;
return true;
});

const imgTags = Array.from(document.getElementsByTagName('img'));
// only include img tags that has alt or title attribute
Expand Down

0 comments on commit 608eee4

Please sign in to comment.