We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6038
    • 228 Posts
    http://rtfm.modx.com/display/ADDON/getResources.Google+XML+Sitemap

    I used the above example for generating a sitemap using getResources, but looking at my output i noticed that for the homepage the output was this:
    <url>
      <loc>htt p://mydomain.com/htt p://mydomain.com</loc>
      <lastmod>2011-11-28 11:13:54</lastmod>
      <priority>.5</priority>
      <changefreq>monthly</changefreq>
    </url>

    (*note: spaces deliberately added to prevent the post parser from auto converting urls into links)
    The problem stems from part of the template rendering chunk with
    <loc>[[++site_url]][[+id]]</loc>

    When the home page is reached, the full base url is inserted rather than the alias (eg home.html or index.html)

    I fixed this by modifying the example chunk to replace the above line with:
      <loc>[[++site_url]][[+id:is=`[[++site_start]]`:then=``:else=`[[~[[+id]]~]]`]]</loc>


    Anyone got a different or better solution?


    [ed. note: christianhanvey last edited this post 14 years, 10 months ago.]