You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to set the default authors for blog posts via the meta plugin according to the docs, the authors do not actually show up on the blog posts. Non-blog metadata configured via the meta plugin (such as tags) will show up, so properties from the meta plugin are being applied to the file, but seemingly blog data is not.
This can be worked around by manually copy/pasting the meta contents into the frontmatter of each post.
Another user is encountering the same issue but did not provide a reproduction for it. Based on the git history of the repo they linked, they are still encountering the issue / have not yet removed their workaround for the issue.
Build the site with mkdocs build or serve it with mkdocs serve
Navigate to the blog index. Observe that the post with the author explicitly set shows an author, but the post which should be using the author from the meta does not have an author shown.
Navigate to the post without an author shown, and observe that there is a "Blog" tag shown at the top, showing that the meta file which should be configuring the author is applying to this file.
Thanks for reporting and providing the excellent reproduction. It made tracking down the root cause and solving further problems along the way straight forward. Fixed in 3ac702d. The problem:
The meta plugin collects meta files in on_files and then applies metadata in on_page_markdown, which is the first stage at which metadata is available. The problem is that for the blog plugin, this is too late, because the metadata of blog posts must be resolved in on_files before navigation is built, because we must remove files that are considered posts (i.e. hosted in the post_dir) as posts from navigation + we need to generate pages (archive, category indexes, pagination, etc.) in order to mount them at the correct position in the navigation. Getting the ordering with all of those constraints right is tricky, as one can see.
The commit fixes the following things:
Correctly apply meta data of meta files to blog posts (as reported in OP)
Deduplicate authors and categories, as merging might lead to duplicate authors or categories in lists
Ensure that meta files are only applied once to every page
Context
No response
Bug description
When attempting to set the default authors for blog posts via the meta plugin according to the docs, the authors do not actually show up on the blog posts. Non-blog metadata configured via the meta plugin (such as tags) will show up, so properties from the meta plugin are being applied to the file, but seemingly blog data is not.
This can be worked around by manually copy/pasting the meta contents into the frontmatter of each post.
Related links
Reproduction
9.4.7+insiders.4.42.3-meta-doesnt-set-authors.zip
Steps to reproduce
mkdocs build
or serve it withmkdocs serve
Browser
No response
Before submitting
The text was updated successfully, but these errors were encountered: