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

How to add a large volume of additionalPaths from API #806

Open
bnbon opened this issue Apr 29, 2024 · 0 comments
Open

How to add a large volume of additionalPaths from API #806

bnbon opened this issue Apr 29, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@bnbon
Copy link

bnbon commented Apr 29, 2024

Hi,

Generating my whole site statically results in an artefact too large for AWS, is there a way of making a call to add pages to the sitemap without them having to be generated by next too? I want to leave those dynamic, but build out all the links for the sitemap...

Something like this?

  additionalPaths: async (config) => {
    try {
      const response = await fetch('https://your-api-url.com/people');
      const people = await response.json();
      
      return people.map(person => ({
        loc: `https://site.com/people/${person.id}`,
        changefreq: 'daily',
        priority: 0.7,
        lastmod: new Date().toISOString(),
      }));
    } catch (error) {
      return []; // Return an empty array on error
    }
  }
@bnbon bnbon added the enhancement New feature or request label Apr 29, 2024
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