We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26027
    • 145 Posts
    Our CMS has a function which sorts all our news postings and posts the most recent 4 to a "Recent News" section of the News Page. This has worked flawlessly for a year, until ...

    ... one of our data entry staff created a duplicate of a recent news posting. I tried to delete the duplicate resource and when I do the template routine shown below doesn't produce a 'hit' in its search. Same thing happens if I unpublish the duplicate resource.

    I know that I'm only providing some of the information that could help you but I wanted to minimize the length of this thread to improve the chance that someone will review it and possibly help me.

    Here's the template code:
    <div id="homeotherheadlines" class="sectiontitle">News Headlines</div>
    [[Ditto? &parents=`23` &start=`1` &tpl=`home_news_item`
     &tplLast=`home_news_item` &sortBy=`pub_date` &sortDir=`DESC` 
    &depth=`3` &total=`4` &hideFolders=`1` ]]
    		</div> 


    Here's the code for the chunk called home_news_item:
    <div class="homeNewsSnip">
    [[mkImage? &imgClass=`homeNewsSnipIcon` &imgSrc=`[+HomeHeadlineIcon+]`]]
    <h1>[+title+]</h1>
    <div class="homeNewsSnipContent">
    [+HomeSnip+]
    <p class="learnmore"><a href="[~[+id+]~]">Read More</a></p>
    <div class="clearLeft"></div>
    </div>
    </div>


    To summarize, if both the original and duplicate resources are present, one is selected and appears as a recent news item. If either one is removed, the remaining one does not appear.

    Any thoughts on what we might be doing incorrectly?

    Thanks to any takers ... Sam [ed. note: samg last edited this post 14 years, 9 months ago.]
      • 3749
      • 24,544 Posts
      Try moving the one you don't want to show to another folder that is not under 23. I would suggest also changing it's pagetitle and alias.

      ---------------------------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
      MODx info for everyone: http://bobsguides.com/MODx.html
        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
        • 26027
        • 145 Posts
        BobRay, you hit the jackpot!! Can't believe it worked so quickly!!

        I had previously moved the resource to the root where it then became a container. I did not make changes to the title and alias however. And ... it didn't work.

        I then put it back where it was and changed the title, long title, description and alias as follows.

        From: THIS IS THE PREVIOUS LENGTHY TITLE OF THIS NEWS ARTICLE
        To: THIS IS THE PREVIOUS LENGTHY
        URL Alias: this-is-the-previous-lengthy

        That also didn't work.

        Following your suggestions I changed these fields in a different way:

        To: XXTHIS IS THE PREVIOUS LENGTHY TITLE OF THIS NEWS ARTICLE
        URL Alias: xxthis-is-the-previous-lengthy-title-of-this-news-article

        The only differences I can see between my solutions and yours are two;

        1. I didn't do the move and renames at the same time
        2. My renames when it worked just now changed the first 2 characters, rather than leaving them the same and just shortening the title etc.

        All I can think of is that the routine may have only sorted on published date and maybe the first 10 or 20 characters of the title, producing 2 equal 'hits'.

        Anyway, if it works, it works. Thank you very much. You needn't comment further on this unless you have an intuition about how these changes solved the problem.

        Regards ... Sam
          • 3749
          • 24,544 Posts
          I'm glad you got it worked out. Thanks for reporting back. smiley

          I think you're right that the sort is only on the first characters.


          ---------------------------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
          MODx info for everyone: http://bobsguides.com/MODx.html
            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