mediawikimediawiki-apisemantic-mediawiki

Formatting query result of Url as given string in Semantic MediaWiki


I want to embed the result of an ask query on a page in Semantic MediaWiki. The result column has the type Url as in [[Has type:Url]]. However, when embedding the code I would like to show the URL not explicitly since it is very long but as a fixed string (e.g. "Website" )as I would have typed: [https://someURL.com Website]

I tried to set the name on the page in the property assignment itself by including:

[[Has website::https://someURL.com | Website]]

This is the basic structure of an example query.

{{#ask: [[Has website_example::true]]
 |?Has website
 |format=table
 |limit=50 |offset=0
 |link=all
 |sort=
 |order=asc
 |headers=show
 |searchlabel=... further results
 |class=sortable wikitable smwtable
}}

Is it possible to render the ?Has website as a link with the text "Website" in the table?


Solution

  • You may be have to pass through a 'template' format, and reconstruct your rows based on this template.

    Example :

    |-
    ! [{{{1}}} | Website]
    

    then just surround your 'ask' request by table headers and footers.