We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14877
    • 110 Posts
    I’ve got a simple blog set up, more or less by following the "Creating a Blog" tutorial.

    However, I have been unable to get a list of posts to show up in Archivist. I was originally following the tutorial, but when I didn’t get any archived posts showing up, I decided to simplify things and make direct Archivist/getArchives snippet calls. The first part, on the "blog" page shows up fine (shown after the code):

    [[!getResourcesTag?
      &elementClass=`modSnippet`
      &element=`getResources`
      &tpl=`viewpointPost`
      &parents=`3`
      &limit=`1`
      &includeContent=`1`
      &includeTVs=`1`
      &showHidden=`1`
      &hideContainers=`1`
      &cache=`0`
      &pageVarKey=`page`
    ]]
    <hr />
    <h3>Archives</h3>
    <ul>
      [[!Archivist?
        &tpl=`arcRowTpl`
        &target=`6`
        &parents=`3`
      ]]
    </ul>


    Produces this (at the bottom of the page):

    ______________________________________________
    Archives

    December 2010 (1)
    November 2010 (1)


    However when I click on one of the above (specifically I used the November one because they are over 30-days old and are supposedly "archived"), I get the following result:

    November 2010 Archives (0)
    ____________________________________________


    The "target" (6) resource is (I discovered the "total" placeholder by reading the code):

    [[!getArchives?
      &tpl=`arcResultTpl`
      &parents=`3`
      &toPlaceholder=`archives`
    ]]
    
    <h3>[[+arc_month_name]] [[+arc_year]] Archives ([[+total]])</h3>
    
    [[+archives]]
    <hr />


    Since the "total" (I assume number of rows retrieved) is zero, it really doesn’t matter what my template chunk looks like!

    I turned on "debug" and saw the query (wow!) and it appears to have the correct year and month (and parent). There are, by the way, two published child resources of (3), one in
    November and one in December 2010. Correctly reported by Archivist on the "blog" page.

    I’m perplexed. Other than getting much deeper into the code and the database than I really want to, I’m not sure what to do next sad
      __________________
      JRG
      • 14877
      • 110 Posts
      I now know what is going on.

      The solution is trivial, but the underlying Blogging architecture has an issue (from my perspective). Anyway, solution first:

      Blog posts (i.e. resources that are blog posts) must have "Hide from menus" set to false (i.e. unchecked). The light bulb went on for me when I was re-reading the "Creating a Blog" tutorial and encountered the one-sentence warning:
      If you choose to have date/year or sub-containers, make sure they have Hide from Menus checked, so that they wont show up in your getResources calls.
      What this means is that if a blog post has "Hide from Menus" checked, it will not be found by getArchives (but will be found by Archivist).

      ——————

      This strikes me as counter-intuitive. A resource being used as a blog-post "category" (a "container") will obviously be a candidate for "Hide from menus". It seems logical to me that blog-posts themselves would also be hidden from menus. [Aside: Wayfinder is great!].

      My take is that there should be a "Blog Post" property that marks a blog post for what it is. Using a property intended for a different purpose is economical, but in this case the property doesn’t imply the correct things.

      The alternative, which doesn’t require a new property, is to use the "Container" property -- if a resource is a container, getArchives should ignore it but otherwise treat it as a blog post. This would work because blog posts need to be children of some other resource (which represents a category, possibly the only category) which would be "Hide from menus".
        __________________
        JRG