Skip to content

Commit 7fd95be

Browse files
authored
fix(exclude): revert absolute path value for buildDir (#31)
1 parent 1455917 commit 7fd95be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
const { join } = require('path')
2-
31
/* Generates a sitemap */
42
const makeSitemap = require('./make_sitemap')
53

64
module.exports = {
75
onPostBuild: async ({ constants, inputs, utils }) => {
86
const baseUrl = inputs.baseUrl || process.env.URL
97
// Backwards compat... Correct opt is buildDir
10-
const buildDir = join(process.cwd(), inputs.dir || inputs.distPath || inputs.buildDir || constants.PUBLISH_DIR)
8+
const buildDir = inputs.dir || inputs.distPath || inputs.buildDir || constants.PUBLISH_DIR
9+
// remove leading / to treat the dir a a relative one
10+
const trimmedBuildDir = buildDir.startsWith('/') ? buildDir.slice(1) : buildDir
1111

1212
console.log('Creating sitemap from files...')
1313

1414
const data = await makeSitemap({
1515
homepage: baseUrl,
16-
distPath: buildDir,
16+
distPath: trimmedBuildDir,
1717
exclude: inputs.exclude,
1818
prettyURLs: inputs.prettyURLs,
1919
changeFreq: inputs.changeFreq,

0 commit comments

Comments
 (0)