Skip to content

Commit

Permalink
Merge pull request COVID19Tracking#1185 from COVID19Tracking/feature/…
Browse files Browse the repository at this point in the history
…redirect-content-audit

[⚠️WIP] Redirects & update page paths
  • Loading branch information
kevee authored Jul 6, 2020
2 parents 7c605e4 + 786fd6c commit 53a3cab
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 54 deletions.
13 changes: 13 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ exports.createPages = async ({ graphql, actions }) => {
}
}
}
allContentfulRedirect {
nodes {
from
redirectTo
}
}
}
`)

Expand Down Expand Up @@ -124,6 +130,13 @@ exports.createPages = async ({ graphql, actions }) => {
})
})

result.data.allContentfulRedirect.nodes.forEach(({ from, redirectTo }) => {
createRedirect({
fromPath: from,
toPath: redirectTo,
})
})

result.data.allContentfulChart.nodes.forEach(node => {
createPage({
path: `/data/charts/${node.slug}`,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Website build', () => {
})

it('has an API page', () => {
const exists = fs.pathExistsSync('./public/api/index.html')
const exists = fs.pathExistsSync('./public/data/api/index.html')
expect(exists).toBe(true)
})
})
4 changes: 2 additions & 2 deletions src/__tests__/components/layout/__snapshots__/footer.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ exports[`Components : Layout : Footer renders correctly 1`] = `
</li>
<li>
<a
href="/license"
href="/about-data/license"
>
License
</a>
Expand All @@ -56,7 +56,7 @@ exports[`Components : Layout : Footer renders correctly 1`] = `
</li>
<li>
<a
href="/accessibility"
href="/about/accessibility"
>
Accessibility
</a>
Expand Down
25 changes: 15 additions & 10 deletions src/__tests__/components/layout/__snapshots__/header.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ exports[`Components : Layout : Header renders correctly 1`] = `
</nav>
<a
className="getInvolved"
href="/about-project/help"
href="/contact/volunteer"
>
Get Involved
</a>
Expand Down Expand Up @@ -239,6 +239,7 @@ exports[`Components : Layout : Header renders correctly 1`] = `
<a
href="/race"
onClick={[Function]}
>
We just launched the COVID Racial Data Tracker
</a>
Expand Down Expand Up @@ -460,7 +461,7 @@ exports[`Components : Layout : Header renders correctly 1`] = `
</div>
<a
className="getInvolved"
href="/get-involved"
href="/contact/volunteer"
>
Get involved
</a>
Expand Down Expand Up @@ -712,7 +713,7 @@ exports[`Components : Layout : Header renders correctly 2`] = `
</nav>
<a
className="getInvolved"
href="/about-project/help"
href="/contact/volunteer"
>
Get Involved
</a>
Expand Down Expand Up @@ -744,6 +745,7 @@ exports[`Components : Layout : Header renders correctly 2`] = `
<a
href="/race"
onClick={[Function]}
>
We just launched the COVID Racial Data Tracker
</a>
Expand Down Expand Up @@ -965,7 +967,7 @@ exports[`Components : Layout : Header renders correctly 2`] = `
</div>
<a
className="getInvolved"
href="/get-involved"
href="/contact/volunteer"
>
Get involved
</a>
Expand Down Expand Up @@ -1217,7 +1219,7 @@ exports[`Components : Layout : Header renders correctly 3`] = `
</nav>
<a
className="getInvolved"
href="/about-project/help"
href="/contact/volunteer"
>
Get Involved
</a>
Expand Down Expand Up @@ -1249,6 +1251,7 @@ exports[`Components : Layout : Header renders correctly 3`] = `
<a
href="/race"
onClick={[Function]}
>
We just launched the COVID Racial Data Tracker
</a>
Expand Down Expand Up @@ -1470,7 +1473,7 @@ exports[`Components : Layout : Header renders correctly 3`] = `
</div>
<a
className="getInvolved"
href="/get-involved"
href="/contact/volunteer"
>
Get involved
</a>
Expand Down Expand Up @@ -1726,7 +1729,7 @@ exports[`Components : Layout : Header renders correctly 4`] = `
</nav>
<a
className="getInvolved"
href="/about-project/help"
href="/contact/volunteer"
>
Get Involved
</a>
Expand Down Expand Up @@ -1758,6 +1761,7 @@ exports[`Components : Layout : Header renders correctly 4`] = `
<a
href="/race"
onClick={[Function]}
>
We just launched the COVID Racial Data Tracker
</a>
Expand Down Expand Up @@ -1979,7 +1983,7 @@ exports[`Components : Layout : Header renders correctly 4`] = `
</div>
<a
className="getInvolved"
href="/get-involved"
href="/contact/volunteer"
>
Get involved
</a>
Expand Down Expand Up @@ -2231,7 +2235,7 @@ exports[`Components : Layout : Header renders correctly 5`] = `
</nav>
<a
className="getInvolved"
href="/about-project/help"
href="/contact/volunteer"
>
Get Involved
</a>
Expand Down Expand Up @@ -2263,6 +2267,7 @@ exports[`Components : Layout : Header renders correctly 5`] = `
<a
href="/race"
onClick={[Function]}
>
We just launched the COVID Racial Data Tracker
</a>
Expand Down Expand Up @@ -2484,7 +2489,7 @@ exports[`Components : Layout : Header renders correctly 5`] = `
</div>
<a
className="getInvolved"
href="/get-involved"
href="/contact/volunteer"
>
Get involved
</a>
Expand Down
18 changes: 10 additions & 8 deletions src/__tests__/components/layout/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Array [
</nav>
<a
className="getInvolved"
href="/about-project/help"
href="/contact/volunteer"
>
Get Involved
</a>
Expand Down Expand Up @@ -247,6 +247,7 @@ Array [
<a
href="/race"
onClick={[Function]}
>
We just launched the COVID Racial Data Tracker
</a>
Expand Down Expand Up @@ -468,7 +469,7 @@ Array [
</div>
<a
className="getInvolved"
href="/get-involved"
href="/contact/volunteer"
>
Get involved
</a>
Expand Down Expand Up @@ -571,7 +572,7 @@ Array [
</li>
<li>
<a
href="/license"
href="/about-data/license"
>
License
</a>
Expand All @@ -585,7 +586,7 @@ Array [
</li>
<li>
<a
href="/accessibility"
href="/about/accessibility"
>
Accessibility
</a>
Expand Down Expand Up @@ -874,7 +875,7 @@ Array [
</nav>
<a
className="getInvolved"
href="/about-project/help"
href="/contact/volunteer"
>
Get Involved
</a>
Expand Down Expand Up @@ -906,6 +907,7 @@ Array [
<a
href="/race"
onClick={[Function]}
>
We just launched the COVID Racial Data Tracker
</a>
Expand Down Expand Up @@ -1127,7 +1129,7 @@ Array [
</div>
<a
className="getInvolved"
href="/get-involved"
href="/contact/volunteer"
>
Get involved
</a>
Expand Down Expand Up @@ -1230,7 +1232,7 @@ Array [
</li>
<li>
<a
href="/license"
href="/about-data/license"
>
License
</a>
Expand All @@ -1244,7 +1246,7 @@ Array [
</li>
<li>
<a
href="/accessibility"
href="/about/accessibility"
>
Accessibility
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ exports[`Components : Pages : Homepage : Press renders correctly 1`] = `
</div>
<a
className="cta centered "
href="/about-project/in-the-press"
href="/about/press"
>
See what else our data powers
<span
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ const Footer = () => (
<Link to="/terms-and-conditions">Terms and Conditions</Link>
</li>
<li>
<Link to="/license">License</Link>
<Link to="/about-data/license">License</Link>
</li>
<li>
<a href="https://www.theatlantic.com/privacy-policy/">
Privacy Policy
</a>
</li>
<li>
<Link to="/accessibility">Accessibility</Link>
<Link to="/about/accessibility">Accessibility</Link>
</li>
<li>
<a href="/rss.xml">RSS</a>
Expand Down
5 changes: 4 additions & 1 deletion src/components/layout/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ const Header = withSearch(
<div className={headerStyle.searchContainer}>
<HeaderSearch />
</div>
<Link to="/get-involved" className={headerStyle.getInvolved}>
<Link
to="/contact/volunteer"
className={headerStyle.getInvolved}
>
Get involved
</Link>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/header/mobile-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default ({ expanded, topNavigation, subNavigation }) => {
subNavigation={subNavigation}
isMobile
/>
<Link to="/about-project/help" className={headerStyle.getInvolved}>
<Link to="/contact/volunteer" className={headerStyle.getInvolved}>
Get Involved
</Link>
<div className={headerStyle.mobilePointer} />
Expand Down
14 changes: 13 additions & 1 deletion src/components/layout/header/partnership-banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ import partnershipBanner from './partnership-banner.module.scss'
export default () => (
<div className={partnershipBanner.banner}>
<span className={partnershipBanner.new}>New</span>{' '}
<Link to="/race">We just launched the COVID Racial Data Tracker</Link>
<Link
to="/race"
onClick={() => {
if (
typeof window !== 'undefined' &&
typeof window.fathom !== 'undefined'
) {
window.fathom.trackGoal('3GO7TUHI', 0)
}
}}
>
We just launched the COVID Racial Data Tracker
</Link>
</div>
)
2 changes: 1 addition & 1 deletion src/components/pages/homepage/press.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default () => (
<PressLogos onlyFeatured />
</Col>
</Row>
<CtaLink to="/about-project/in-the-press" centered>
<CtaLink to="/about/press" centered>
See what else our data powers
</CtaLink>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/search/search-no-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const SearchNoResult = ({ query = false }) =>
methodology
</li>
<li>
<Link to="/api">Data API</Link> - Our data API for developers
<Link to="/data/api">Data API</Link> - Our data API for developers
</li>
</ul>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/data/navigation/header.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ items:
- title: Our Data
link: /data
subNavigation: data
- title: How to Use It
- title: About the Data
link: /about-data
subNavigation: about-data
- title: Why It Matters
link: /why-it-matters
subNavigation: why-it-matters
- title: Race and COVID-19
link: /race
subNavigation: race
- title: About Us
link: /about-project
subNavigation: about-project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import VolunteersList from '~components/common/volunteers-list'
export default ({ data }) => (
<Layout
title="About Us"
path="/about-project"
path="/about"
navigation={data.contentfulNavigationGroup.pages}
>
<LongContent>
Expand Down
Loading

0 comments on commit 53a3cab

Please sign in to comment.