Generate valid XML Sitemap for Google


#1

Matrix Version: v5.2.6.1

Hi,
We are just wondering if there is a way to easily generate a valid XML Sitemap to submit to Google Search Console.

We have tried creating a sitemap asset and exporting it to XML but Google did not accept it.

Any help is appreciated.

Thanks.


(Bart Banda) #2

You are best creating one using an asset listing where you can customise the layout completely.

You can download an existing template example of one from the community site here: https://matrix.squiz.net/resources/templates/listing-templates

You will also need to apply an XML design to it so that it sends the right headers and prints the page on the front end as an XML file rather than a HTML page.


(Serge) #3

Really? What’s the purpose of a sitemap if not to spit out an XML to be usable by robots.txt for search engines? Could we add this on the development roadmap?


(Bart Banda) #4

The Sitemap asset was originally created to create HTML based site maps that were common back in the day, where you could click on a link on your site, in the footer somewhere perhaps, and then see a visual and read friendly representation of the site’s hierarchy and structure.

For sure. I can put a feature request into our roadmap tool for this.


(Serge) #5

Thanks Bart.

In the meantime, for anyone interested in the workaround with a design/asset listing:



You might have to change the site asset web path to be exactly “sitemap.xml”

(if images are too small, right click on them and pick “Open image in a new tab”).

Then we need to add some cache expiry rule onto that file, I’m still working on this … see question below.


(Serge) #6

@Bart

I’ve created a “Clear Matrix Cache” job to run on my sitemap.xml, after creating it, where can I see that job?

It does not seem to appear in the “Scheduled Jobs Manager > View Scheduled Jobs”.

Note: I can’t seem to be able to use triggers to manage the sitemap cache update as triggers only seems to have actions to “flush the cache” but not to prime it back (eg: reload the page so next time it is called by the google bot, it would be already cached and speedy).


(Tbaatar) #7

I don’t think there is any need for feature sitemap.xml development. The current method of creating through design file actually makes more sense of separating the presentation and data.

We usually create various design templates which include:

Blank (HTML)
RAW (Plain Text)
XML
JSON
Print

and so on


(Bart Banda) #8

If you created a scheduled job in that Clear Matrix Cache tool, the job should appear below on that same screen, like this:

It will also appear in the Scheduled Jobs Manager’s Scheduled Jobs screen under the “Repeating” heading.


(Dave Oakley) #9

Hi :thinking: is this still the best way to make a sitemap XML for google in M6?

https://matrix.squiz.net/resources/templates/listing-templates :sunglasses:

Cheers. :man_student: Dave.


(Dave Oakley) #10

Hi @Bart, can you check this out for us? Cheers.


(Bart Banda) #11

Hey @frontstage, I don’t actually work at Squiz anymore (left in May this year) but I’d say this is the best place to look for the latest version (which I’m guessing hasn’t changed from the one you linked above): https://marketplace.squiz.net/components/site-map


(Dave Oakley) #12

🫢🫢🫢 Thanks Bart! 🫢🫢🫢