question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Google News Sitemaps

See original GitHub issue

Is 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:open
  • Created 3 years ago
  • Reactions:20
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
searlebcommented, Nov 22, 2021

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:

{
    "image:image": `
            <image:loc>${imgUrl}</image:loc>
            <image:title>${imgTitle}</image:title>
            <image:caption>${imgCaption}</image:caption>
          `
}
3reactions
fescobarcommented, Jun 13, 2022

Hi everybody Is this feature implemented? is there any pending PR? Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add a Google News sitemap - Publisher Center Help
With a Google News sitemap, you can help Google News: Discover news articles faster: Sitemaps allow Google News to quickly find news articles...
Read more >
Create a Google News Sitemap | Documentation
Learn how to create and submit a Google News sitemap by reviewing the requirements, example entries, and news-specific tag definitions.
Read more >
Google News Sitemaps
Google News uses XML schemas to define the elements and attributes that can appear in your News Sitemap file. A News Sitemap may...
Read more >
5 best practice tips for maintaining a Google News sitemap as ...
Crawl and index all news articles – Sitemaps help the crawler discover news hubs and article URLs, which improves content coverage. Here's an ......
Read more >
Add support for Google news sitemaps [#3268212] | Drupal.org
Add support for Google news sitemaps. Postponed. Project: Simple XML sitemap. Version: 4.x-dev. Component: Code. Priority: Normal. Category:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found