Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions apps/site/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { availableLocaleCodes, defaultLocale } from '@node-core/website-i18n';

import { BASE_PATH } from '#site/next.constants.mjs';
import { BASE_URL } from '#site/next.constants.mjs';
import { EXTERNAL_LINKS_SITEMAP } from '#site/next.constants.mjs';
import {
BASE_PATH,
BASE_URL,
EXTERNAL_LINKS_SITEMAP,
} from '#site/next.constants.mjs';
import { BLOG_DYNAMIC_ROUTES } from '#site/next.dynamic.constants.mjs';
import { dynamicRouter } from '#site/next.dynamic.mjs';

Expand All @@ -16,8 +18,11 @@ const nonDefaultLocales = availableLocaleCodes.filter(
l => l !== defaultLocale.code
);

const getAlternatePath = (r: string, locales: Array<string>) =>
Object.fromEntries(locales.map(l => [l, `${baseUrlAndPath}/${l}/${r}`]));
const getFullPath = (r: string, l: string) =>
/^https?:\/\//.test(r) ? r : `${baseUrlAndPath}/${l}/${r}`;

const getAlternatePaths = (r: string, locales: Array<string>) =>
Object.fromEntries(locales.map(l => [l, getFullPath(r, l)]));

// This allows us to generate a `sitemap.xml` file dynamically based on the needs of the Node.js Website
const sitemap = async (): Promise<MetadataRoute.Sitemap> => {
Expand All @@ -27,10 +32,10 @@ const sitemap = async (): Promise<MetadataRoute.Sitemap> => {
const currentDate = new Date().toISOString();

const getSitemapEntry = (r: string, locales: Array<string> = []) => ({
url: `${baseUrlAndPath}/${defaultLocale.code}/${r}`,
url: getFullPath(r, defaultLocale.code),
lastModified: currentDate,
changeFrequency: 'always' as const,
alternates: { languages: getAlternatePath(r, locales) },
alternates: { languages: getAlternatePaths(r, locales) },
});

const staticPaths = routes.map(r => getSitemapEntry(r, nonDefaultLocales));
Expand Down
1 change: 1 addition & 0 deletions apps/site/components/withLegal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const RICH_TRANSLATION_KEYS = [
'foundationName',
'trademarkPolicy',
'trademarkList',
'aiCodingAssistantsPolicy',
'termsOfUse',
'privacyPolicy',
'bylaws',
Expand Down
34 changes: 19 additions & 15 deletions apps/site/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,40 @@
"text": "components.containers.footer.links.foundationName"
},
{
"link": "https://terms-of-use.openjsf.org/",
"text": "components.containers.footer.links.termsOfUse"
},
{
"link": "https://privacy-policy.openjsf.org/",
"text": "components.containers.footer.links.privacyPolicy"
"link": "https://ai-coding-assistants-policy.openjsf.org/",
"text": "components.containers.footer.links.aiCodingAssistantsPolicy"
},
{
"link": "https://bylaws.openjsf.org/",
"text": "components.containers.footer.links.bylaws"
},
{
"link": "https://github.com/openjs-foundation/cross-project-council/blob/main/CODE_OF_CONDUCT.md",
"link": "https://code-of-conduct.openjsf.org/",
"text": "components.containers.footer.links.codeOfConduct"
},
{
"link": "https://trademark-policy.openjsf.org/",
"text": "components.containers.footer.links.trademarkPolicy"
},
{
"link": "https://trademark-list.openjsf.org/",
"text": "components.containers.footer.links.trademarkList"
},
{
"link": "https://www.linuxfoundation.org/cookies/",
"text": "components.containers.footer.links.cookiePolicy"
},
{
"link": "https://privacy-policy.openjsf.org/",
"text": "components.containers.footer.links.privacyPolicy"
},
{
"link": "https://github.com/nodejs/node/security/policy",
"text": "components.containers.footer.links.security"
},
{
"link": "https://terms-of-use.openjsf.org/",
"text": "components.containers.footer.links.termsOfUse"
},
{
"link": "https://trademark-list.openjsf.org/",
"text": "components.containers.footer.links.trademarkList"
},
{
"link": "https://trademark-policy.openjsf.org/",
"text": "components.containers.footer.links.trademarkPolicy"
}
],
"socialLinks": [
Expand Down
1 change: 1 addition & 0 deletions apps/site/next.constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const THEME_STORAGE_KEY = 'theme';
* @see https://github.com/nodejs/nodejs.org/issues/5813 for more context
*/
export const EXTERNAL_LINKS_SITEMAP = [
'https://ai-coding-assistants-policy.openjsf.org/',
'https://terms-of-use.openjsf.org/',
'https://privacy-policy.openjsf.org/',
'https://bylaws.openjsf.org/',
Expand Down
1 change: 1 addition & 0 deletions packages/i18n/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"legal": "Copyright <foundationName>OpenJS Foundation</foundationName> and Node.js contributors. All rights reserved. The <foundationName>OpenJS Foundation</foundationName> has registered trademarks and uses trademarks. For a list of trademarks of the <foundationName>OpenJS Foundation</foundationName>, please see our <trademarkPolicy>Trademark Policy</trademarkPolicy> and <trademarkList>Trademark List</trademarkList>. Trademarks and logos not indicated on the <trademarkList>list of OpenJS Foundation trademarks</trademarkList> are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.",
"links": {
"foundationName": "OpenJS Foundation",
"aiCodingAssistantsPolicy": "AI Coding Assistants Policy",
"termsOfUse": "Terms of Use",
"privacyPolicy": "Privacy Policy",
"bylaws": "Bylaws",
Expand Down
Loading