Approaches to generating Google Sitemap automatically
Hello everyone,
I did a quick search on the forum about Google Sitemap generation and found a few older posts and was wondering if anyone has any newer ways to generate a Google Sitemap on Umbraco?
Have you tried editing a template in the backoffice, and selecting the option to include one of the Umbraco pre-built macros. I'm sure they have a sitemap in there....
Here's a screenshot (in version 7.5.13) of the "Edit Template" screen in the backoffice. If you select the dropdown next to "Insert Inline Razor Macro", you'll see "Sitemap" as one of the options and this will insert the code you need.
Approaches to generating Google Sitemap automatically
Hello everyone,
I did a quick search on the forum about Google Sitemap generation and found a few older posts and was wondering if anyone has any newer ways to generate a Google Sitemap on Umbraco?
Thank you! Genc
Have you tried editing a template in the backoffice, and selecting the option to include one of the Umbraco pre-built macros. I'm sure they have a sitemap in there....
Something like this should do the trick nicely... (I think this even comes built-in):
hi Kris,
I tried this and it worked. The only thing I modified was to use "Model.Content.Site()" instead of "CurrentPage.AncestorOrSelf(1)". As suggested here:
https://our.umbraco.org/documentation/reference/Common-Pitfalls/
Thank you! Genc
Thank you both! I will give this a try! Will update this post with news shortly! :D
Here's a screenshot (in version 7.5.13) of the "Edit Template" screen in the backoffice. If you select the dropdown next to "Insert Inline Razor Macro", you'll see "Sitemap" as one of the options and this will insert the code you need.
Thank you MuirisOG. It is very strange, but in 7.4.14 I do not have the pre-built macros you have. This isn't normal right?
This is what I see:
That is strange.
I've looked back at earlier versions of Umbraco that I have been working on, and found that I have the option under these versions:
I'm using Webforms, so I don't know if that would cause such a difference.
Here's a screenshot from 6.2.4
This is how I was able to implement a dynamic sitemap on my Umbraco 7.7.9 installation:
Step-by-step tutorial here: https://blog.nicolaayan.com/2018/03/generate-an-umbraco-sitemap/
Hi Bit late to this post, but if anyone is looking for an example of how to do this using a controller, I have a blog post at https://www.georgephillipson.com/blog/umbraco/umbraco-xml-sitemap/ and it also contains code that can be downloaded from GitHub.
Hope it helps someone
is working on a reply...