From 7d56130929e53af6a62a371f127022e5b66f5346 Mon Sep 17 00:00:00 2001
From: Lane Goodman
Date: Wed, 24 Jul 2024 13:39:21 -0400
Subject: [PATCH] Add pathprefix to homepage campaign timeline links (#670)
---
gatsby-config.js | 2 +-
src/components/home/campaigns-timeline.js | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gatsby-config.js b/gatsby-config.js
index c20bc49c..10eddd11 100644
--- a/gatsby-config.js
+++ b/gatsby-config.js
@@ -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`,
diff --git a/src/components/home/campaigns-timeline.js b/src/components/home/campaigns-timeline.js
index 52199921..39290255 100644
--- a/src/components/home/campaigns-timeline.js
+++ b/src/components/home/campaigns-timeline.js
@@ -7,6 +7,9 @@ import "./timeline-styles.css"
export const CampaignsTimeline = ({}) => {
const data = useStaticQuery(graphql`
query {
+ site {
+ pathPrefix
+ }
allCampaign {
nodes {
logo {
@@ -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
@@ -65,7 +68,7 @@ export const CampaignsTimeline = ({}) => {
(campaign.description.length > 650 ? "..." : "")
}
` +
- `View campaign`,
+ `View campaign`,
},
})),
}