Skip to content

Commit

Permalink
fix: support HTML paths with . in them
Browse files Browse the repository at this point in the history
Fixes #117
  • Loading branch information
harlan-zw committed Aug 16, 2023
1 parent 1ccfa76 commit 1fafce6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function setupPrerenderHandler(moduleConfig: ModuleOptions, buildTimeMeta
return

const prerenderUrls = (nitro._prerenderedRoutes || [])
.filter(r => !r.route.includes('.') && !r.route.startsWith('/api/'))
.filter(r => r.fileName === '.html' && !r.route.startsWith('/api/'))
.map(r => ({ loc: r.route })) || []

if (buildTimeMeta.hasPrerenderedRoutesPayload) {
Expand Down
3 changes: 2 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { joinURL } from 'ufo'
import type { Nuxt } from '@nuxt/schema'
import { loadNuxtModuleInstance, normalizeSemanticVersion, useNuxt } from '@nuxt/kit'
import { satisfies } from 'semver'
import { extname } from 'pathe'
import type { SitemapEntryInput } from './runtime/types'

export interface NuxtPagesToSitemapEntriesOptions {
Expand Down Expand Up @@ -206,6 +207,6 @@ export function generateExtraRoutesFromNuxtConfig(nuxt: Nuxt = useNuxt()) {
.map(([k]) => k)
// don't support files
const prerenderUrls = (nuxt.options.nitro.prerender?.routes || [])
.filter(p => p && !p.includes('.') && !p.startsWith('/api/')) as string[]
.filter(p => p && !extname(p) && !p.startsWith('/api/')) as string[]
return { routeRules, prerenderUrls }
}

0 comments on commit 1fafce6

Please sign in to comment.