Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon How do I write a custom assessment for Yoast SEO


How do I write a custom assessment for Yoast SEO


Here is a concise answer on how to write a custom assessment for the Yoast SEO plugin:

To write a custom assessment for Yoast SEO, you need to follow these steps:

1. Create a custom assessment class that extends the `Assessment` class provided by Yoast SEO. [1]

2. Implement the `getResult()` method in your custom assessment class, which takes a `Paper` object, a `Researcher` object, and an `i18n` object as parameters. This method should analyze the content and return an `AssessmentResult` object with a score and feedback text. [1]

3. Register your custom assessment with Yoast SEO by creating a new instance of your assessment class and using the `_worker.registerAssessment()` method to add it to Yoast SEO's analysis. [1]

4. Optionally, you can also create a custom web worker that performs the analysis in a separate thread to improve performance. [1]

The search results provide sample code demonstrating how to implement these steps. The key points are:

- Extend the `Assessment` class and implement the `getResult()` method
- Register your custom assessment using the Yoast SEO APIs
- Consider using a custom web worker for better performance

By following this process, you can add your own custom content analysis to the Yoast SEO plugin to suit your specific needs.

Citations:
[1] https://developer.yoast.com/customization/yoast-seo/adding-custom-assessments/
[2] https://developer.yoast.com/customization/yoast-seo/adding-custom-data-analysis/
[3] https://yoast.com/help/customize-your-yoast-seo-experience/
[4] https://yoast.com/help/add-custom-fields-to-yoast-seo-premium-plugin-settings/
[5] https://yoast.com/yoast-seo-snippets-to-customize-your-site/