Support Google News Sitemaps
See original GitHub issueIs your feature request related to a problem? Please describe. I am using next.js to build local news websites. I want to ensure they are configured properly for SEO and Google News. Google News requires a specific sitemap format with special fields in order to have your news website populate in Google News.
Describe the solution you’d like
In order to support this, next-sitemap
would need to allow the population of nested fields. A Google News sitemap requires some specific nested fields. Here’s an example from The New York Times:
<url>
<loc>
https://www.nytimes.com/2019/09/30/learning/lesson-of-the-day-kehinde-wileys-times-square-monument-thats-no-robert-e-lee.html
</loc>
<lastmod>2021-03-05T20:38:12Z</lastmod>
<news:news>
<news:publication>
<news:name>The New York Times</news:name>
<news:language>en-US</news:language>
</news:publication>
<news:publication_date>2019-09-30T08:00:03Z</news:publication_date>
<news:title>
Lesson of the Day: ‘Kehinde Wiley’s Times Square Monument: That’s No Robert E. Lee’
</news:title>
</news:news>
<image:image>
<image:loc>
https://static01.nyt.com/images/2019/09/27/arts/27kehinde3/27kehinde3-articleLarge.jpg
</image:loc>
</image:image>
</url>
Ideally, when returning an object for a URL either in the transform
function or in a dynamic sitemap, I could populate these fields:
return {
loc: "/2019/09/30/learning/lesson-of-the-day-kehinde-wileys-times-square-monument-thats-no-robert-e-lee.html",
lastmod: "2021-03-05T20:38:12Z",
news: {
publication: {
name: "The New York Times",
language: "en-US"
},
publication_date: "2019-09-30T08:00:03Z",
title: "Lesson of the Day: 'Kehinde Wiley’s Times Square Monument: That’s No Robert E. Lee'"
},
image: {
loc: "https://static01.nyt.com/images/2019/09/27/arts/27kehinde3/27kehinde3-articleLarge.jpg"
}
}
Describe alternatives you’ve considered I could generate this XML file on my own through next.js, but it would be nice to use the same library I’m using to generate the overall sitemap.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:20
- Comments:12 (1 by maintainers)
Top GitHub Comments
For anyone also stuck needing nested field support, I’ve been able to work around it by passing a template literal into in the parent field eg:
Hi everybody Is this feature implemented? is there any pending PR? Thanks