Skip to content

Document the is_index property of page objects#3886

Open
IreneKnapp wants to merge 1 commit intomkdocs:masterfrom
IreneKnapp:master
Open

Document the is_index property of page objects#3886
IreneKnapp wants to merge 1 commit intomkdocs:masterfrom
IreneKnapp:master

Conversation

@IreneKnapp
Copy link
Copy Markdown

I was told on #3882 that this is likely to be a stable interface and that there's no reason it shouldn't be documented as such, so I'm submitting this PR to do that.

Thanks in advance!

I was told on mkdocs#3882 that this is
likely to be a stable interface and that there's no reason it shouldn't
be documented as such, so I'm submitting this PR to do that.

Thanks in advance!
@IreneKnapp
Copy link
Copy Markdown
Author

apologies for the force-pushes, I inadvertently included my NixOS packaging of the various mkdocs plugins as part of the original commit

Copy link
Copy Markdown
Contributor

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

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

No worries, and thanks! Just one comment.

Comment thread mkdocs/structure/pages.py

@property
def is_index(self) -> bool:
"""When `True`, indicates that this page is an index page, in the sense that it gets sorted to the beginning of the list of its siblings because its filename was `index.md` or something similar."""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Feels a bit long for a summary.

Suggested change
"""When `True`, indicates that this page is an index page, in the sense that it gets sorted to the beginning of the list of its siblings because its filename was `index.md` or something similar."""
"""When `True`, indicates that this page is an index page.
Index pages get sorted to the beginning of the list of their siblings
because their filename is `index.md` or `README.md`.
"""

Actually not entirely sure about README.md. I think @tomchristie would be able to confirm (and maybe rephrase to something better).

Copy link
Copy Markdown
Contributor

@pawamoy pawamoy Dec 24, 2024

Choose a reason for hiding this comment

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

Maybe we could just drop "or README.md".

@reteps
Copy link
Copy Markdown

reteps commented Feb 14, 2025

Unrelated, but is_index currently could have improved handling. See squidfunk/mkdocs-material#7561

For example,

- Instructor Guide:
  - 'Assessment configuration': 'assessment/index.md'

treats "Assessment configuration" as an index page.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants