Skip to content

Commit

Permalink
Add new ulrs to json objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbrunvoll committed Mar 20, 2024
1 parent b0c1e8f commit ed4b236
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
19 changes: 8 additions & 11 deletions next-sitemap.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
/** @type {import('next-sitemap').IConfig} */

function getHomepageUrl() {
function getSiteUrl() {
const orgId = process.env.NEXT_PUBLIC_PLANNER_ORG_ID;
const org = require(`./orgs/${orgId}.json`);
return org.urls.homePageUrl.href;
return org.urls.travelPlannerUrl.href;
}

function getSiteUrl(url) {
return url.includes('www')
? url.replace('www', 'reise')
: url.replace('//', '//reise.');
}

const homePageUrl = getHomepageUrl();
const siteUrl = getSiteUrl(homePageUrl);
const prod = process.env.NODE_ENV === 'production';
const siteUrl = getSiteUrl();

/*
* Todo: Find a way to set the correct url when in preview and in staging.
*/
module.exports = {
siteUrl: siteUrl,
siteUrl: prod ? siteUrl : 'http://localhost:3000',
generateIndexSitemap: false,
sitemapSize: 7000,
generateRobotsTxt: true,
Expand Down
3 changes: 3 additions & 0 deletions orgs/atb.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"en-US": "https://www.atb.no/en/fares/",
"no": "https://www.atb.no/priser/",
"default": "https://www.atb.no/priser/"
},
"travelPlannerUrl": {
"href": "https://reise.atb.no/"
}
},
"journeyApiConfigurations": {
Expand Down
3 changes: 3 additions & 0 deletions orgs/fram.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"en-US": "https://frammr.no/billettar/billettar-og-prisar/?sprak=3",
"nn": "https://frammr.no/billettar/billettar-og-prisar/?sprak=11",
"default": "https://frammr.no/billettar/billettar-og-prisar/"
},
"travelPlannerUrl": {
"href": "https://reise.frammr.no/"
}
},
"journeyApiConfigurations": {
Expand Down
3 changes: 3 additions & 0 deletions orgs/nfk.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"en-US": "https://www.reisnordland.com/prices-bus",
"no": "https://www.reisnordland.no/priser-pa-buss",
"default": "https://www.reisnordland.no/priser-pa-buss"
},
"travelPlannerUrl": {
"href": "https://reise.reisnordland.no/"
}
},
"journeyApiConfigurations": {
Expand Down
5 changes: 5 additions & 0 deletions orgs/schema-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@
},
"ticketsUrl": {
"$ref": "#/definitions/TranslatableUrl"
},
"travelPlannerUrl": {
"name": {
"type": "string"
}
}
},
"required": [
Expand Down
3 changes: 3 additions & 0 deletions orgs/troms.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"en-US": "https://fylkestrafikk.no/meny/billetter-og-priser/?sprak=3",
"no": "https://fylkestrafikk.no/meny/billetter-og-priser",
"default": "https://fylkestrafikk.no/meny/billetter-og-priser"
},
"travelPlannerUrl": {
"href": "https://reise.fylkestrafikk.no/"
}
},
"journeyApiConfigurations": {
Expand Down

0 comments on commit ed4b236

Please sign in to comment.