Skip to content

Commit

Permalink
feat: add option to surpress warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasmerlin committed Mar 23, 2023
1 parent 37b73c0 commit a2d2385
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/SEO.astro
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export interface Props {
link?: Partial<Link>[];
meta?: Partial<Meta>[];
};
surpressWarnings?: boolean;
}
const { props } = Astro;
Expand All @@ -88,6 +89,7 @@ const {
noindex,
nofollow,
charset,
surpressWarnings,
} = props;
function validateProps(props) {
Expand All @@ -108,16 +110,20 @@ function validateProps(props) {
if (title && openGraph?.basic.title) {
if (title == openGraph.basic.title) {
console.warn(
"WARNING(astro-seo): You passed the same value to `title` and `openGraph.optional.title`. This is most likely not what you want. See docs for more."
);
if (!surpressWarnings) {
console.warn(
"WARNING(astro-seo): You passed the same value to `title` and `openGraph.optional.title`. This is most likely not what you want. See docs for more."
);
}
}
}
if (openGraph?.basic?.image && !openGraph?.image?.alt) {
console.warn(
"WARNING(astro-seo): You defined `openGraph.basic.image`, but didn't define `openGraph.image.alt`. This is stongly discouraged.'"
);
if (!surpressWarnings) {
console.warn(
"WARNING(astro-seo): You defined `openGraph.basic.image`, but didn't define `openGraph.image.alt`. This is stongly discouraged.'"
);
}
}
}
Expand Down

0 comments on commit a2d2385

Please sign in to comment.