Skip to content

Commit

Permalink
Add pathprefix to homepage campaign timeline links (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
LanesGood authored Jul 24, 2024
1 parent 4f198aa commit 7d56130
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require("dotenv").config({
})

module.exports = {
pathPrefix: `/casei`,
pathPrefix: process.env.NODE_ENV === "development" ? "" : `/casei`,
siteMetadata: {
title: `Catalog of Archived Suborbital Earth Science Investigations`,
shortname: `NASA | CASEI`,
Expand Down
7 changes: 5 additions & 2 deletions src/components/home/campaigns-timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import "./timeline-styles.css"
export const CampaignsTimeline = ({}) => {
const data = useStaticQuery(graphql`
query {
site {
pathPrefix
}
allCampaign {
nodes {
logo {
Expand All @@ -33,7 +36,7 @@ export const CampaignsTimeline = ({}) => {
? campaign.logo?.gatsbyImg.childImageSharp.gatsbyImageData.images
.fallback.src
: "",
link: `/campaign/${campaign.shortname}`,
link: `${data.site.pathPrefix}/campaign/${campaign.shortname}`,
thumbnail: campaign.logo
? campaign.logo?.gatsbyImg.childImageSharp.gatsbyImageData.images
.fallback.src
Expand Down Expand Up @@ -65,7 +68,7 @@ export const CampaignsTimeline = ({}) => {
(campaign.description.length > 650 ? "..." : "")
}
</p>` +
`<a class="tl-button button-clickable" href="/campaign/${campaign.shortname}" target="_self">View campaign</a>`,
`<a class="tl-button button-clickable" href="${data.site.pathPrefix}/campaign/${campaign.shortname}" target="_self">View campaign</a>`,
},
})),
}
Expand Down

0 comments on commit 7d56130

Please sign in to comment.