Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Sitemap not containing alternate urls in multilanguage portalSitemap not containing alternate urls in multilanguage portal
Previous
 
Next
New Post
11/4/2016 7:01 AM
 

Starting from DNN 7.2.2, it was added an alternate link with "hreflang" to sitemap.aspx for multilingual websites. However this does not seems to work even in the latest DNN 8.0.4 released on the 17th of August 2016.

After digging into the sitemap provider source code (from the source code related to the latest release) I found that the following lines in SitemapBuilder.cs that should add the alternate link to the sitemap are commented out:

        private void AddURL(SitemapUrl sitemapUrl)
        {
            writer.WriteStartElement("url");
            writer.WriteElementString("loc", sitemapUrl.Url);
            writer.WriteElementString("lastmod", sitemapUrl.LastModified.ToString("yyyy-MM-dd"));
            writer.WriteElementString("changefreq", sitemapUrl.ChangeFrequency.ToString().ToLower());
            writer.WriteElementString("priority", sitemapUrl.Priority.ToString("F01", CultureInfo.InvariantCulture));

            //if (sitemapUrl.AlternateUrls != null)
            //{
            //    foreach (AlternateUrl alternate in sitemapUrl.AlternateUrls)
            //    {
            //        writer.WriteStartElement("link", "http://www.w3.org/1999/xhtml");
            //        writer.WriteAttributeString("rel", "alternate");
            //        writer.WriteAttributeString("hreflang", alternate.Language);
            //        writer.WriteAttributeString("href", alternate.Url);
            //        writer.WriteEndElement();
            //    }
            //}
            writer.WriteEndElement();
        }

To be sure I also inspected the released DotNetNuke.dll with .Net Reflector just to find that AddURL() method is missing the lines devoted to the creation of the alternate links:

 private void AddURL(SitemapUrl sitemapUrl)
{
    this.writer.WriteStartElement("url");
    this.writer.WriteElementString("loc", sitemapUrl.Url);
    this.writer.WriteElementString("lastmod", sitemapUrl.LastModified.ToString("yyyy-MM-dd"));
    this.writer.WriteElementString("changefreq", sitemapUrl.ChangeFrequency.ToString().ToLower());
    this.writer.WriteElementString("priority", sitemapUrl.Priority.ToString("F01", CultureInfo.InvariantCulture));
    this.writer.WriteEndElement();
}

So the question is why are these lines commented out? I couldn't find any reported bug on dnntracker.atlassian.net to justify the commented lines.

Is anyone aware of this (mind that uncommenting the lines and recompiling the library generates a correct sitemap) and the reason why the lines have been removed?

It's important to mention that the last version of SitemapBuilder.cs in github actually have the above lines uncommented.

Thank you to anyone for answering my question.

 
New Post
11/4/2016 4:01 PM
 
did you follow the changes for this source code file in Github? it should be connected to a Jira item, you should get details for it in http://support.codeplex.com by searching the specified DNN-xxxx number.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
11/5/2016 4:40 AM
 
Hi Leupold, yes I did.

In fact the lines were committed because of this DNN-4122 ticket.

Reading trought the comments I saw that an argument was rised for this: "A common case for multi-lingual sites is to have them running off different domain names so they are relevant to their locale. This in turn means they are separate sites to crawlers, thus they should not appear with mixed domains in a sitemap as this is incorrect. When locales in DNN are mapped to different portal aliases, as they are effectively separate sites at that point."

Which I agree, however when portal aliases for each Language are based on the very same domanin, the alternate links should definitively be in the sitemap output. I think the problem was not correctly handled by removing the code.

That is why I am asking for an explanation of this... maybe I am missing something.

Thank you.
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Sitemap not containing alternate urls in multilanguage portalSitemap not containing alternate urls in multilanguage portal


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out