Page MenuHomePhabricator

?action=info should have a Table of Contents
Closed, ResolvedPublicFeature

Description

Feature summary
Page analysis by action=info should have a table of contents at the top when there are enough sections to warrant it. This could also be helpful on Special:Version.

Use case(s)
Visit "Page information" for any page to validate information for the page.

Benefits
Meanwhile many of the resulting pages became rather long.

  • It does need some scrolling to reach the bottom.
  • This is not good for mobile devices.
  • It is even worse for accessibility.

Challenge
The TOC is not static.

  • LINT errors may occur and trigger an additional section.
  • If a page does not exist, there is a pageinfo but no history section.
  • Further issues might occur in future.
  • Site generated content might provide headlines, as in pageinfo-footer (example) or even pageinfo-header and could depend upon namespace, page existence etc.

A dynamic <h2> collection mechanism, grabbing the id= already present is required. Look for id="Logb.C3.BCcher" here.

Event Timeline

Another thing that is missing in the task desc: https://en.wikipedia.org/w/index.php?title=Kazan&action=info has a self-made ToC (generated by https://en.wikipedia.org/wiki/MediaWiki:Pageinfo-header). Other wikis might’ve copied this. This would also cease to be needed if this was implemented.

Recently German Wikipedia introduced a static TOC as temporary solution:

Dynamic sections like LINT are not addressed.

  • Sections depending on page existence can be omitted easily.

I think this would be an approachable task for a new contributor.

We already have three special pages with a table of contents, which can serve as examples to follow:

A similar implementation needs to be added here, where the headings for ?action=info are generated:

Thank you for tagging this task with good first task for Wikimedia newcomers!

Newcomers often may not be aware of things that may seem obvious to seasoned contributors, so please take a moment to reflect on how this task might look to somebody who has never contributed to Wikimedia projects.

A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor, for example it should clearly pointed to the codebase URL and provide clear steps to help a contributor get setup for success. We've included some guidelines at https://phabricator.wikimedia.org/tag/good_first_task/ !

Thank you for helping us drive new contributions to our projects <3

@KSruthi-Vel you can write down a line Bug: T363726 in the commit message instead so that a bot announces both the upload and the merge of this patch. You don’t need to announce that yourself.

Change #1121751 had a related patch set uploaded (by Aklapper; author: Krishna-sruthi):

[mediawiki/core@master] Add collapsible Table of Contents (TOC) to Special:PageInfo

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

Apologies for the oversight, and I appreciate the guidance. I see that @Aklapper has already made the necessary change—thank you!

Change #1121751 abandoned by Bartosz Dziewoński:

[mediawiki/core@master] Add collapsible Table of Contents (TOC) to Special:PageInfo

Reason:

Patch author has gone away. If you want to try again, feel free to restore this patch. Thanks!

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

matmarex removed a project: Patch-For-Review.
matmarex added a subscriber: KSruthi-Vel.

Change #1176761 had a related patch set uploaded (by Addshore; author: Addshore):

[mediawiki/core@master] Add collapsible Table of Contents (TOC) to action=info

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

Change #1177411 had a related patch set uploaded (by Addshore; author: Addshore):

[mediawiki/core@master] Refactor TOC generation into a trait

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

I read the task description and saw the existing Gerrit changes linked in the task.
I’m going to pull the latest patch locally, test it on ?action=info, and report back with findings or improvements (especially around dynamic sections and stable anchor IDs).
If the current patch needs a follow-up, I can provide one. Thanks!

Update: I’ve implemented the Table of Contents for action=info pages and uploaded a patch to Gerrit.

The TOC is dynamically generated when multiple sections are present, inserted at the top of the page, and avoids duplication. This improves navigation and accessibility on longer Page information views.

Gerrit change:
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1221669/

The patch is now awaiting review. I’m happy to address any feedback or follow-up improvements if needed.

Update: I’ve implemented the Table of Contents for action=info pages and uploaded a patch to Gerrit.

The TOC is dynamically generated when multiple sections are present, inserted at the top of the page, and avoids duplication. This improves navigation and accessibility on longer Page information views.

Gerrit change:
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1221669/

The patch is now awaiting review. I’m happy to address any feedback or follow-up improvements if needed.

Please add the Bug: line like https://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines and my revision to your other patch

Change #1221669 had a related patch set uploaded (by Talhasajid849; author: Talhasajid849):

[mediawiki/core@master] action=info: Add table of contents to page information view

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

Thanks for the note!
I’ve added the Bug: T363726 line to the commit message and uploaded a new patch set.
Please let me know if anything else is needed.

Thanks for the note!
I’ve added the Bug: T363726 line to the commit message and uploaded a new patch set.
Please let me know if anything else is needed.

You will need to address the CI failures. See the comment on your patch from Jenkins Bot.

Thanks! I’ve addressed the CI issues locally and uploaded an updated patchset. I’ll wait for Jenkins and follow up if needed.

The change has been implemented and uploaded to Gerrit:

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1221669

CI is passing and the patch is awaiting final review.

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

[mediawiki/core@master] Factor out TocGeneratorTrait from SpecialVersions

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

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

[mediawiki/core@master] Add collapsible Table of Contents to action=info

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

Change #1176761 abandoned by Addshore:

[mediawiki/core@master] Add collapsible Table of Contents (TOC) to action=info

Reason:

AI replaced by human ;)

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

Change #1177411 abandoned by Addshore:

[mediawiki/core@master] Refactor TOC generation into a trait

Reason:

AI replaced by human ;)

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

Change #1230447 merged by jenkins-bot:

[mediawiki/core@master] Factor out TocGeneratorTrait from SpecialVersion

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

Change #1230448 merged by jenkins-bot:

[mediawiki/core@master] Add collapsible Table of Contents to action=info

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

Change #1221669 abandoned by Bartosz Dziewoński:

[mediawiki/core@master] action=info: Add table of contents to page information view

Reason:

The task has been resolved by another contributor in the meantime. Sorry, and I hope this isn't too discouraging.

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

matmarex assigned this task to cscott.
matmarex removed a project: Patch-For-Review.

Change #1233247 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] InfoAction: Include headings from custom footer in the TOC

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

Change #1233247 merged by jenkins-bot:

[mediawiki/core@master] InfoAction: Include headings from custom footer in the TOC

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

@cscott Yeah, fine, thank you.

Would you please arrange the TOC below site header? We regard the header as introduction section, like on regular pages, followed by TOC, then sections with headlines (example).

Change #1239225 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] InfoAction: Insert page header above the TOC

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

@PerfektesChaos Good point, this patch will do that. We probably overlooked it because the introduction is empty by default.

Change #1239225 merged by jenkins-bot:

[mediawiki/core@master] InfoAction: Insert page header above the TOC

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