Search code examples
semantic-mediawiki

How to query and display a common section of text across a category?


We have SMW installed for our internal wiki at work. There is a category called "X" which has "A", "B" and "C" pages with a section in each of those pages called "Contact".

Question: How do I write a query that displays this contact section from each of the pages that belong to "X" category?

I've already..

I read up Help:Selecting pages and was able to list all pages under X category from Special:Ask page.

Thanks for the help!


Solution

  • First of all you need to define a property of type text - you can do that with help of the page Special:CreateProperty.

    Then in each page of category "X" you need to assign the "contact" text to that property - like this:

    [[YourPropertyName::contact text]]
    

    Then on the page where you want to output all the contact text you can do something like

    {{#ask:[[YourPropertyName::+]]}}