Page MenuHomePhabricator

[sub task] Show table of contents for pages with less than 4 sections
Closed, ResolvedPublic

Description

Description

In Legacy Vector the table of contents is automatically hidden on pages with less than 4 sections. There is not much documentation regarding the reasoning behind this decision. From Help:Section:

For each page with at least four headings, a table of contents (TOC) is automatically generated from the section headings unless...

(The conversation on Help talk:Section unfortunately hasn't yielded much yet)

While on some (maybe most) pages with less than 4 sections the table of contents might not add much value, on some pages it will. Additionally by showing it we get the benefit of a consistent layout for all article pages. This will remove any confusion regarding why it's shown on some pages and not on others, as well as prevent the page content from shifting when switching from a page with a table of contents to a page without one (or vice versa).

Demo

Here are a few examples of articles with less than 4 sections, with the table of contents showing:

3 sections
https://di-collapsible-menus.web.app/Johnny_Miqueiro
https://di-collapsible-menus.web.app/Hurkett
https://di-collapsible-menus.web.app/Polycystine

2 sections
https://di-collapsible-menus.web.app/Yusuke_Yachi
https://di-collapsible-menus.web.app/Henning_Elbirk
https://di-collapsible-menus.web.app/Norway_Ski_Club

1 section
https://di-collapsible-menus.web.app/Rhytiphora_vicaria
https://di-collapsible-menus.web.app/Hecyra_marmorata
https://di-collapsible-menus.web.app/Freedom_List

This is a prototype but hopefully close enough to the real thing for us to get a sense. What do people think?

QA

Find an article with < 4 sections

  • Confirm in Vector 2022 there is a table of contents
  • Confirm in Vector there isn't a table of contents

Event Timeline

We would need to work with the content transform team on this one.
Would we do it for all skins or just the new Vector 2022 skin?

Jdlrobson set the point value for this task to 1.Sep 29 2022, 5:30 PM

This will actually be fixed by T315862 based on how I'm currently planning to fix this. Not sure if we want to merge the tickets?

Change 831143 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Skin: Table of contents is set for pages with < 4 sections

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

Change 831143 merged by jenkins-bot:

[mediawiki/core@master] Skin: Table of contents is set for pages with < 4 sections

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

Jdlrobson renamed this task from [Table of contents] Show table of contents for pages with less than 4 sections to [sub task] Show table of contents for pages with less than 4 sections.Feb 17 2023, 6:50 PM
Jdlrobson assigned this task to Edtadros.
Jdlrobson removed the point value for this task.

Change 901690 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] Add ParserOutputFlags::NO_TOC

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