We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45743
    • 3 Posts
    Hi!

    I'm currently (re-)building a page on MODX Revolution 2.6.4-pl with Googlesitemaps 2.1.0-beta1.

    I created a document, set it to "document / xml / inline" and put [[!GoogleSiteMap]] in it. The sitemap is generated instantly; any new document will show up.

    I used the same package for the old version of the website (revo 2.1.6) and it did list the blog entries of my "articles" page. On my new site only the blog page itself is in the ist- the blog entries are not listed!

    Is there a switch I need to flip?



    PS: I'm building my page on the template "mdx adorn" and the article row template is set to a custom template called "mdx_ArticleRowLargeTpl" if this does matter...

    This question has been answered by multiple community members. See the first response.

    [ed. note: ewok11 last edited this post 8 years, 3 months ago.]
    • discuss.answer
      • 3749
      • 24,544 Posts
      It's doing the same thing for me, as is getResources.

      I use this on a page with a template that's empty except for the [[!*content]] tag:

      <?xml version="1.0" encoding="UTF-8"?>
      <urlset xmlns="https://www.google.com/schemas/sitemap/0.84">
      [[getResources?
        &parents=`0`
        &tpl=`google-sitemap-tpl`
        &limit=`5000`
        &sortdir=`DESC`
        &includeTVs=`1`
        &processTVs=`1`
        &depth=`20`
        &sortby=`publishedon`
        ]] 
      </urlset>


      The only solution I know of is to add &showHidden=`1` to the tag. It's a bad solution if you have pages that are hidden from menus that shouldn't show up in the sitemap.

      You might try using pdoResources, but I suspect it will act the same.

      Both getResources and pdoResources need a property &showHiddenArticles, imo.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 45743
        • 3 Posts
        Because you mentioned the "hidden" flag I experimented with that and found that [[!GoogleSiteMap? &showHidden=`true`]] will include the blog posts although I cannot find anything that would mark the blog posts as "hidden".

        Now I have to exclude some "real hidden" documents but that´s rather easy to manage: [[!GoogleSiteMap? &showHidden=`true` &excludeResources=`123,78`]]

        Thanks für your answer! I am still puzzled why it used to work in the previous installation but not in the current one :-(
        • discuss.answer
          • 3749
          • 24,544 Posts
          Me too. The modResource object has a show_in_tree field, which is what hides the articles in the Manager. I don't know if the 'hidemenu' field is set as well, which would hide them from getResources without &showHidden=`1`. Bob's Guides has dozens of pages that need to be published but shouldn't be shown in the site map. It will be a pain to exclude them all.

          FYI, here's a quick utility snippet I wrote to list them:

          <?php
          $c = array(
              'hidemenu:=' => '1',
              'class_key:!=' => 'Article',
              'published:=' => '1'
          );
          
          
          $docs = $modx->getCollection('modResource', $c);
          
          foreach ($docs as $doc) {
              $ids[] = $doc->get('id');
              $output .=  "<br>" . $doc->get('pagetitle') . ' (' . $doc->get('id') . ')';
              
          }
          
          $output .= '<br><p style="overflow:scroll">' . implode(',', $ids) . '</p>';
          
          return $output;

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 45743
            • 3 Posts
            Thanks for your answer. I´ll stick to the "&showHidden=`true`"-solution as I only have a couple of hidden pages.