0

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)?

Revious
  • 7,816
  • 31
  • 98
  • 147

1 Answers1

2

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.

Revious
  • 7,816
  • 31
  • 98
  • 147
IRA1777
  • 593
  • 3
  • 11
  • thanks for the answer, I've tried to create a template called SemanticLink, https://www.tematichedigenere.com/wiki/Template:SemanticLink but it doesn't work correctly with the link. It renders: [ewew {Template:Title] - pinco – Revious Aug 15 '22 at 12:09
  • This is my usage attempt of the template: https://www.tematichedigenere.com/wiki/Tutti_gli_articoli_di_Marco_Crepaldi – Revious Aug 15 '22 at 12:10
  • 1
    I modified your template, you missed a "}" after "title" parameter, and you should add the "includeonly" tag. – IRA1777 Aug 15 '22 at 20:57