## What + Why
Experienced contributors find it cumbersome to have to search for the same templates over and over. Editors tend to work with templates when adding complex content and templates simplify repetitive and nested types of content.
In this epic, we want to help contributors favorite templates so that they can quickly select and insert their favorite templates.
We aim to make it so that editors can easily save and recall templates they commonly use right from either of the main editing interfaces.
## Details
**see a list of favorite templates**
- As a contributor, when I load the template selector, I should see a link to my favorite templates
- As a contributor, when I don't have any favorite templates, I should see an empty state to add favorite templates
- As a contributor, when I have a favorite template, it should be listed in my favorite templates list, and I should see the transclusion data
- As a contributor, I should be able to un-favorite a template from the template selector
**touchpoints for favoriting templates**
- As a contributor, when I am configuring a template in the template selector, I should see a way to favorite this template (or unfavorite)
- As a contributor viewing an article, when I am inspired by the use of a template, I should see a button to view "templates on this page," see a list of templates, and favorite a template from the list
- As a user I want to be able to favourite templates that I use frequently, so that I can recall them easily.
- As a user I want to be able to see all of my favourited templates, so that I can reuse them quickly.
- As a user I want to be able to remove a favourited template if I do not need it anymore, so that I can keep my favourites list tidy.
## Goals
- Improve the rate of articles with templates
- Increase the number of editors adding a template
- most sense would make to track if people use favouriting templates (database query)
- possibly data scientists can check for correlation with template usage after, but it's hard to track
##Research findings / data
- desk research https://www.figma.com/design/QWD6oDEz9NMEnF2ppVc4Xq/Template-recall-and-discovery?node-id=0-1&t=5fa0wrAPMO3MAqrD-1
##Designs
* [[https://www.figma.com/design/QWD6oDEz9NMEnF2ppVc4Xq/Template-recall-and-discovery?node-id=765-5322&t=5fa0wrAPMO3MAqrD-1 | Figma designs]]
##Out of scope:
- we don't think about most used and used in this article for now
- ordering how they are being displayed
- adding sections to favourites list
- we are not showing categories of templates
- we are not highlighting recently searched templates
##Related Conversations:
- WMF Slack channel for staff: [[ https://wikimedia.enterprise.slack.com/archives/C05TQCG242F | #favourite-templates ]]
##General Implementation:
- A new OOUI widget in #TemplateData that will be used in #TemplateWizard and #VisualEditor.
- Search behaviour will be Cirrus search (if it's installed) and fall back to prefix search.
##Discussion Notes:
- we currently track from template wizard when templates are being inserted
- user preferences are available in superset already, first time someone introduces a favourite can be found
- more work needs to be done to determine what metrics should be tracked; we suspect that much of what we need will be available by simply querying saved preferences
##Resources:
- [[ https://docs.google.com/document/d/1Y5BgMpGOGSso8WF-UdwuGdWBPUbdUj8ximfYgwYH-Bg/edit?tab=t.0 | Technical Design doc ]] (to be copied to MediaWiki.org)
##Notes:
- Favo(u)rite is spelt `favorite` in the code! ([[ https://docs.google.com/document/d/1Y5BgMpGOGSso8WF-UdwuGdWBPUbdUj8ximfYgwYH-Bg/edit?tab=t.0#bookmark=id.q5vejarb6rge | decision ]])
- Feature flag will be in TemplateData and be `$wgTemplateDataFavoriteTemplates = false`
- Favourited templates are saved as page IDs in a JSON array in `user_properties` with the key `templatedata-favorite-templates` ([[ https://docs.google.com/document/d/1Y5BgMpGOGSso8WF-UdwuGdWBPUbdUj8ximfYgwYH-Bg/edit?tab=t.0#bookmark=id.13blm2m8p7wn | decision ]])
- Maximum favourited templates is `50` (for now) ([[ https://docs.google.com/document/d/1Y5BgMpGOGSso8WF-UdwuGdWBPUbdUj8ximfYgwYH-Bg/edit?tab=t.0#bookmark=id.13blm2m8p7wn | decision ]])