On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi,

    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:

    http://www.example.org/news?tags=sometag

    (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).

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


    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.