Help:Add page metadata properties to a page (using ED)

From semantic-mediawiki.org
Semantic extension(s):  -/-
Further extension(s): External Data
Keyword(s):  -/-

Description:

We lookup data for this page in the MW API. This data is sucked up by ED:

{{#get_web_data:
url={{SERVER}}/w/api.php?action=query&titles={{PAGENAME}}&prop=info&format=json
 |format=JSON
 |data=c=counter,l=length,x=y
}}

and can be printed (or stored using SMW):

* The view count for this page is: {{#external_value:c}} views.
* The length of this page is: {{#external_value:l}}b


See the MediaWiki API to find what data you can query. In particular: http://www.mediawiki.org/wiki/API:Properties

Wrap the results in SMW variables or SIO objects (see the ED page and add it here)...


Code example[edit]

{{#get_web_data:
url={{SERVER}}/w/api.php?action=query&titles={{PAGENAME}}&prop=info&format=json
 |format=JSON
 |data=c=counter,l=length,x=y
}}
  • The view count for this page is: {{#external_value:c}} views.
  • The length of this page is: {{#external_value:l}}b


For another example, see: http://seqanswers.com/wiki/Template:Add_page_metadata