Skip to content
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

Blog post drafts with tags show up in tags index #5826

Closed
4 tasks done
trslater opened this issue Aug 10, 2023 · 4 comments
Closed
4 tasks done

Blog post drafts with tags show up in tags index #5826

trslater opened this issue Aug 10, 2023 · 4 comments
Labels
bug Issue reports a bug 🏆 perfect Issue is of outstanding quality resolved Issue is resolved, yet unreleased if open

Comments

@trslater
Copy link

Context

When writing a blog, drafts should be completely hidden from the user, so possible future unfinished work is not revealed prematurely. MkDocs Material blog plugin already prevents drafts from being built by default, and these unbuilt posts are also no included in the blog index or categories list.

Bug description

When using the blog and tags plugins together (as outlined in the docs), draft blog posts with tags are included in the tags index, even when they are not built, leading to revealing unfinished work and broken links.

Related links

Reproduction

example.zip

Steps to reproduce

  1. Build site: mkdocs build
  2. Open index.html from site directory in a browser
  3. Click on "Tags" in the navigation

Browser

No response

Before submitting

@squidfunk
Copy link
Owner

Thanks for reporting! Clearly, that shouldn't happen.

@squidfunk squidfunk added the bug Issue reports a bug label Aug 10, 2023
@squidfunk
Copy link
Owner

Fixed in 15c024c. Thanks for this very concise issue and perfect reproduction, that made fixing this bug a pleasure! The blog plugin will now mark posts that are marked as draft as excluded. The tags plugin will skip excluded pages. Additionally:

  • mkdocs serve, by default, renders drafts, which will also appear in the tags index
  • mkdocs build, by default, excludes drafts, which will now also be excluded from the tags index

This behavior can be changed with the draft and draft_on_serve settings. We're keeping the page in the index if drafts are rendered for consistency. Nonetheless, this issue can be considered resolved.

We're using the new File.inclusion feature, so please make sure that you're on MkDocs 1.5+.

@squidfunk squidfunk added resolved Issue is resolved, yet unreleased if open 🏆 perfect Issue is of outstanding quality labels Aug 10, 2023
@trslater
Copy link
Author

Fixed in 15c024c. Thanks for this very concise issue and perfect reproduction, that made fixing this bug a pleasure! The blog plugin will now mark posts that are marked as draft as excluded. The tags plugin will skip excluded pages. Additionally:

  • mkdocs serve, by default, renders drafts, which will also appear in the tags index
  • mkdocs build, by default, excludes drafts, which will now also be excluded from the tags index

This behavior can be changed with the draft and draft_on_serve settings. We're keeping the page in the index if drafts are rendered for consistency. Nonetheless, this issue can be considered resolved.

We're using the new File.inclusion feature, so please make sure that you're on MkDocs 1.5+.

No problem! Thanks for creating such an awesome theme.

@squidfunk
Copy link
Owner

Released as part of 9.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug 🏆 perfect Issue is of outstanding quality resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants