Topic on Help talk:TemplateData

TemplateData in user space?

9
Summary last edited by ExE Boss 00:33, 5 November 2021 2 years ago
Vexations (talkcontribs)

I've tried to add TemplateData to a template in my user space, but couldn't get it to work. To make sure the problem wasn't with my template, I copied an existing one that worked on enwp {{0}}, and found that it stopped working when I tried to place the TemplateData in User:username/templates/template/doc. Does TemplateData only work in the Template namespace? Thanks, ~~~~

ExE Boss (talkcontribs)

Note that you also need to transclude the documentation subpage into the User template page for it to work, e.g.: {{m:User:ExE Boss/OtherProjects}}.

Vexations (talkcontribs)

Thanks, yes, that's a good point, but I think I had that right: immediately at the end the last line of the template, I called had the documentation template embedded in a noinclude tag. The working template that I copied also did that, but stopped working in user space.

ExE Boss (talkcontribs)

Right, I forgot to mention, that you also need to perform a null edit/hard purge of the User template page, in order to properly update the templatedata page property (the TemplateData  extension does this automatically in the Template namespace when editing the doc[1] subpage).

References

Jonesey95 (talkcontribs)

It is always helpful to link to an example page when you are asking for technical help.

Vexations (talkcontribs)

Thanks for helping everyone! It's fairly easy to reproduce: Copy the 0 template (I just chose that because its one of the first in the list of templates that use TemplateData) and its doc subpage to your userspace. Now try to edit your sandbox with the Visual Editor and add the 0 template. My version that demonstrates the problem is at en:User:Vexations/templates/PB

Tacsipacsi (talkcontribs)

It doesn’t work in VisualEditor indeed, but it seems to be a bug in VE, not TemplateData: when I open your user subpage’s talk page in VisualEditor and try to insert the user subpage, no TemplateData is provided (and not even the title is visible in the autocomplete for the template name), while if I use the wikitext editor’s template inserter , it works perfectly.

Whatamidoing (WMF) (talkcontribs)

Pinging @Johanna Strodt (WMDE), because this is probably not related to WMDE's work on templates in VisualEditor, but it might be useful to know about anyway.

Johanna Strodt (WMDE) (talkcontribs)
Reply to "TemplateData in user space?"