mediawikimediawiki-templatessemantic-mediawiki

Rename hyperlinks in query result in Semantic MediaWiki


Here is my query

 {{#ask: [[Category:Pages]]
   |mainlabel = Link
   |? volume = Volume
   |? page = Volume page
   |? title = Title
   |limit = 3
 }}

The result table is like (screenshot)

Link            Volume    Volume page    Title
HPB-SB-1-1      1         1              Article A
HPB-SB-1-10     1         10             Article B
HPB-SB-1-100    1         100            Article C

Where each cell in Link column is actually a hyperlink leading to the corresponding page. What I need to do is somehow rename the cells in Link column to still be hyperlinks but have name of ones from Title column. So the result table become:

Link            Volume    Volume page 
Article A       1         1        
Article B       1         10        
Article C       1         100         

Does anyone knows how can this be achieved with Semantic Mediawiki? Thanks in advance!


Solution

  • You want to use template format:

    {|
    ! Link !! Volume !! Volume page
    {{#ask: [[Category:Pages]]
       |mainlabel = Link
       |? volume = Volume
       |? page = Volume page
       |? title = Title
       |limit = 3
       |format = template
       |template = table_row
     }}
    |}
    

    where Template:table_row is:

    {{!}}-
    {{!}} [{{{1}}}} {{{4}}}] {{!}}{{!}} {{{2}}} {{!}}{{!}} {{{3}}}