RelatedArticles switches between Hogan and Mustache using a mediawiki.template.muhogan module for two templates:
- resources/ext.relatedArticles.cards/card.muhogan
- resources/ext.relatedArticles.cards/cards.muhogan
The templates look like this:
<ul class="ext-related-articles-card-list"> </ul>
and
<li title="{{ title }}" class="ext-related-articles-card"> <div class="ext-related-articles-card-thumb" {{# hasThumbnail }}style="background-image: url( '{{ thumbnailUrl }}' );"{{/ hasThumbnail }}></div> <a href="{{ url }}" aria-hidden="true" tabindex="-1"></a> <div class="ext-related-articles-card-detail"> <h3><a href="{{ url }}">{{ title }}</a></h3> {{# extract }}<p class="ext-related-articles-card-extract">{{ extract }}</p>{{/ extract }} </div> </li>
It is the only extension outside MobileFrontend that uses Hogan templates.
While in future we might want to make these use Mustache, for the short term, we want to avoid shipping copies of both Mustache AND Hogan to end users.
To keep things simple, let's construct the above using jQuery and remove the template dependency altogether. While not ideal, this will simplify things for us as we move Minerva and MobileFrontend off Hogan.
Acceptance criteria
- Use of RelatedArticles templates is dropped in favor of jQuery (conditionals/attr method).
QA steps
All tests should be carried out with an anonymous user in incognito window:
- Confirm related articles do not show up on desktop wikipedia beta clustr: https://en.wikipedia.beta.wmflabs.org/wiki/Related_Articles_2
- COnfirm related articles show on mobile: https://en.m.wikipedia.beta.wmflabs.org/wiki/Related_Articles_2
- Confirm they show on desktop wikivoyage beta cluster: https://en.wikivoyage.beta.wmflabs.org/wiki/Related_test
- Confirm they show on mobile wikivoyage: https://en.m.wikivoyage.beta.wmflabs.org/wiki/Related_test
Sign off steps
- Unstall T219845
QA Results
AC | Status | Details |
1 | ✅ | T219846#5138917 |
2 | ✅ | T219846#5138917 |
3 | ✅ | T219846#5138917 |
4 | ✅ | T219846#5138917 |