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

    I have written a long article and I want to split it into more specific topics.

    The idea is that the specific articles could be displayed as independant documents, but also piled as parts of a more general document.

    I also considered the possibility that the summaries of the specialized topics could make the body of the more general document, and maybe the titles of the specialized topics be formatted as <h1>...</h1> when a specific article is displayed on its own, but as <h2>...</h2> when it is part of the more general document.

    How can I implement this ?
    Should I make child documents and use some snippet ? (Ditto ?)

    Do the specific documents need to be childs of the more general document ?

    Thanks to who can help.

      • 10449
      • 956 Posts
      I’d opt for the "folder + child-documents" strategy. There are several snippets/plugins in the repository that basically use splitter-strings inside one big article and create a pagination for each document-part (article.html?page=1 etc.)
      However, personally, I think it leads to problems when you want to restyle / redefine headers, subheaders etc. as you describe. Also, most editors are too fond of using their beloved WYSIWYG, and chances are they’re gonna mess up some of these special tags sooner or later.

      With Ditto, you could create a template-chunk for each article-type. For headers and sub-headers you’d ideally use the standard [+pagetitle+] [+longtitle+] [+description+] fields and just wrap them in whatever HTML-tag you like. A page showing the entire article on one page, would include a Ditto call similar to this:
      [!Ditto? &parents=`45` &tpl=`fullArticle` &sortBy=`menuindex` &sortDir=`ASC` &total=`99`!]
      - 45 being the container here. The fullArticle chunk would just use something like:

      <h2>[+pagetitle+]</h2>
      [+content+]
      


      You can use this handy snippet to create automatic prev/next navigation: http://modxcms.com/DocLink-2245.html

      If you’re going to create a PDF for the full article, you could create a template variable (TV) for the PDF-download-link and store that in the container instead.

      Other helper snippets might be GetField + FirstChildRedirect.
        • 15001
        • 697 Posts
        Thanks a lot for your detailed answer.
        It’s a big help for me as I currently only have experience of Wayfinder and not Ditto.
        I’ll try.