Skip to content

Commit

Permalink
Feat(sitemap): add external url (nodejs#5821)
Browse files Browse the repository at this point in the history
* Chore(next-const): add EXTERNAL_LINKS_SITMAP

* add more descripton

* Update sitemap.ts

* update from feedback

* Update sitemap.ts
  • Loading branch information
AugustinMauroy authored Sep 23, 2023
1 parent 3563ef8 commit 447c9f5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DYNAMIC_GENERATED_ROUTES,
BASE_PATH,
BASE_URL,
EXTERNAL_LINKS_SITEMAP,
} from '@/next.constants.mjs';
import type { MetadataRoute } from 'next';

Expand All @@ -27,9 +28,12 @@ const sitemap = (): MetadataRoute.Sitemap => {
// The current date of this request
const currentDate = new Date().toISOString();

// This maps the URL routes into Sitemap entries
return [...dynamicRoutes, ...staticPaths].sort().map(route => ({
url: `${baseUrlAndPath}/${route}`,
const appRoutes = [...dynamicRoutes, ...staticPaths]
.sort()
.map(route => `${baseUrlAndPath}/${route}`);

return [...appRoutes, ...EXTERNAL_LINKS_SITEMAP].map(route => ({
url: route,
lastModified: currentDate,
changeFrequency: 'always',
}));
Expand Down
14 changes: 14 additions & 0 deletions next.constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,17 @@ export const DYNAMIC_ROUTES_REWRITES = [
export const DYNAMIC_GENERATED_ROUTES = () => [
...blogData.pagination.map(year => `en/blog/year-${year}`),
];

/***
* This is a list of all external links that are used on website sitemap.
* @see https://github.com/nodejs/nodejs.org/issues/5813 for more context
*/
export const EXTERNAL_LINKS_SITEMAP = [
'https://terms-of-use.openjsf.org/',
'https://privacy-policy.openjsf.org/',
'https://bylaws.openjsf.org/',
'https://code-of-conduct.openjsf.org/',
'https://trademark-policy.openjsf.org/',
'https://trademark-list.openjsf.org/',
'https://www.linuxfoundation.org/cookies',
];

0 comments on commit 447c9f5

Please sign in to comment.