chore: Correct linting errors in sitemap
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
/** @type {import('next-sitemap').IConfig} */
|
/** @type {import('next-sitemap').IConfig} */
|
||||||
|
|
||||||
const fs = require('fs');
|
import fs from 'fs';
|
||||||
const path = require('path');
|
import path from 'path';
|
||||||
|
import {fileURLToPath} from 'url';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively find all MDX files in a directory
|
* Recursively find all MDX files in a directory
|
||||||
@@ -28,7 +32,7 @@ function findMdxFiles(dir, fileList = []) {
|
|||||||
* Example: content/docs/getting-started/introduction.mdx -> /getting-started/introduction
|
* Example: content/docs/getting-started/introduction.mdx -> /getting-started/introduction
|
||||||
*/
|
*/
|
||||||
function filePathToUrl(filePath) {
|
function filePathToUrl(filePath) {
|
||||||
const contentDocsPath = path.join(process.cwd(), 'content', 'docs');
|
const contentDocsPath = path.join(__dirname, 'content', 'docs');
|
||||||
const relativePath = path.relative(contentDocsPath, filePath);
|
const relativePath = path.relative(contentDocsPath, filePath);
|
||||||
const withoutExt = relativePath.replace(/\.mdx$/, '');
|
const withoutExt = relativePath.replace(/\.mdx$/, '');
|
||||||
|
|
||||||
@@ -41,11 +45,11 @@ function filePathToUrl(filePath) {
|
|||||||
return '/' + withoutExt.split(path.sep).join('/');
|
return '/' + withoutExt.split(path.sep).join('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
const config = {
|
||||||
siteUrl: process.env.NEXT_PUBLIC_WIKI_URI || 'https://docs.useplunk.com',
|
siteUrl: process.env.NEXT_PUBLIC_WIKI_URI || 'https://docs.useplunk.com',
|
||||||
generateRobotsTxt: true,
|
generateRobotsTxt: true,
|
||||||
additionalPaths: async (config) => {
|
additionalPaths: async () => {
|
||||||
const contentDocsPath = path.join(process.cwd(), 'content', 'docs');
|
const contentDocsPath = path.join(__dirname, 'content', 'docs');
|
||||||
|
|
||||||
// Find all MDX files
|
// Find all MDX files
|
||||||
const mdxFiles = findMdxFiles(contentDocsPath);
|
const mdxFiles = findMdxFiles(contentDocsPath);
|
||||||
@@ -59,3 +63,5 @@ module.exports = {
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "node scripts/generate-openapi.js && npx tsx scripts/generate-docs.mts && fumadocs-mdx",
|
"prebuild": "node scripts/generate-openapi.js && npx tsx scripts/generate-docs.mts && fumadocs-mdx",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"sitemap": "next-sitemap --config next-sitemap.config.cjs",
|
"sitemap": "next-sitemap --config next-sitemap.config.mjs",
|
||||||
"predev": "node scripts/generate-openapi.js && npx tsx scripts/generate-docs.mts && fumadocs-mdx",
|
"predev": "node scripts/generate-openapi.js && npx tsx scripts/generate-docs.mts && fumadocs-mdx",
|
||||||
"dev": "next dev --turbo --port 1000",
|
"dev": "next dev --turbo --port 1000",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
|
|||||||
Reference in New Issue
Block a user