Skip to content

Commit

Permalink
Fix sitemap for connected GTAs >= 2.104
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrucs committed Jun 10, 2024
1 parent 988e9a0 commit 1e61046
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frontend/src/pages/sitemap.xml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const getOutdoorCourseForLanguage = async (

const getFlatPagesForLanguage = async (
language: string,
): Promise<{ id: string; title: string; external_url: string }[]> => {
): Promise<{ id: string; title: string; external_url?: string }[]> => {
const flatPages = await fetch(
`${
getGlobalConfig().apiUrl
Expand Down Expand Up @@ -115,14 +115,14 @@ const getApiContentForLanguage = async (language: string): Promise<string> => {

const flatPages = await getFlatPagesForLanguage(language);
const flatPageUrls = flatPages
.map(({ id, title, external_url }) =>
.map(({ id, title, external_url = null }) =>
external_url !== null && external_url.length > 0
? `<url><loc>${external_url}</loc></url>`
: title && id
? `<url><loc>${baseUrl}/information/${id}-${encodeURI(
convertStringForSitemap(title),
)}</loc></url>`
: '',
? `<url><loc>${baseUrl}/information/${id}-${encodeURI(
convertStringForSitemap(title),
)}</loc></url>`
: '',
)
.join('');
return [
Expand Down

0 comments on commit 1e61046

Please sign in to comment.