# Update: Adding Dynamic Sitemap to ShipFa.st

- Link: https://saguiitay.com/update-adding-dynamic-sitemap-to-shipfa-st/
- Published: 2025-01-22T12:29:31+02:00
- Author: Itay

I’ve recently posted about adding a [dynamic sitemap to a ShipFa.st website](https://saguiitay.com/adding-dynamic-sitemap-to-shipfa-st/).
The main idea was to add support for including the blog posts by exposing a GET 
endpoint at `app/server-sitemap.xml/route.ts` and include the returned page in the
main `sitemap.xml` file.

While I still think this is a viable and good solution for full dynamic sitemaps,
it’s a bit of an overkill for the blog posts. [It was pointed out to me](https://github.com/Marc-Lou-Org/ship-fast-ts/issues/33#issuecomment-2432015838)
that there’s a much simpler solution: You can use [NextJS’s generateStaticParams method](https://nextjs.org/docs/app/api-reference/functions/generate-static-params)
to statically generate the blog post pages. This will result in 2 side effects:

 1. Blog Post pages will be statically generated, which will result in faster loading
    of the pages, since they were generated at build time, instead of runtime.
 2. Blog Post pages will be included automatically in the generated `sitemap.xml`

Here’s how you can do that – in the `app/blog/[articleId]/page.tsx` page add the
following snippet:

    ```notranslate
    export function generateStaticParams() {
      return articles.map((article) => ({
        articleId: article.slug
      }))
    }
    ```

This tells NextJS to generate a static page for each article.

That’s it – simple an clean.

Obviously, you can do the same for the categories page at `app/blog/category/[categoryId]/
page.tsx`:

    ```notranslate
    export function generateStaticParams() {
      return categories.map((category) => ({
        categoryId: category.slug
      }))
    }
    ```

And the authors page, at `app/blog/author/[authorId]/page.tsx`:

    ```notranslate
    export function generateStaticParams() {
      return authors.map((author) => ({
        authorId: author.slug
      }))
    }
    ```

I’ve submitted a PR to Marc – let’s hope he approves it: [https://github.com/Marc-Lou-Org/ship-fast-ts/pull/71](https://github.com/Marc-Lou-Org/ship-fast-ts/pull/71)

### _Related_
