File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,19 @@ export const getServerSideProps = async ({ res }: any) => {
1010 const baseDirPath = process . cwd ( ) ;
1111
1212 const tree = directoryTree ( baseDirPath + "/" + docsConfig . docsEntryPoint ) ;
13- const filePaths = getFilePaths ( tree ) ;
13+ const allFilePaths = getFilePaths ( tree ) ;
14+ const versions = Object . keys ( docsConfig . versionMap ) ;
15+ // To remove canonical urls, removing the urls with the version number
16+ const filePaths = allFilePaths ?. filter ( ( filePath ) => {
17+ let flag = true ;
18+ [ ...versions , "next" ] . map ( ( version ) => {
19+ if ( filePath . includes ( version ) ) {
20+ flag = false ;
21+ }
22+ } ) ;
23+ return flag ;
24+ } ) ;
25+ // console.log({ ...filePaths });
1426 const sitemap = `<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
1527 ${
1628 filePaths &&
You can’t perform that action at this time.
0 commit comments