We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36786 ☆ A M B ☆
    • 209 Posts
    Ok so I have tried three ways to create a sitemap and none are working for me.

    getResources is ok but no ability to utilize the "searchable" checkbox to determine content... also, I'm having trouble getting template variables to output and the homepage URL is messed up. Odd because I used the code written by someone else for exactly that. ( http://rtfm.modx.com/display/ADDON/getResources.Google+XML+Sitemap ). Regardless, I still want to use the "searchable" checkbox to include resources into the sitemap, so it's moot.

    googleSitemap and sitemapFriend don't allow for manual selection of sitemap priority and update frequency, but base those on publication and modification dates... which ends up being useless and completely backwards of what I need it to be.

    Is there any way to modify the googleSitemap or sitemapFriend snippets to base the priority and change frequency on template variable values while using the "searchable" checkbox to select included content? I don't know PHP or how to get the value of a template variable from within a snippet.

    Thanks, I'm getting frustrated.
    Ben
      Ben Morrison
      Hacking templates to pieces since 2003
      • 33968
      • 863 Posts
      I don't see why you couldn't do this using the getResources tutorial - if you post your snippet call and tpl chunk we might be able to see where it's going wrong...

      Also, I didn't understand how you intend to use the 'searchable' checkbox. That's nothing to do with search engines (I think it's to include a resource for on-site search) but if you want to use it for your sitemap you could always do this:
      [[!getResources? &parent=`0` &limit=`0` &where=`{"searchable:=":1}` ]]
      
        • 36786 ☆ A M B ☆
        • 209 Posts
        I didn't know that was possible with getResources, I just switched over from Evo so I'm still catching up. Here is the snippet and chunk.

        The URL for the homepage ends up being www.homepage.com/www.homepage.com and thats an issue as well

        Thanks for the help!

        <?xml version="1.0" encoding="UTF-8"?>
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
                xmlns:image="http://www.sitemaps.org/schemas/sitemap-image/1.1"
                xmlns:video="http://www.sitemaps.org/schemas/sitemap-video/1.1">
        [[!getResources?
          &parents=`0`
          &tpl=`google-sitemap-tpl`
          &limit=`500`
          &sortdir=`DESC`
          &includeTVs=`1`
          &includeContent=`1` 
          &processTVs=`1`
          &depth=`10`
          &sortby=`{"createdon":"DESC"}`
          ]] 
        </urlset>


        <url>      
          <loc>[[++site_url]][[~[[+id]]]]</loc>
          <lastmod>[[+editedon]]</lastmod>
          <priority>[[+tv.google-sitemap-priority]]</priority>
          <changefreq>[[+tv.change-frequency]]</changefreq>
        </url>

          Ben Morrison
          Hacking templates to pieces since 2003
          • 33968
          • 863 Posts
          Ok Ben, couple of things:
          - you need the closing > bracket for your <urlset> tag
          - for your urls, do this:
          <loc>[[~[[+id]]? &scheme=`full`]]</loc>
          

          which will output absolute links and avoid your home page problem.

          Good luck catching up with Revo, you'll get there soon enough and I'm sure you won't look back wink
            • 36786 ☆ A M B ☆
            • 209 Posts
            Ok so the URL issue and including only those resources that are searchable is done, BUT the template variables STILL don't render in the final sitemap sad
              Ben Morrison
              Hacking templates to pieces since 2003
              • 36786 ☆ A M B ☆
              • 209 Posts
              Strike that, the update frequency is working but not the priority. Maybe I made an error in the tpl settings?
                Ben Morrison
                Hacking templates to pieces since 2003
                • 36786 ☆ A M B ☆
                • 209 Posts
                Nevermind! Fixed it! THANKS!
                  Ben Morrison
                  Hacking templates to pieces since 2003