i have a kirby site up and running and i am using this solution to create a sitemap.
This works well for the default translation, but somehow i am getting a lot of crawler errors from google. I believe it is because google thinks, that the url’s i specified exist in english as well (and they do) but with a different link / uri.
The google example for a multi-language site is this:
But this is only for one page, the home page? How would i set this up correctly with kirby? Another problem i is that because i dont have the same site root url for every language ( site.com andsite.com/en ) the route does not reroute /sitemap to /sitemap.xml properly for the english version.
Is it correct, that a multi-language site-map does not need priority and modified tags? And where does the sitemap have to be placed (for all languages). E.g. for .com/en/sitemap.xml and .com/sitemap.xml or is it ok to just have one sitemap at .com/sitemap.xml ?
Thanks for your help
@lukasbestle i did not yet manage to test the multi-site setup using multiple domains -yet - since i dont have a development environment on our ftp strato server. If it breaks, it’s broken Not sure if testing this functionality works locally without a proper vagrant environment
This should give us the right structure. But when i view the sitemap i only see one translation for the <?php foreach($languages as $sitelang): ?> loop, am i missing something here? I dont see the ‘objects’ for the english translation…
Thanks. Also: Is it enough for google to make this sitemap available under site.com/sitemap ?
It’s recommended to make it available at site.com/sitemap.xml as well as to point to it in your robots.txt file. Google and other search engines even have a page where you can tell them where the sitemap is.
Hey @Thiousi, do you think i need a sitemap for the english translation as well or is one sitemap enough since it includes the values for de and en url’s. But this sitemap above, as suggested by google, doesnt have a modified or priority attribute, which confuses me a little
Do i need a second url for the sitemap? e.g: site.com/en/sitemap.xml ? Or is site.com/sitemap.xml enough with the template shown above.
For a single language website it’s straight forward to setup, but havent found much information about multi-language setups
It’s my understanding that cross-site submissions of sitemaps are allowed by Google only if the sites are verified in the search console, don’t know how that affects a multi-lang site. (source)
I think for your use case, I would do the following:
A single language sitemap for your default language
Using hreflang attributes to indicate variations of the same page in all languages.
Why? Because hreflangs are used by robots when crawling to build the equivalent of a multi-lang sitemap. We built a tutorial on how to use hreflang on macotuts.com along with pre-built code. I’d be interested to hear whether the returned hreflang tags work in your setup. Feel free to start a PM chat if you want to
Reading your tutorial right now reporting in later !
PS: site is verified in the webmaster console with site.ch. with english translation under site.ch/en. But with Kirby 2.4 on the horizon i might just implement the new multi domain setup with site.ch and site.com and verify both domains with the google console.
Yes, I can confirm this, the double foreach loop does not work, but I can’t figure out why that is. If you exclude the first language from the second loop, it does work though, but then you would have to repeat the code in the second foreach loop for the first language. If I get round to it, I’ll test this in an older Kirby version.