diff --git a/changelog/items/bugs-fixed/fix-external-links-on-news-header.md b/changelog/items/bugs-fixed/fix-external-links-on-news-header.md new file mode 100644 index 00000000..aa7c8c54 --- /dev/null +++ b/changelog/items/bugs-fixed/fix-external-links-on-news-header.md @@ -0,0 +1 @@ +- fixed the latest news link redirect in the news header diff --git a/packages/website/src/components/NewsHeader/NewsHeader.js b/packages/website/src/components/NewsHeader/NewsHeader.js index cdbbffb7..17161f26 100644 --- a/packages/website/src/components/NewsHeader/NewsHeader.js +++ b/packages/website/src/components/NewsHeader/NewsHeader.js @@ -12,6 +12,7 @@ const NewsHeader = () => { id frontmatter { title + external } fields { slug @@ -26,8 +27,9 @@ const NewsHeader = () => { if (!latestNews) return null; // no news - const title = latestNews.node.frontmatter.title; - const link = { to: latestNews.node.fields.slug }; + const { frontmatter, fields } = latestNews.node; + const { title, external } = frontmatter; + const link = external ? { href: external } : { to: fields.slug }; return (