Page MenuHomePhabricator

VisualEditor: Provide some kind of template suggestion in the transclusion editor
Closed, ResolvedPublicFeature

Description

Adam Cuerden says, "I believe the VE team intends to have a some one click solutions in the near future, including adding templates of your choice to a bar? Although I'd hope there'd also be a few automatic lists you could choose to pull up - cleanup templates, etc."

So, it would be really comfy for users if the template editor, beyond being able to let them select what they need by typing the name, asked "Which kind of template do you want to add?" and provided lists of the most used/popular ones, divided per set (cleanup templates, citation templates and so on).
Or just a way to store one's most used choices.
Thanks.


Version: unspecified
Severity: enhancement
See Also:
T52458: VisualEditor: Improvements to reference editing, including local wiki-specific workflows

Details

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

I suggest that per Amire80, cross-wiki templates be made a blocker bug for this feature.

It's just too much widely duplicated work to do otherwise.

Mmm... I don't know if it's a blocker, but it is quite desirable.

@James_F, is this something a gadget could easily achieve?

@James_F, is this something a gadget could easily achieve?

It could, but I'd rather avoid people adding new things to the toolbar ad hoc. We really need a design for this that can scale.

Change 510943 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Allow popular templates to be listed in the template dialog

https://gerrit.wikimedia.org/r/510943

When we click in the insert template button we get a white pop-up where we must figure out what the correct template is. In Basque wikipedia we are using a reduced automatic templates system, so it would be very useful to have them listed just below, so you can click them and choose.

Most useful infoboxes:

  • {{biografia infotaula automatikoa}}
  • {{artelan infotaula automatikoa}} < for artworks
  • {{Eraikin infotaula automatikoa}} < buildings
  • {{Hiri orokor infotaula}} < cities
  • {{Probintzia orokor infotaula}} < administrative units up from cities
  • {{taxotaula automatikoa}} < taxobox

I think for a first pass on this we can allow wikis to define a list of most common templates on wiki, e.g.

MediaWiki:Template-directory.json
[
  "Biografia infotaula automatikoa",
  ...
]

This could then be fetched by the template dialog and show in the space below the search input:

image.png (508×516 px, 32 KB)

In the future we would probably want to make this more flexible, such as by grouping templates together, e.g.

MediaWiki:Template-directory.json
[
  {
    "group": "Infoboxes",
    "templates": [
      "Biografia infotaula automatikoa",
      ...
    ]
  }
]

which would necessitate a slightly more complex UI.

I think the first one would work.

For anyone interested working on this, the code would go in ve.ui.MWTemplatePlaceholderPage, and would need to do the following:

  1. Fetch the JSON data for the local wiki using mw.message, see ve.ui.Citoid.init.js for an example of this.
  2. Get the template descriptions for the listed templates using the API, see the request that the search box uses
  3. Append a list of mw.widgets.TitleOptionWidgets to the page

I'll give my eternal reconnaissance as a community member to whoever achieves that task. This is something we miss since a while on French Wikipedia.

Also, that task is probably a duplicate of T96710: Per-wiki customizable drop down menu for templates.

@Trizek-WMF it is similar, but this would be adding the most usual ones, as we are working with 6 automated templates that are highly used.

I think T96710 is asking for a similar feature, but adding buttons to the toolbar, not the template dialog.

Trizek-WMF moved this task from To Triage to Not ready to announce on the User-notice board.

@Whatamidoing-WMF tells me that English Wikivoyage would be a good candidate for a potential test: "they have 6 templates they use all the time". I think French Wikipedia would be a good candidate too.

Here's how it looks on my local install:

image.png (521×524 px, 46 KB)

That's the list of most popular (aka most used templates), right?

That's the list of most popular (aka most used templates), right?

No, it will be a community-curated list, defined on-wiki in a JSON message file. Otherwise you'd probably end up with useless crap like {{!}}.

This development looks good as a step forward. It's certainly better to have a cross-wiki uniform way for listing community curated things, than having local hacks on wikis.

It shouldn't be a permanent solution, however. Some problems with it that need a deeper solution. For example, "Cite" has its own whole first-class button, and all the other templates will be hidden in this new list behind Insert -> Template, even though many templates are as useful and common as Cite is. There is no good reason for this differentiation. Many templates could be first-class features like "Cite", although global templates should probably implemented first.

