Skip to content

Commit

Permalink
Replace console.warn with Frontity's warn
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Aug 25, 2020
1 parent 7bae296 commit 633adb3
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions packages/head-tags/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { warn } from "frontity";
import {
HeadTags,
HeadTag,
Expand All @@ -6,12 +7,6 @@ import {
TaxonomyWithHeadTags,
} from "../../types";

// Return a string inviting to ask questions in the community.
const msg = (text: string) => `${text}
If you have any questions, join our community at https://community.frontity.org/.
`;

// Attributes that could contain links.
const possibleLink = ["href", "content"];

Expand Down Expand Up @@ -114,12 +109,10 @@ export const useFrontityLinks = ({
try {
json = JSON.parse(content);
} catch (e) {
console.warn(
msg(
`The following content of a <script type="ld+json"> tag is not a valid JSON. Links in that tag will not be changed.
warn(
`The following content of a <script type="ld+json"> tag is not a valid JSON. Links in that tag will not be changed.
${content}`
)
);
}

Expand Down Expand Up @@ -211,10 +204,8 @@ export const getCurrentHeadTags = ({

// Do not change links if `state.frontity.url` is not defined.
if (!state.frontity || !state.frontity.url) {
console.warn(
msg(
"Property `state.headTags.links.transform` is defined but `state.frontity.url` is not. All links in <head> tags pointing to other site (e.g. WordPress) instead to the Frontity site won't be changed."
)
warn(
"Property `state.headTags.links.transform` is defined but `state.frontity.url` is not. All links in <head> tags pointing to other site (e.g. WordPress) instead to the Frontity site won't be changed."
);
return headTags;
}
Expand Down

0 comments on commit 633adb3

Please sign in to comment.