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 image tags for static sites? #252

Open
anjali89r opened this issue Jun 5, 2022 · 2 comments
Open

How to add image tags for static sites? #252

anjali89r opened this issue Jun 5, 2022 · 2 comments

Comments

@anjali89r
Copy link

Currently, all the routes under the pages folder are automatically added to the sitemap.xml. I want to add images to sitemap for these routes which are under pages. I don't see an option for static pages, but do see an option for dynamic routes.

Expected

<url>
<loc>https://example.com/collections</loc>
<lastmod>2022-06-04T21:16:30+05:30</lastmod>
<changefreq>daily</changefreq>
<image:image>
<image:loc>image-url</image:loc>
<image:title>product 1</image:title>
</image:image>
</url>

I'm checking to see if there is an option to add the image tag as above for static pages.

@StevenKnoop
Copy link

Hi, I am also interested in this. Please help.

@NicoPennec
Copy link
Member

It's not available directly by configuration.

But you can use the filter option to customize your routes:

{
  sitemap: {
    filter: ({ routes }) =>
      routes.map((route) => {
        if (route.url === '/collections') {
          route.img = {
            url: 'image-url',
            title: 'product 1',
          }
        }
        return route
      }),
  }
}

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