But still, it's a step in the right direction.

I think curating locally is a good step, as different Wikipedias have different customs on this. Basque Wikipedia, for example, has 6 main templates that would cover around 80% of articles (statistics invented now)

There is no good reason for this differentiation. Many templates could be first-class features like "Cite", although global templates should probably implemented first.

I think the distinction at the moment is that the Cite tools relate to extension functionality defined in the code, specifically templates wrapped in a <ref>, and the Citoid tool allows automatic population of those templates.

"Suggested templates" on the other hand are 100% defined on-wiki: the names of the templates to use, the implementation of the templates, and the metadata, so I think it's appropriate to think about these differently.

That said there are certainly cases on a wiki by wiki basis where it would make sense to promote certain templates to the toolbar, and that is covered by T96710.

There is no good reason for this differentiation. Many templates could be first-class features like "Cite", although global templates should probably implemented first.

I think the distinction at the moment is that the Cite tools relate to extension functionality defined in the code, specifically templates wrapped in a <ref>, and the Citoid tool allows automatic population of those templates.

Um... A lot of it actually is defined locally on the wiki and won't work without non-trivial JSON configuration that maps it to local templates.

My theory is that Cite got its own button because the English Wikipedia community, unlike most others, enforces citations very strongly, and new citations are needed in new edits all the time. Infoboxes are very common, but unlike citations they are usually inserted only once when the article is created, and VE is for some reason perceived more as a page editing tool than a page creation tool. (I don't perceive it as such, and I use VE for creating pages whenever I can, but my impression is that a lot of people don't think of VE as a page creation tool.)

"Suggested templates" on the other hand are 100% defined on-wiki: the names of the templates to use, the implementation of the templates, and the metadata, so I think it's appropriate to think about these differently.

Sure, but please do keep in mind that some day, better earlier than later, at least some templates should become global. When this finally happens, we can probably also have global JSON configuration for popular templates.

Um... A lot of it actually is defined locally on the wiki and won't work without non-trivial JSON configuration that maps it to local templates.

Yes, I'm comparing them to templates that are 100% defined on wiki.

Infoboxes are very common, but unlike citations they are usually inserted only once when the article is created

Yes, so as an editing tool, no particular template comes close to cite in terms of frequency of use (although I'm sure there are wiki-by-wiki examples where this is the case).

and VE is for some reason perceived more as a page editing tool than a page creation tool

I don't see it this way either, but edits >> creations.

I think this conversation belongs on T96710.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:13 AM
Aklapper removed a subscriber: rmoen.

The infobox could be suggested based on some categories of the article, specifically or generally, for example writer or just biography.

CommTech is planning to address some of this with Favorite Templates

T209797 requests a specific subset of this, in a specific format, as part of semi-automated tool interfaces, for wikisource as well as VE.

It seems like there are three ideas in this task:

  1. A way for individual users to choose and save a list of templates. This is T367428: [EPIC] Favoriting Templates and is nearly ready for initial deployments.
  2. "Automatic lists you could choose to pull up"
    • The above discussion is lots about storing "suggested templates" in MediaWiki:Template-directory.json and that seems now to be the main work in this task. This config could perhaps now be handled via MediaWiki-extensions-CommunityConfiguration.
    • A more generic solution could be to use existing template categorization, surfaced either by integrating them into the search (T392245) or with a hierarchical browsing interface (T392553).
  3. Quick access to "most used" or "popular" templates. This is captured I think in the following two tasks:

The more specific use case of having quick access to a small set of citation templates could probably fall under the category search or browse tasks.

I think this task could perhaps be re-written to focus on the Template-directory.json functionality, or closed in preference to the various other tasks that are tracking all the bits and pieces.

The tab bar could be home to a bunch of them, e.g.:

image.png (176×732 px, 23 KB)

Cparle claimed this task.
Cparle subscribed.

I created T392896: Add a community-configurable list of "useful templates" to a tab in the template picker to cover the first bullet point under number 2 in the previous comment, so now I think all the ideas contained in this ticket are covered elsewhere. Closing in favour of the more detailed tickets

Test wiki on Patch demo by ESanders (WMF) using patch(es) linked to this task was deleted:

https://patchdemo-legacy.wmcloud.org/wikis/98c44ac3c7/w/