xmlvue.jsnuxt.jsgoogle-news

How to create a Google News feed (xml) in Nuxt.js?


As in Google Docs it is shown that my feed needs to look like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"       
        xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
  <url>
    <loc>http://www.example.org/business/article55.html</loc>
    <news:news>
    <news:publication>
      <news:name>The Example Times</news:name>
      <news:language>en</news:language>
    </news:publication>
    <news:publication_date>2008-12-23</news:publication_date>
      <news:title>Companies A, B in Merger Talks</news:title>
    </news:news>
  </url>
</urlset>

I have already tried nuxt/feed and nuxt/sitemap module. In feed module I don't have tags like <news:news> or others. Also I can't set urlset tag too.

In sitemap module I can set some urlsets but not all of them. (See: https://support.google.com/news/publisher-center/answer/9607107?hl=en&ref_topic=9606468) This module also doesn't have the tags support that I need.

I think that there is no module for just this purpose and I should code my own module for this. So I was wondering how can I create my xml feed for the type that Google News wants ?

Edit: I know realized that there is a module like this:https://github.com/ekalinin/sitemap.js

So the question can be updated like can I use this in Nuxt.js ?


Solution

  • Okay I solved this issue.

    I am not sure how this works but we actually don't need the tags in the question that is also stated in Google docs.

    With feed module nuxt/feed we can actually do it. (It's own documentation explains everything needed) After creating RSS feed we just need to copy our path to Google publisher center and it reads our feed and it works.