Skip to content

Commit

Permalink
fix: add bytebase.com to the sitemap (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
gustaveWPM authored Sep 29, 2023
1 parent 4baf08d commit ab01ab9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
const DEFAULT_LANGUAGE = 'en';

/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: process.env.NEXT_PUBLIC_DEFAULT_SITE_URL || 'https://www.bytebase.com',
generateRobotsTxt: true,
// Custom the i18n path. Remove the prefix `en` for matched path.
// Reference: https://next-sitemap.iamvishnusankar.com/docs/documentation/custom-transformation
transform: async (config, path) => {
if (path.startsWith('/en')) {
path = path.substring(3);

transform: (config, path) => {
const defaultLanguageNeedle = '/' + DEFAULT_LANGUAGE;
const defaultLanguageEnvelopeNeedle = defaultLanguageNeedle + '/';
const defaultLanguageNeedleLen = defaultLanguageNeedle.length;
if (path.startsWith(defaultLanguageEnvelopeNeedle)) {
path = path.substring(defaultLanguageNeedleLen);
} else if (path === defaultLanguageNeedle) {
path = '/';
}

return {
Expand Down

1 comment on commit ab01ab9

@vercel
Copy link

@vercel vercel bot commented on ab01ab9 Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.