Search code examples
mediawikitransclusion

How to query/limit a transclusion when including the talk page?


As the tag implies, I am using MediaWiki as wiki-software. I would like to include the talk page/discussion into the page the talk/discussion is about.

I figured out how to include the talk page as a whole already doing something like this fo example (don't bother with the German notation): {{Diskussion:Test}} which add the talk page of the article Test.

The next step would be to limit the output to e.g. the 5 most recent talk "posts" (they are rather gouped under 2nd-grade headlines, I presume). Insertin of special pages can be limited by using additional parameters like so: {{Special:RecentChanges/days=5,limit=40}} as mentioned in MediaWiki help articles. However, these parameters obviously don't work when including the talk page because it is a single page/element. {{Diskussion:Test/days=5,limit=40}} is not even parsed.

Any hints and examples ae appreciated, although I prefer not to use extensions IF POSSIBLE.


Solution

  • The usual way to do this is to edit [[Diskussion:Test]] by adding appropriate noinclude (or onlyinclude) tags:

    <noinclude>
    blabla
    </noinclude>
    == The ==
    ...
    == sections ==
    ...
    == I ==
    ...
    == want==
    ...
    == transcluded ==
    ...
    

    Now {{Diskussion:Test}} won't transclude the older stuff. This is the cleanest solution but might be tedious to do on many pages: you could automate this with a bot.

    There are countless on-wiki solutions possible, for instance you could transclude everything and then use JavaScript to hide "excess" sections; or you could wrap all talk page discussions in a template, which then shows only the latest X when transcluded in subject namespace.

    As for "proper" solutions, perhaps you're looking for a discussion extension. If you're brave you could test LiquidThreads, add threads directly on the page (rather than talk) and set up autoarchiving as you wish.