We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6705
    • 79 Posts
    This possibly isn't a Ditto question, but I'm asking here as it is (sort of) Ditto-related.

    I am developing a news section for our website, which uses Ditto to create a news summary listing page containing 'teaser' headlines of news articles, including the title, publication date, tags (via a Template Variable), author and summary teaser text. When you select a link to an article, you go to the full article page.

    The full article page displays just the article text as content, but what I would like to do is also include some of the metadata that was displayed on the summary page by Ditto (title, publication date, tags, author), as the full article page looks a bit 'lacking' otherwise. (The title does appear in the expected place via the page template, but for layout reasons it would be nice to be able to repeat it in the metadata area as well.)

    In a previous incarnation of the news section, I used a different template for the full news article pages, which included the metadata in the appropriate place in the template, but unfortunately, it turned out that it was hard for contributors to remember that they would have to change the template value manually for these pages (the template used by the news summary page was inherited otherwise), as they each only added articles occasionally, perhaps once a month or so.

    I see that the config options have been updated at some point (we're using Evo 1.0.6) to allow "Automatic Template Assignment" to inherit the Sibling template, rather than Parent. This might perhaps allow the continued use of the different template workaround for the full news article pages, although it would require the first person adding an article each year to get this right! (We put our news articles in containers sorted by year (our Ditto call is configured not to display these), in order to make the news articles more manageable and so as not to have a single infinitely-growing news folder.)

    Is there some Ditto magic that I have not previously discovered that would allow the pages within the Ditto-powered news folder to include the additional data that I want, or is the only way to do this via the page template?

    To avoid having to use an additional template, I guess I might be able to incorporate a snippet in the news template (used by both the news summary page and the full news articles) which would check the URI of the page and find and output the required metadata if the page was a news article (URI path = /news/????/ (where huh? is the year), and not if it wasn't (ie, the news summary page), but this sounds potentially a little complicated.

    Can anybody offer any advice on what might be the best way to try to do what I want?

    Thanks!
      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.
    • You'll need to use a snippet to get the information, then format the output. I forget if Evo has the equivalent of getField. Something like this might be useful http://modx.com/extras/package/a
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org