iamvishnusankar/next-sitemap

Does this support /app directory in next13?

bnbon opened this issue · 5 comments

bnbon commented

Hi,

I have added this to nextjs 13, and I have migrated to use the /src/app approach which Next13 promotes as the best option. When I run the postbuild, it only generates the static pages; the /articles section isnt in the sitemap.

I am using this code, removed the cruft though for clarity.

export default async function ArticlesPage() {
  const stories = await getData();

  return (
    <>
      view
    </>
  );
}

const getData = async () => {
  const res = await fetch(``, { cache: 'no-store' });
  const data = await res.json();
  const { stories } = data;

  return stories;
}

Same issue

I am grouping the routes and its not even generating the static pages for me.

I am not getting the static pages either - any word on this?

You need to use generateStaticParams
See the official doc
After that everything should end up in your sitemap. I've been using it for a while and everything is smooth.

Closing this issue due to inactivity.