From b7e72d8094a47a3bf0162e96818b3cac242196ed Mon Sep 17 00:00:00 2001 From: KishiTheMechanic Date: Mon, 28 Oct 2024 00:41:37 +0100 Subject: [PATCH] fix output pahts --- deno.json | 2 +- mod.ts | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/deno.json b/deno.json index 93e9875..1b7739d 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@elsoul/fresh-sitemap", - "version": "0.4.0", + "version": "0.5.0", "description": "Lightweight global state management library for Fresh framework using Preact signals.", "runtimes": ["deno", "browser"], "exports": "./mod.ts", diff --git a/mod.ts b/mod.ts index 2223692..72f2795 100644 --- a/mod.ts +++ b/mod.ts @@ -113,14 +113,12 @@ async function generateSitemap( : path.substring(distDirectory.length) let pathname = normalize(`/${relPath}`).split(SEPARATOR).join('/') - // Exclude files and directories with '_' prefix, grouping directories, and index files + // Exclude grouping and dynamic directories, _-prefixed files, and index files if ( pathname.includes('(') || pathname.includes('[') || - pathname.includes('_') || pathname.endsWith('index') + pathname.includes('_') ) continue - - // Remove .tsx extension - pathname = pathname.replace(/\.tsx$/, '') + pathname = pathname.replace(/\.tsx$/, '').replace(/\/index$/, '') const isExcluded = exclude && exclude.test(pathname.substring(1)) const isIncluded = !include || include.test(pathname.substring(1)) @@ -132,7 +130,6 @@ async function generateSitemap( lastmod: (mtime ?? new Date()).toISOString(), }) - // Add paths for each specified language options.languages?.forEach((lang) => { if (lang !== options.defaultLanguage) { sitemap.push({