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

posts/generate-dynamic-sitemap-with-storyblok-and-next-js #2

Open
utterances-bot opened this issue Jan 6, 2021 · 2 comments
Open

Comments

@utterances-bot
Copy link

Generate Dynamic Sitemap with Storyblok and Next.js | Pedro Sousa

Programming, Tech and other random blurbs

https://blog.psousa.dev/posts/generate-dynamic-sitemap-with-storyblok-and-next-js

Copy link

Sweet post, Pedro! Thanks :)

Copy link

Thanks a lot for this post, was a great starting point!
I just added the last published date to the sitemap

const generateSitemap = (posts, url) => {
  return `<?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    ${posts
      .map(
        ({ slug, published_at }) => `
      <url>
        <loc>https://${url}/${slug}</loc>
        <lastmod>${published_at}</lastmod>
      </url>`,
      )
      .join("")}
    </urlset>`;
};

... and used the same technique for robots.txt in order to avoid the hardcoded URL.

Repository owner deleted a comment from rnoh96 Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants