Page MenuHomePhabricator

TemplateData doesn't propagate to the template when transcuded from a non-template namespace
Closed, InvalidPublic8 Estimated Story Points

Description

Things that work:

  • Using <templatedata> directly on the template (Template:Example).
  • Using <templatedata> on a subpage of the template (Template:Example/doc) which is transcluded inside the template

Thing that doesn't work:

  • Using <templatedata> on a page on a different namespace than the template (Template Documentation:Example) which is transcluded inside the template.

On our wiki we use the LinkSuggest extension, and it's handy to autocomplete template names, but then the template documentation pages (that we historically maintained on a subpage of the template and transcluded inside the template) were appearing as suggestions, polluting the results specially when several templates with a common preffix were being requested.

I had the idea of creating a custom namespace and move all the documentation pages to the new namespace, updating the transclusion of the documentation to point to that namespace instead. However, now I find that TemplateData information is not available from the template, while it is for the documentation page.

You can see the problem here with the api query, on the custom namespace where the documentation (and template data) resides: https://www.wikidex.net/api.php?action=templatedata&titles=Documentaci%C3%B3n%20de%20plantilla:Personaje&format=jsonfm

While it displays nothing on the template itself: https://www.wikidex.net/api.php?action=templatedata&titles=Plantilla:Personaje&format=jsonfm

This is working when transcluding from the subpage: https://test.wikidex.net/api.php?action=templatedata&titles=Plantilla:Personaje&format=jsonfm

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Deskana set the point value for this task to 8.
Deskana moved this task from To Triage to Freezer on the VisualEditor board.

Theoretically, you should be able to transclude TemplateData from any namespace.

The most common problem with non-transcluded TemplateData is the job queue. Have you done a null edit on the template?

Whoops! Maybe the job queue wasn't cleared when I tested it (although I let some minutes before reporting it, and also had time to add it on the test wiki to check!). I've done a null edit and it displays the template data correctly from the api and from Visual Editor. Thanks for the tip!