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

    I have a News section on our website whose main page by default shows summaries of all of the news articles in this section of the site (loaded/paginated into the page using Ditto). The website runs MODx Evo.

    Some other parts of the website also link to the News page with a tag name as a URI parameter, so that the page called in this way will only show the articles which are tagged with the corresponding tag, eg:


    (I set the tag(s) for each article using a template variable and pass the name of the template variable as the &tagData parameter to the Ditto call which shows the article summaries.)

    In these cases where the News page is loaded with a tag parameter in the URI, I would like to include text on the page (before the individual article summaries) making it clearer that only news articles matching the tag parameter are listed when the page is accessed this way (the article summaries themselves also include the tags which are set for themself, but it will probably not be obvious to site visitors that not all news articles are shown here otherwise).

    The following code shows the tags corresponding to the URI parameter when the page is called this way, but it will also shows the tag value "None" if the page is called without a tag parameter (eg, http://www.example.org/news).

    Showing articles tagged: <span class="news_tags">Tags:</span> [+tagLinks+]

    What I would like to do for the case when the News page is loaded without a URI parameter (and therefore all News articles will be shown) is to not show this above text, as "Showing articles tagged: None" is going to look a little confusing to visitors.

    Is there some easy way that I can do this, short of having a snippet which outputs that line depending whether or not the tags parameter value is set?

    Thanks for any advice!
      Please don't PM me unless it's absolutely essential: if a technical question is worth asking, it's worth asking in public, so that others can share their experience, and so that all can learn from the answers.