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

Add ld+json structured data option #43

Merged
merged 4 commits into from
Feb 3, 2024
Merged

Add ld+json structured data option #43

merged 4 commits into from
Feb 3, 2024

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Feb 3, 2024

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhanced MkDocs plugin with structured data and improved documentation metadata.

πŸ“Š Key Changes

  • Added a new configuration option add_ld+json to include structured data (LD+JSON) in the page header.
  • Enriched document footer with Git-based creation and last modified dates, and authors list.
  • Upgraded the plugin version to 0.0.43.

🎯 Purpose & Impact

  • SEO Improvement: The addition of structured data (LD+JSON) will help search engines better understand the content of the pages, potentially improving page rankings and visibility. πŸš€
  • Better Documentation: Dates and authors at the footer provide transparency and context to users, showing the currency and contributors of the documentation. πŸ“…πŸ‘₯
  • Up-to-date Plugin: The version bump signifies the new features and improvements available to users. πŸ”„

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

PR Type: Enhancement

PR Summary: The pull request introduces a new feature to the MetaPlugin class by adding an option to include structured data in the form of JSON-LD to the head of the page. This feature is controlled by a configuration option 'add_ld+json' which is set to false by default. The PR also includes refactoring to optimize the retrieval of git information used in the footer for pages where dates and authors are added.

Decision: Comment

πŸ“ Type: 'Enhancement' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
βœ… Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
πŸ“ Complexity: the changes are too large or complex for Sourcery to approve.
  • Unsupported files: the diff contains files that Sourcery does not currently support during reviews.

General suggestions:

  • Ensure that the JSON-LD content is properly escaped to prevent potential security risks such as injection attacks.
  • Consider making the author information in the JSON-LD content configurable to cater to different users or extracting it from the page metadata or repository configuration.
  • Review the default value for the 'add_ld+json' configuration option to ensure it aligns with the common use cases and user expectations for the plugin.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click πŸ‘ or πŸ‘Ž on each comment to tell me if it was helpful.

"url": "https://ultralytics.com/"
}]
}
ld_json_script.string = json.dumps(ld_json_content)
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (llm): Ensure that the JSON-LD content is properly escaped to prevent injection attacks or issues when rendering the script tag content.

Copy link
Member Author

Choose a reason for hiding this comment

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

How do I do that?

Copy link
Member Author

Choose a reason for hiding this comment

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

@sourcery-ai how can I do this?

@glenn-jocher glenn-jocher merged commit 9bed9bd into main Feb 3, 2024
1 check passed
@glenn-jocher glenn-jocher deleted the ldjson branch February 3, 2024 13:05
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.

2 participants