Opened 3 months ago
Last modified 3 months ago
#36304 assigned Cleanup/optimization
Classes functions (etc) should have a header in the documentation
Reported by: | Sarah Boyce | Owned by: | Ahmed Nassar |
---|---|---|---|
Component: | Documentation | Version: | 5.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Currently, the docs are slightly inconsistent whether classes/functions have their own header or not.
For example:
- https://docs.djangoproject.com/en/5.2/ref/utils/ lacks headers for many functions e.g. https://docs.djangoproject.com/en/5.2/ref/utils/#django.utils.cache.patch_cache_control
- https://docs.djangoproject.com/en/5.2/ref/models/fields/ has generous headers
Following a conversation on the forum, being generous with headers is preferable because:
- it improves the table of contents to make it easier to navigate the page for all users
- the page is more accessible to screen reader users as they can navigate via headers
- (minor) the djangoproject.com docs search checks the table of contents when ranking search results (so adding headers improves the search results)
The discussion is here: https://forum.djangoproject.com/t/set-toc-object-entries-true-to-auto-add-functions-classes-to-the-pages-table-of-contents/38902/7
I propose we update our documentation guide to include adding a "duplicate" header above class or function definitions: https://docs.djangoproject.com/en/5.2/internals/contributing/writing-documentation/#guidelines-for-restructuredtext-files
Change History (8)
comment:1 by , 3 months ago
Description: | modified (diff) |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 3 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:3 by , 3 months ago
Has patch: | set |
---|
comment:4 by , 3 months ago
Patch needs improvement: | set |
---|
comment:5 by , 3 months ago
Patch needs improvement: | unset |
---|
comment:6 by , 3 months ago
Patch needs improvement: | set |
---|
comment:7 by , 3 months ago
Patch needs improvement: | unset |
---|
comment:8 by , 3 months ago
Patch needs improvement: | set |
---|
I think this makes sense and it aligns with the conversation in the forum post.