Revious
Revious

Reputation: 8146

SemanticMediawiki: embed some property into a piece of text

I've a list of articles that contain: an url, a title, some tags

E.g.

* [https://www.instagram.com/p/CY_t7QhIWTD/ Lo psicologo di base rischia di essere inutile se non ci sono abbastanza fondi stanziati] #psicologia #governo #politica #lavoro
* [https://www.instagram.com/p/CY8s6NQN2jW/ Incontro con Giuseppe Morgante] #dating #stalking #violenza
* [https://www.instagram.com/p/CY6aAarNvBn/ Come la continua lamentela può nascondere un pericolo per il nostro benessere psicologico] #indignazione #psicologia #socialmedia #società

I want to show transform them in a template that shows those information (just they are already shown now) but also hosts the property in a semantic way.

E.g.

{{#subobject:
|url = https://www.instagram.com/p/CXeE2j-NT6s/
|title = Bullismo: proposta una legge in Francia per punirlo penalmente. Si rischia anche il carcere
|@category = bullismo|violenza|leggi|punizioni|+sep=|
}}

How can I associate the first part (visual, human readable) and the second part (semantic)?

Upvotes: 0

Views: 74

Answers (1)

IRA1777
IRA1777

Reputation: 613

You have to use basic mediawiki template parameter mechanism. When you call a template in a page, you passes named parameters, i.e.

 {{MyTemplate | url= http://foo.bar | title= Foo Bar }}

Inside the template, you can access parameters values by calling them :

{{{url}}}

In your case, you may create a template containing something like :

* [{{{url}}} | {{{title}}}] {{#subobject:
|url = {{{url}}}
|title = {{{title}}}
|@category=blabla
}}

Which will both display and store your parameters. Just make sure to correctly manage line breaks when calling multiple templates in the same page.

Extra tip : remove all unnecessary spaces in the subobject's @category= part, as otherwise, in most versions, it fails to register categories.

Upvotes: 2

Related Questions