Page MenuHomePhabricator

Disambiguation pages with empty string summary don't generate the correct Page Previews snippets
Closed, ResolvedPublicBUG REPORT

Description

This has been reported on itwiki, but it seems to happen on all wikis.

Unlike enwiki, some wikis often use disambiguation pages with no lead section, making use of a template instead.
When this happens, a Page Previews snippet is not generated, displaying the generic "There was an issue displaying this preview".
This is probably due to previews only being generated if a lead section exists.

For disambiguation pages we already use a custom card, and I think that if a page is a disambiguation page we should still show the disambiguation custom card, regardless of the lead section.

List of steps to reproduce:

What happens?:

  • "Se" displays "This title relates to more than one page";
  • "Capricci" displays "There was an issue displaying this preview".

What should have happened instead?:

  • Both should display the custom disambiguation card "This title relates to more than one page".

1.png (180×410 px, 17 KB)

2.png (156×416 px, 17 KB)

Event Timeline

https://it.wikipedia.org/w/index.php?title=Se&action=edit has an intro section line: '''Se''', '''Sè''' o '''Sé''' possono riferirsi a:
https://it.wikipedia.org/w/index.php?title=Capricci&action=edit does not have such an intro section, it starts directly with a heading.
I'm afraid this is the reason. Whether it makes sense is a different question. :)

See the extracts in https://it.wikipedia.org/api/rest_v1/page/summary/Capricci versus https://it.wikipedia.org/api/rest_v1/page/summary/Se

Jdlrobson subscribed.

Page previews uses the REST API, which uses Extension:Disambiguator. So something is going wrong somewhere in that workflow (likely the latter extension). Are you using the DISAMBIG magic word?

Looking more closely the API does seem to be reporting type "disambiguation" so perhaps there is an error in page previews after all. Not sure what's failing here.

Yes, the __DISAMBIG__ magic word is provided via the Template:Disambigua, used in both pages.
Could it be related to this? It looks like if the extract is empty (i.e., no lead section) it always returns TYPE_GENERIC.

Yes that looks l like that's what's happening,

https://it.wikipedia.org/api/rest_v1/page/summary/Capricci is returning an empty string for extract.
https://github.com/wikimedia/mediawiki-extensions-Popups/blob/master/src/preview/model.js#L155 returns undefined since its an empty string.

I guess that logic is probably incorrect.
As a workaround introducing a paragraph to the top of https://it.wikipedia.org/wiki/Capricci page should rectify the problem.

Jdlrobson renamed this task from Disambiguation pages with no lead section don't generate Page Previews snippets to Disambiguation pages with empty string summary don't generate the correct Page Previews snippets.Feb 4 2022, 10:48 PM
Jdlrobson moved this task from Incoming to Not ready to estimate on the Web-Team-Backlog board.
ovasileva triaged this task as Medium priority.Feb 8 2022, 3:18 PM