Skip to content

Document the is_index property of page objects #3886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IreneKnapp
Copy link

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
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
Collaborator

@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.

@@ -124,6 +124,7 @@ def active(self, value: bool):

@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
Collaborator

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
Collaborator

@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

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