diff --git a/components/Hyperlinks.js b/components/Hyperlinks.js index 7a996eee..a1eeb7f1 100644 --- a/components/Hyperlinks.js +++ b/components/Hyperlinks.js @@ -127,8 +127,9 @@ function getErrorText(error) { /** * @param {object} props.hyperlink + * @param {string} props.rel - rel prop for the hyperlink (other than noopener and noreferrer) */ -function Hyperlink({ hyperlink }) { +function Hyperlink({ hyperlink, rel = '' }) { const { title, topImageUrl, error, url } = hyperlink; const summary = (hyperlink.summary || '').slice(0, 200); @@ -146,7 +147,7 @@ function Hyperlink({ hyperlink }) { - + {url} @@ -173,8 +174,9 @@ function PollingHyperlink({ pollingType, pollingId }) { * @param {object[] | null} props.hyperlinks * @param {'articles'|'replies'?} props.pollingType - poll article or reply for hyperlinks when it's not loaded (null) * @param {string?} props.pollingId - polling article or reply id for hyperlinks when it's not loaded (null) + * @param {string?} props.rel - rel prop for the hyperlink (other than noopener and noreferrer) */ -function Hyperlinks({ hyperlinks, pollingType, pollingId }) { +function Hyperlinks({ hyperlinks, pollingType, pollingId, rel }) { if (!((pollingId && pollingType) || (!pollingId && !pollingType))) { throw new Error('pollingType and pollingId must be specified together'); } @@ -191,7 +193,7 @@ function Hyperlinks({ hyperlinks, pollingType, pollingId }) { mb={1} > {(hyperlinks || []).map((hyperlink, idx) => ( - + ))} {!hyperlinks && pollingId && ( diff --git a/components/__snapshots__/Hyperlinks.stories.storyshot b/components/__snapshots__/Hyperlinks.stories.storyshot index d5677d3c..960e2466 100644 --- a/components/__snapshots__/Hyperlinks.stories.storyshot +++ b/components/__snapshots__/Hyperlinks.stories.storyshot @@ -78,7 +78,7 @@ exports[`Storyshots Hyperlinks All Variants 1`] = ` https://cofacts.org @@ -135,7 +135,7 @@ exports[`Storyshots Hyperlinks All Variants 1`] = ` https://cofacts.org @@ -186,7 +186,7 @@ exports[`Storyshots Hyperlinks All Variants 1`] = ` https://not-found.org diff --git a/pages/article/[id].js b/pages/article/[id].js index 987fdb5d..d16456e5 100644 --- a/pages/article/[id].js +++ b/pages/article/[id].js @@ -133,6 +133,7 @@ const LOAD_ARTICLE = gql` replyRequestCount replyCount createdAt + status references { type } @@ -353,6 +354,8 @@ function ArticlePage() { {ellipsis(article.text, { wordCount: 100 })} | {t`Cofacts`} + {/* Don't let search engines index blocked spam */ article.status === + 'BLOCKED' && }
@@ -372,55 +375,62 @@ function ArticlePage() { - {(() => { - switch (articleType) { - case 'IMAGE': - return !originalAttachmentUrl ? ( - image - ) : ( - - image - - ); - case 'VIDEO': - return !originalAttachmentUrl ? ( - t`Log in to view video content` - ) : ( -