We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5689
    • 289 Posts
    I’m using the sitemap snippet (http://modxcms.com/extras/package/410), and I have Friendly URLs enabled with aliases in use. In my site settings, I have a suffix of ".html" for my pages. My sitemap’s alias is simply "sitemap".

    How can I override the .html extension for the sitemap so that it works as sitemap.xml? If I set the alias to "sitemap.xml", the manager removes the period upon saving, and I imagine that even if it didn’t remove the period, it would still apply the .html suffix, giving me a page at "sitemap.xml.html", which is not any better.

    Thanks!
      I'm learning more about MODx all the time and loving it.
      • 26931
      • 2,314 Posts
      Hi Compeek,

      i use the SEO Strict URLs Plugin http://modxcms.com/extras/package/395 which enables you to override your suffix -> "Base Name":
      For overriding specific documents, create a new template variable (TV) named seoOverride (or whatever you have defined in the configuration) and enter the following:

      Input Type: DropDown List Menu
      Input Option Values: Disabled==-1||Base Name==0||Append Extension==1||Folder==2
      Default Value: -1
        • 5689
        • 289 Posts
        Thanks, sharkbait! I have the plugin installed and set up, and it should work perfectly, but the only problem is that MODxs still keeps removing the period from my alias, so I can’t get a basename of "sitemap.xml". Any ideas?

        Edit: For now, I just went to phpMyAdmin and set the alias in the database, and it works, but any time I edit and save the Sitemap resource, it’s going to mess it up again.
          I'm learning more about MODx all the time and loving it.
          • 26931
          • 2,314 Posts
          MODxs still keeps removing the period from my alias
          so it’s sitemapxml? maybe it interfere’s with a TransAlias-Plugin setting?
            • 5689
            • 289 Posts
            Perfect! That was the problem. I’m not even using TransAlias, so I just disabled it.

            It’s all working how I need it now. Thanks for the help. laugh
              I'm learning more about MODx all the time and loving it.
              • 26931
              • 2,314 Posts
              great, glad it worked smiley .... while i was checking one of my recently updated sites (to see how i set it up), i just found out it also had sitemap.xml.html because i changed the template and therefore the override TV wasn’t bound to that document anymore - so, thanks to you too wink
                • 5689
                • 289 Posts
                Haha, well you’re welcome then.

                By the way, I found that when I override with basename, the seoOverride option to rewrite categories as folders was causes an infinite rewrite loop for resources that aren’t actually categories but don’t have a period in their alias. So before I got the period to stay, my alias was "sitemapxml", and it’s not a category, but I was overwriting with the basename, so if I tried to go to "modx2/sitemapxml" (modx2 is the subfolder on the site while I develop the new site design) in the browser, the seoOverride plugin would keep trying to redirect it or something, and the Firefox told me there were too many redirects. Perhaps I could report that to JIRA or something?
                  I'm learning more about MODx all the time and loving it.
                  • 26931
                  • 2,314 Posts
                  the seoOverride option to rewrite categories as folders
                  hmmm, maybe..don’t know ...i think i actually never used that setting (rewrite categories as folders) not 100% sure i follow you smiley bit tired & slow right now
                    • 5689
                    • 289 Posts
                    That’s all right. I’m not even sure exactly what was happening. If it becomes a problem sometime, maybe I’ll give it some more thought, but I just turned it off since I don’t need it either.
                      I'm learning more about MODx all the time and loving it.