Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Statically Exported Websites without next export #637

Closed
ovflowd opened this issue May 18, 2023 · 2 comments
Closed

Support Statically Exported Websites without next export #637

ovflowd opened this issue May 18, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@ovflowd
Copy link

ovflowd commented May 18, 2023

Next.js is deprecating the next export command in favour of next build with output: 'export' (https://nextjs.org/docs/pages/building-your-application/deploying/static-exports). This means that a postbuild script, such as next-sitemap will not work anymore.

With the new way of exporting, a Next.js Static Application will move the exported files directly to the output directory after the build. No .next folder is created + files are transferred to the final guide beforehand.

There should be a way that either next-sitemap can be invoked either as a prebuild step or within Next.js itself during the build process.

Using the serverSide generation of sitemap via getServerSideProps doesn't really work, since static websites do not contain SSR.

@ovflowd ovflowd added the enhancement New feature or request label May 18, 2023
@iamvishnusankar
Copy link
Owner

@ovflowd Thanks for reporting this. Added support via #638

Demo: Static export

Example config:

/* eslint-disable @typescript-eslint/no-var-requires */
/** @type {import('next-sitemap').IConfig} */
const config = {
  siteUrl: process.env.SITE_URL || 'https://example.com',
  generateRobotsTxt: true,
  output: 'static', // Set static output here
}

module.exports = config

@ovflowd
Copy link
Author

ovflowd commented May 18, 2023

Nice! Waiting excitedly for this to get merged 😄

Thank you for being so quick on implementing this!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants