As a reader, I want to understand when a relevant section is within a search result article, and have the ability to go directly to that section, so that I don’t overlook a relevant search result or have to move through irrelevant sections of a long article after clicking through.
Providing a table of contents for an article in the results list helps readers verify that the relevant content they are looking for is within a large article, and allows them to go directly to that section. This is part of the quickview panel epic https://phabricator.wikimedia.org/T306341
**Note:** this does not include determining the relevance of sections.
Requirements
---
- For an article in results, display that article’s table of contents. Refer to designs:
- [[ https://docs.google.com/presentation/d/1Rz-mOGxtc9f2nRujbdSF3E1Kqwz-kDKxHyJUS95dtPA/edit#slide=id.g124f8134935_0_34 | Design Brief: Special:Search ]]
- [[ https://www.figma.com/file/86M7oLZplSxXKwKJR59mIK/Special%3ASearch-on-Wikipedia?node-id=760%3A8529 | figma designs ]]
- Users can click through on each section title in table of contents to that particular section of the article
- Users see how sections are related to their search query (e.g. highlighting)
- Collapse or scroll if the table of content is too long (like on mobile)
- We track how often section links are used instead of article links - potentially an early indicator of how useful a more complete section topics feature may be
- NTH: if we can associate images with specific sections, we can surface those thumbnails in the table of contents as well
**Design specs**
- [add here]
**Technical notes**
Retrieve sections for a given page via sections property:
https://en.wikipedia.org/w/api.php?action=parse&format=json&page=Pet&prop=sections