Skip to content

Commit

Permalink
fix: change sitemap output folder
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Oct 17, 2020
1 parent 4ba21a1 commit c81f58f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion integrations/gatsby-theme-stories/src/gatsby-node.ts
Expand Up @@ -108,7 +108,11 @@ export const createPagesStatefully = async (
const staticFolder =
config.staticFolder ||
sysPath.join(process.cwd(), 'public', 'static');
const sitemapname = sysPath.resolve(staticFolder, 'sitemap.xml');
const sitemapfolder = sysPath.resolve(staticFolder as string, '..');
if (!fs.existsSync(sitemapfolder)) {
fs.mkdirSync(sitemapfolder, { recursive: true });
}
const sitemapname = sysPath.resolve(sitemapfolder, 'sitemap.xml');
log('creating sitemap', sitemapname);
fs.writeFileSync(sitemapname, sitemap, 'utf8');
}
Expand Down
8 changes: 6 additions & 2 deletions integrations/nextjs-plugin/src/build.ts
Expand Up @@ -48,10 +48,14 @@ module.exports = ({
const store: Store = loadStore(loadingStore, true);
if (process.env.NODE_ENV === 'production' && store.config.siteMap) {
const sitemap = getSiteMap(store);
const sitemapname = path.resolve(
const sitemapfolder = path.resolve(
config.staticFolder as string,
'sitemap.xml',
'..',
);
if (!fs.existsSync(sitemapfolder)) {
fs.mkdirSync(sitemapfolder, { recursive: true });
}
const sitemapname = path.join(sitemapfolder, 'sitemap.xml');
log('creating sitemap', sitemapname);
fs.writeFileSync(sitemapname, sitemap, 'utf8');
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/src/SEO/SEO.tsx
Expand Up @@ -50,7 +50,7 @@ export const SEO = ({
<meta name="description" content={seo.description} />
{seo.image && <meta name="image" content={seo.image} />}
{siteMap && (
<link rel="sitemap" type="application/xml" href="/static/sitemap.xml" />
<link rel="sitemap" type="application/xml" href="/sitemap.xml" />
)}
<meta property="og:title" content={seo.title} />
<meta property="og:url" content={seo.url} />
Expand Down

0 comments on commit c81f58f

Please sign in to comment.