Skip to content

Docs: module pages should not link to themselves#144505

Open
nedbat wants to merge 2 commits intopython:mainfrom
nedbat:nedbat/no-module-self-link
Open

Docs: module pages should not link to themselves#144505
nedbat wants to merge 2 commits intopython:mainfrom
nedbat:nedbat/no-module-self-link

Conversation

@nedbat
Copy link
Member

@nedbat nedbat commented Feb 5, 2026

The style guide says that sections should not link to themselves, since it is a pointless distraction. This updates module pages to remove links to themselves.

Done automatically with https://github.com/nedbat/odds/blob/master/rstwork/unlink-mod.py

Updated: relevant style guide section: https://devguide.python.org/documentation/style-guide/#links


📚 Documentation preview 📚: https://cpython-previews--144505.org.readthedocs.build/

@nedbat
Copy link
Member Author

nedbat commented Feb 5, 2026

(sorry for the pings)

@giampaolo giampaolo removed their request for review February 5, 2026 13:49
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for ssl/hashlib

@serhiy-storchaka
Copy link
Member

This is quite a churn.

I don't think that it is so bad for module links, because the module documentation is usually much larger than a section, so the link usually leads beyond the screen. It is also possible to have documentation for several modules in the same file -- in that case links are useful, because they allow to find the start of the module documentation. When you read the documentation, its organization (several modules in one file or each module in a separate file) should not bother you -- links should work the same way. Even if you have a single module per file, clicking a link can be more convenient than scrolling to the beginning.

@nedbat
Copy link
Member Author

nedbat commented Feb 5, 2026

I don't think that it is so bad for module links, because the module documentation is usually much larger than a section, so the link usually leads beyond the screen. It is also possible to have documentation for several modules in the same file -- in that case links are useful, because they allow to find the start of the module documentation. When you read the documentation, its organization (several modules in one file or each module in a separate file) should not bother you -- links should work the same way. Even if you have a single module per file, clicking a link can be

My problem with links to the same page is that they fool you into thinking they will take you to a new place about the module, but they don't, you are back where you started. If I want to read the beginning of the page, I know what to do: I scroll to the top of the page. Links should help the reader. Linking to the same page isn't something readers need.

@serhiy-storchaka
Copy link
Member

I think that links at the beginning of the module documentation, in its preamble, should be avoided, but links in the documentation of its components should be kept. You may not even be aware that the link refers to the same page. You could read the documentation for foo(), then jumped to the documentation for bar() (in the baz module), which contains a link to the module, -- and at that moment you man not figure that it is the same module, because you did not start reading it from start.

@nedbat
Copy link
Member Author

nedbat commented Feb 5, 2026

You may not even be aware that the link refers to the same page. You could read the documentation for foo(), then jumped to the documentation for bar() (in the baz module), which contains a link to the module

I think a self-link is even worse if the reader is unware that it's a self-link. That just adds to the disappointing surprise of being on the same page.

These changes only remove links when they are to the module named in the first line of the file. You've mentioned two-module pages a few times: are there examples like that in this PR? I'd like to understand it better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants