File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1- const { join } = require ( 'path' )
2-
31/* Generates a sitemap */
42const makeSitemap = require ( './make_sitemap' )
53
64module . 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 ,
You can’t perform that action at this time.
0 commit comments