Skip to content

Commit

Permalink
fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
KishiTheMechanic committed Oct 28, 2024
1 parent dc1ff38 commit 412b3ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@elsoul/fresh-sitemap",
"version": "0.7.5",
"version": "0.7.6",
"description": "Lightweight global state management library for Fresh framework using Preact signals.",
"runtimes": ["deno", "browser"],
"exports": "./mod.ts",
Expand Down
12 changes: 7 additions & 5 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function saveSitemapAndRobots(

/**
* Generates sitemap entries for static routes, excluding dynamic and grouping directories.
* Ensures `_` and `()` directories and `index.tsx` files are excluded.
* Ensures `_` and `()` directories and `index.tsx` files are correctly processed.
* @param basename - The base URL
* @param distDirectory - Directory containing routes
* @param options - Options for sitemap generation
Expand Down Expand Up @@ -143,12 +143,14 @@ async function generateSitemap(
}
}

// Remove `index` as the last segment
// Remove `index` as a segment, but keep the path
for (const path in pathMap) {
if (pathMap[path] === 1 && path.endsWith('/index')) {
if (pathMap[path] === 1) {
const cleanedPath = path.replace(/\/index$/, '')
pathMap[cleanedPath] = 1
delete pathMap[path]
if (cleanedPath !== path) {
pathMap[cleanedPath] = 1
delete pathMap[path]
}
}
}

Expand Down

0 comments on commit 412b3ad

Please sign in to comment.