Hi!
I was hoping that, after upgrading to DNN 9.4.1, it would generate a proper site map for our localized site. However, that seems not to be the case. Maybe I am not doing it right.
I have setup the site for two languages with a site alias and this results in actually two site maps, one for each language. I know i can build a sitemap index for this but I expected a proper single sitemap.xml file using href tags to tell the search engine(s) that spefic pages do exist in multiple langauge.
I read in another thread (http://www.dnnsoftware.co...ltilanguage-portal), that this would eventually not occur if using a subdomain for each language but we don't have a proper (aka wildcard or SAN) SSL certificate allowing us to do that, so we have to resort to having the language in the URL. There seems to have been a fix to something, causing the corresponding lines of code to get commented out.
In order to support the older DNN version and to get a usable sitemap out of it, I wrote my own sitemap generator in form of a stored procedure building the XML file using "WITH XMLNAMESPACES", but I would have to update it, taking a few hours, due to the new (and better) friendly URLs without default.aspx and such.
Is there possibly a module that does the job correctly or shall I reactivate the code that was commented out or update my own sitemap.xml export method?
Here is an example of how it should look like (one url element for each page), if a page is available in both languages:
Here is an article about using the hreflang tag: https://searchengineland....-xml-sitemaps-123030
Andreas
This is the old stored procedure, ugly and hacky (as image, because of tags):
The view V_TabsForXmlSitemap produces two columns URL and hreflang. hreflang is either language 1 (en) or language 2 (de) or NULL if a page exists in both languages, which kind of limits it to two languages. The view also relies on a few helper tables, that can be used to override URLs where we had IIS URL rewriting in place. With DNN 9.4.1 we don't need most of that anymore and we can rely on the builtin rewriting capabilities.
This is how I sanitize the new TabNames, if I should complete updating it, quite ugly too: select TabName, replace(replace(replace(replace(replace(replace(replace(replace(TabName, '(', ''), ')', ''),'&','-'),' ','-'),'/','-'), '-', '<>'), '><', ''), '<>', '-') as SanitizedTabName from Tabs It may not work for anyone, but works with our TabNames. It daisy chains a few Replace and removes multiple consecutive hyphens in the end and replaces them with a single hyphen. In this order: 1. Replace "/" or " " or "&" with "-" 2. Replace "(" or ")" with nothing 3. Replace multiple consecutive "-" with a single "-" Am not sure about other characters and how DNN generates the page name, for example the colon ':'. If I put the colon into a page's name it seems the page cannot be opened anymore. The last step removing the multiple consecutive "-" by using 3 replaces only works as long as a page name does not contain '<' or '>', but which sane person would use those in a page name anyways.
Posted By Andreas on 19 Nov 2019 10:51 PM Hi! I know i can build a sitemap index for this but I expected a proper single sitemap.xml file using href tags to tell the search engine(s) that spefic pages do exist in multiple langauge.
AFAIK DNN does not generate the sitemaps like that. I "fixed" it by adding Meta tags to the page for a client.
I do think this would be a great improvement, could you log this please?
I think it's already here logged , please add you opinion :-)
I see it's already merged into the development branche, marked for DNN 10
https://github.com/dnnsof...n.Platform/pull/2870
Thank you Timo, for looking this up! Seems like a DNN10 update will follow soon then and in the meantime I will use my hacky workaround until it gets released. Andreas
I put up the table, view and stored procedure and how to call it here on pastebin. If anyone can't wait for DNN10, here you go (without any warranties of any kind): https://pastebin.com/Gf7TsA5m
But be warned, it is just a hack and it heavily relies on the database not being changed. There were no changes needed between DNN 4.x and 9.4.1 though, I only had to make changes to the generated URLs because before we used the language=XX parameter and now the language is implemented as a virtual sub directory instead ("https://www.mysite.com/XX/..."). Another change was the way DNN now generates page names. 1. You can surpress URLs from going to the sitemap by adding a row to the table with the corresponding TabId and NULL in the URL and hreflang field. 2. You can add a page that is only available in one of the two languages by adding a row with the corresponding TabId, URL and the language code in the hreflang field. 3. You can change the URL of a page that exists in two languages by adding a row with the corresponding TabId, URL and Null in thge hreflang field. For example if a page has the URL https://www.mysite.com/home in DNN but is also available as https://www.mysite.com and you want that URL to go into the sitemap.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.