Skip to content

Conversation

@fcakyon
Copy link
Member

@fcakyon fcakyon commented Dec 24, 2025

Summary

Problem

PR #177 removed default_author from process_html() but didn't update main.py. Running mkdocs build with add_authors: true or add_json_ld: true would crash with:

TypeError: process_html() got an unexpected keyword argument 'default_author'

Why ultralytics CI didn't catch this: build_docs.py uses zensical build + direct postprocess_site() call, bypassing the plugin's on_post_page hook where the bug occurs.

When this matters: If we switch back from zensical to mkdocs build, builds would fail without this fix.

Fix

Align main.py with postprocess.py:

  1. Import resolve_all_authors from plugin.utils
  2. Call resolve_all_authors() in on_config() after building git_data
  3. Remove default_author from process_html() call

This is the same flow that postprocess.py uses.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Fixes a default_author handling bug by resolving author metadata once during MkDocs config setup ✅

📊 Key Changes

  • Adds resolve_all_authors to pre-process git_data during on_config()
  • Populates missing/implicit author info using default_author, repo_url, and verbose settings
  • Removes passing default_author into process_html() since authors are now resolved upfront

🎯 Purpose & Impact

  • Prevents incorrect or missing author attribution caused by late/incorrect default_author usage 🐛
  • Makes page post-processing simpler and more consistent by ensuring git_data is fully normalized early
  • Improves reliability of metadata generation across all pages with minimal behavioral surface-area changes

PR #177 removed `default_author` from `process_html()` but `main.py`
still passed it, causing silent failures for users running `mkdocs build`.

The fix aligns `main.py` with `postprocess.py` by calling
`resolve_all_authors()` during `on_config()` instead of passing
`default_author` to `process_html()`.
@fcakyon fcakyon self-assigned this Dec 24, 2025
@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working fixed Bug has been resolved labels Dec 24, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @fcakyon, thank you for submitting a ultralytics/mkdocs 🚀 PR! This is an automated message to help with triage—an Ultralytics engineer will assist soon. A few quick checks to ensure smooth review and merge 🧩

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/mkdocs main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

Copy link
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

Choose a reason for hiding this comment

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

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Summary

The diff looks clean and correctly addresses the stated goal: author metadata is normalized once during on_config() via resolve_all_authors(), and default_author is no longer redundantly threaded into process_html(). No bugs, regressions, or missing error handling are apparent from the changed lines.

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

Labels

bug Something isn't working fixed Bug has been resolved

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants