Google News Sitemap, where does it go

Trying to figure out where to place a newly created Google site map. Following Ghost’s own tutorial doesn’t talk about where to place it.

Anyone?

1 Like

Interesting

If I understand your question correctly, you need to paste the xml in step 2 into a file called sitemap.hbs in the root of your theme

  1. Download your current theme from Ghost Admin.
  2. Create sitemap.hbs in your theme directory and add this code inside of file:
<?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">
  {{#get "posts" limit="1000" order="published_at desc" include="tags"}}
    {{#foreach posts visibility="all"}}
    <url>
      <loc>{{url absolute="true"}}</loc>
      <news:news>
        <news:publication>
          <news:name>{{@site.title}}</news:name>
          <news:language>{{lang}}</news:language>
        </news:publication>
        {{#if @labs.members}}
          {{#has visibility="member"}}
            <news:access>Registration</news:access>
          {{/has}}
          {{#has visibility="paid"}}
            <news:access>Subscription</news:access>
          {{/has}}
        {{/if}}
        <news:genres>Blog</news:genres>
        <news:publication_date>{{date published_at format="YYYY-MM-DDTHH:mm:ssZ"}}</news:publication_date>
        <news:title>{{title}}</news:title>
        <news:keywords>{{tags limit="5" autolink="false"}}</news:keywords>
      </news:news>
    </url>
    {{/foreach}}
  {{/get}}
</urlset>
  1. Upload your theme on Ghost Admin.
  2. Go to Labs > Routes > and click Download current routes.yml
  3. Edit routes.yaml with Notepad (or Notepad++) and add this code:
routes:
  /sitemap/:
    template: sitemap
    content_type: text/xml
  1. Save and upload your new routes.yaml file on Ghost Admin.
  2. You can see result on /sitemap/

I don’t know what is this. What we can do with it? Please explain. I’m new to ghost. :slightly_smiling_face:

Google News requires special sitemap file for their service. If you wanted to listed on Google News, you should create new file for Google News.

If I created the file, how coukd I add it into Google news? Which option should I use? And which url should I use.

I’m not sure and I don’t want to mislead you. Maybe you can find on Google’s official guides.

1 Like

Thank you, I’ll check. :heart:

This is interesting, I will also try to create the new sitemap.

It is not clear to me, however, whether you need to add the site to the Publisher Center.

However, it seems that it is no longer strictly necessary:

Publishers are no longer required to submit their site in order to be eligible for the Google News app and website. Publishers are automatically considered for the Top News section or for the News tab of the Research. All they have to do is produce high-quality content and comply with the Google News content policy.

Anyone have more information?

Thank you

The sitemap documentation should be updated

This is the error from GScan:

After a bit of research I realized that Github Action also has problems if it does not make this change.