While implementing yoast_seo for a client we stumbled onto two issues:
1. yoast_seo analyses the output of a rendered entity. This entity should be rendered in the frontend theme rather than using the administration theme which is active when running the AnalysisFormHandler logic. In the attached patch, an addition to the yoast_seo settings is added where you can select the theme to use when analysing.
2. Another issue we encountered is that not all <p> elements are 'detected' when analysing. We traced this problem back to the getParagraphsInTags method in https://github.com/Yoast/YoastSEO.js/blob/develop/src/stringProcessing/m..., which cannot handle newlines in the given text. This issue is solved by simply stripping all \n characters in the createEntityPreview method.
Please see the attached patch.
| Comment | File | Size | Author |
|---|---|---|---|
| frontend-theme-and-newlines.patch | 14.42 KB | ruuds |
Issue fork yoast_seo-3122871
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
ruuds commentedComment #5
bramdriesenI tested this out, this actually also fixes Acquia Site Studio compatibility!
Comment #9
kingdutchRather than using a global setting I've implemented this using configuration on the analysis widget. This allows different types of analysable entities to use different themes if that's desired. I've also used the opportunity to add support for view mode configuration which was a TODO that was in the code and could use the same plumbing. To top it off I've added some test coverage with Behat to confirm everything works (and keeps working) :D
I was able to copy the changes to the analyser as provided, with the adjusted plumbing for the settings.
Thanks for your help! :D This is released as 8.x-2.0-alpha9