Skip to content

Commit f745568

Browse files
authored
fix: don't fail in publish directory is root (#72)
1 parent 19902b7 commit f745568

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

make_sitemap.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const { createSitemap } = require('sitemap')
99
const ensureTrailingSlash = (url) => (url.endsWith('/') ? url : `${url}/`)
1010

1111
const getPaths = async ({ distPath, exclude = [], cwd = '.' }) => {
12-
const htmlFiles = `${getRelPath(distPath, cwd)}/**/**.html`
12+
const relPath = getRelPath(distPath, cwd)
13+
const htmlFiles = relPath === '' ? '**/**.html' : `${relPath}/**/**.html`
1314
const excludeFiles = exclude.map((excludedPath) => `!${getRelPath(excludedPath, cwd).replace(/^!/, '')}`)
1415

1516
const lookup = [htmlFiles, ...excludeFiles]

0 commit comments

Comments
 (0)