Skip to content

Commit

Permalink
Merge pull request #2425 from lpsinger/external-noopener-blank
Browse files Browse the repository at this point in the history
Open all external links in a separate window
  • Loading branch information
dakota002 authored Jul 1, 2024
2 parents 82dccc2 + d509c96 commit bb79dac
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 31 deletions.
2 changes: 1 addition & 1 deletion __tests__/components/AnnounceBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('AnnounceBanner component', () => {
'href',
'https://nasa-gcn.github.io/gcn-presentation/'
)
expect(link).toHaveAttribute('rel', 'external')
expect(link).toHaveAttribute('rel', 'external noopener')
})
})

Expand Down
21 changes: 14 additions & 7 deletions app/components/ClientSampleCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export function ClientSampleCode({
Open a terminal and run this command to install with{' '}
<Link
className="usa-link"
rel="external"
rel="external noopener"
target="_blank"
href="https://pip.pypa.io/"
>
pip
Expand All @@ -51,7 +52,8 @@ export function ClientSampleCode({
or this command to install with with{' '}
<Link
className="usa-link"
rel="external"
rel="external noopener"
target="_blank"
href="https://docs.conda.io/"
>
conda
Expand Down Expand Up @@ -118,7 +120,8 @@ export function ClientSampleCode({
Open a terminal and run this command to install with{' '}
<Link
className="usa-link"
rel="external"
rel="external noopener"
target="_blank"
href="https://www.npmjs.com"
>
npm
Expand Down Expand Up @@ -201,7 +204,8 @@ export function ClientSampleCode({
Open a terminal and run this command to install with{' '}
<Link
className="usa-link"
rel="external"
rel="external noopener"
target="_blank"
href="https://www.npmjs.com"
>
npm
Expand Down Expand Up @@ -286,7 +290,8 @@ export function ClientSampleCode({
First,{' '}
<Link
className="usa-link"
rel="external"
rel="external noopener"
target="_blank"
href="https://github.com/edenhill/librdkafka#installation"
>
install librdkafka
Expand Down Expand Up @@ -540,14 +545,16 @@ export function ClientSampleCode({
The following instructions are for the official Kafka command line
tools which use Java and come with either{' '}
<a
rel="external"
rel="external noopener"
target="_blank"
href="https://kafka.apache.org/documentation/#quickstart"
>
Apache Kafka
</a>{' '}
version 3.4.0 or newer or{' '}
<a
rel="external"
rel="external noopener"
target="_blank"
href="https://docs.confluent.io/kafka/operations-tools/kafka-tools.html"
>
Confluent
Expand Down
12 changes: 9 additions & 3 deletions app/components/NoticeFormat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export function NoticeFormatInput({
<>
VOEvent XML. See{' '}
<a
rel="external"
rel="external noopener"
target="_blank"
href="http://ivoa.net/Documents/latest/VOEvent.html"
>
documentation
Expand All @@ -64,7 +65,8 @@ export function NoticeFormatInput({
<>
160-byte binary format. Field packing is{' '}
<a
rel="external"
rel="external noopener"
target="_blank"
href="https://gcn.gsfc.nasa.gov/sock_pkt_def_doc.html"
>
specific to each notice type.
Expand All @@ -80,7 +82,11 @@ export function NoticeFormatInput({
description: (
<>
New notice types in JSON format defined using{' '}
<a href="https://json-schema.org" rel="external">
<a
href="https://json-schema.org"
rel="external noopener"
target="_blank"
>
JSON schema
</a>
</>
Expand Down
5 changes: 3 additions & 2 deletions app/root/AnnounceBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export default function AnnounceBanner({
<p>
If you cannot attend live, then you can get the{' '}
<Link
rel="external"
rel="external noopener"
target="_blank"
href="https://nasa-gcn.github.io/gcn-presentation/"
>
presentation
Expand All @@ -77,7 +78,7 @@ export function AnnouncementEvent(props: {
<Grid mobileLg={{ col: 4 }}>
{props.time}
<div>(best for {props.region}):</div>
<Link rel="external" href={props.link}>
<Link rel="external noopener" target="_blank" href={props.link}>
{props.linkstring}
</Link>
</Grid>
Expand Down
56 changes: 44 additions & 12 deletions app/root/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,66 +95,98 @@ export function Footer() {
</IdentifierLogos>
<IdentifierIdentity domain="gcn.nasa.gov">
A service of the{' '}
<a rel="external" href="https://science.gsfc.nasa.gov/astrophysics/">
<a
rel="external noopener"
target="_blank"
href="https://science.gsfc.nasa.gov/astrophysics/"
>
Astrophysics Science Division
</a>{' '}
at{' '}
<a rel="external" href="https://www.nasa.gov/">
<a
rel="external noopener"
target="_blank"
href="https://www.nasa.gov/"
>
NASA
</a>{' '}
<a rel="external" href="https://www.nasa.gov/goddard/">
<a
rel="external noopener"
target="_blank"
href="https://www.nasa.gov/goddard/"
>
Goddard Space Flight Center
</a>
</IdentifierIdentity>
</IdentifierMasthead>
<IdentifierLinks navProps={{ 'aria-label': 'Important links' }}>
<IdentifierLinkItem>
<IdentifierLink rel="external" href="https://www.nasa.gov/about/">
<IdentifierLink
rel="external noopener"
target="_blank"
href="https://www.nasa.gov/about/"
>
About NASA
</IdentifierLink>
</IdentifierLinkItem>
<IdentifierLinkItem>
<IdentifierLink
rel="external"
rel="external noopener"
target="_blank"
href="https://www.nasa.gov/general/accessibility/"
>
Accessibility
</IdentifierLink>
</IdentifierLinkItem>
<IdentifierLinkItem>
<IdentifierLink
rel="external"
rel="external noopener"
target="_blank"
href="https://www.nasa.gov/budgets-plans-and-reports/"
>
Budget and Performance
</IdentifierLink>
</IdentifierLinkItem>
<IdentifierLinkItem>
<IdentifierLink
rel="external"
rel="external noopener"
target="_blank"
href="https://www.nasa.gov/odeo/no-fear-act/"
>
No FEAR Act
</IdentifierLink>
</IdentifierLinkItem>
<IdentifierLinkItem>
<IdentifierLink rel="external" href="https://www.nasa.gov/FOIA/">
<IdentifierLink
rel="external noopener"
target="_blank"
href="https://www.nasa.gov/FOIA/"
>
FOIA Requests
</IdentifierLink>
</IdentifierLinkItem>
<IdentifierLinkItem>
<IdentifierLink rel="external" href="https://oig.nasa.gov/">
<IdentifierLink
rel="external noopener"
target="_blank"
href="https://oig.nasa.gov/"
>
Office of the Inspector General
</IdentifierLink>
</IdentifierLinkItem>
<IdentifierLinkItem>
<IdentifierLink rel="external" href="https://www.nasa.gov/privacy/">
<IdentifierLink
rel="external noopener"
target="_blank"
href="https://www.nasa.gov/privacy/"
>
Privacy Policy
</IdentifierLink>
</IdentifierLinkItem>
<IdentifierLinkItem>
<IdentifierLink
rel="external"
rel="external noopener"
target="_blank"
href="https://www.nasa.gov/vulnerability-disclosure-policy/"
>
Vulnerability Disclosure Policy
Expand All @@ -163,7 +195,7 @@ export function Footer() {
</IdentifierLinks>
<IdentifierGov aria-label="U.S. government information and services">
Looking for U.S. government information and services?{' '}
<a rel="external" href="https://www.usa.gov">
<a rel="external noopener" target="_blank" href="https://www.usa.gov">
Visit USA.gov
</a>
</IdentifierGov>
Expand Down
12 changes: 8 additions & 4 deletions app/routes/docs_._schema-browser.schema.($version).$/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ function SchemaBody({
View the source on{' '}
<Link
className="usa-link"
rel="external"
rel="external noopener"
target="_blank"
to={`https://github.com/nasa-gcn/gcn-schema/blob/${selectedVersion}/${path}`}
>
GitHub
Expand Down Expand Up @@ -303,7 +304,8 @@ function SchemaBody({
individually valid, based on their respective properties. See{' '}
<Link
className="usa-link"
rel="external"
rel="external noopener"
target="_blank"
to="https://json-schema.org/understanding-json-schema/reference/combining.html#allof"
>
allOf
Expand All @@ -323,7 +325,8 @@ function SchemaBody({
individually valid based on their respective properties. See{' '}
<Link
className="usa-link"
rel="external"
rel="external noopener"
target="_blank"
to="https://json-schema.org/understanding-json-schema/reference/combining.html#anyof"
>
anyOf
Expand All @@ -343,7 +346,8 @@ function SchemaBody({
individually valid based on their respective properties. See{' '}
<Link
className="usa-link"
rel="external"
rel="external noopener"
target="_blank"
to="https://json-schema.org/understanding-json-schema/reference/combining.html#oneof"
>
oneOf
Expand Down
6 changes: 5 additions & 1 deletion app/routes/user.email._index/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ export default function () {
<p className="usa-paragraph">
Note that your preferenes here do not affect prior subscriptions on the
old web site,{' '}
<a rel="external" href="https://gcn.gsfc.nasa.gov/">
<a
rel="external noopener"
target="_blank"
href="https://gcn.gsfc.nasa.gov/"
>
https://gcn.gsfc.nasa.gov/
</a>
. To change your GCN Classic Notice subscriptions, please{' '}
Expand Down
6 changes: 5 additions & 1 deletion app/routes/user.endorsements/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ export default function () {
</p>
<p className="usa-paragraph">
Peer endorsements (inspired by{' '}
<a rel="external" href="https://info.arxiv.org/help/endorsement.html">
<a
rel="external noopener"
target="_blank"
href="https://info.arxiv.org/help/endorsement.html"
>
arXiv
</a>
) help us to grow the GCN community sustainably while protecting the
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@
"children": "never",
"propElementValues": "always"
}
],
"react/jsx-no-target-blank": [
"error",
{
"allowReferrer": true
}
]
},
"overrides": [
Expand Down

0 comments on commit bb79dac

Please sign in to comment.