I expect that the title tag of my inline svg still remains unchanged
After Yoast hooks title tags are removed.
I think it's flush_cache in: wp-content/plugins/wordpress-seo/frontend/class-frontend.php
In this function all the title tags are replaced.
Please enable "Force rewrite titles" in "Titles & Metas" section and include in your theme an inline svg.:
example:
<?php echo file_get_contents(get_stylesheet_directory().'/img/svg/phone.svg'); ?>
SVG example:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18"><title>Phone icon</title><path d="M-3-3h24v24H-3z" fill="none"/><path d="M3.62 7.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V17c0 .55-.45 1-1 1C7.61 18 0 10.39 0 1c0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" fill="#fff"/></svg>
Can you provide a link to a page which shows this issue?
No, I can't because I added a patch in my theme to fix the issue.
Thanks for your report, we've been able to reproduce this issue have therefore labeled the issue as a bug.
Unfortunately we're not able to fix this at short notice. Currently we're focusing on issues that affect many users. We've concluded that this issue is not experienced by many users, therefore we are not able to fix this short-term. However, if more users are affected by this bug, we'll of course revisit this issue.
Hello,
We encountered the same issue. As the use of svg become more and more popular, we think it will be a real problem for the YOAST plugin in the near future. Do you think you can add the fix in your scope ? If not I think we'll have to change to another SEO plugin because we really need this feature.
Thanks
@Whargal Thanks for your feature request. As soon as we've made a decision, we'll inform you here.
This is very simple to mitigate: disable force rewrite in Yoast SEO. If you just remove all the <title> tags from your theme and add theme support for the core title tag functionality.
More info can be found here as well: https://kb.yoast.com/kb/the-seo-title-output-for-the-plugin-doesnt-work-as-expected/
The mitigation strategy doesn't have any direct relation to the problem and has other side effects. Unless Yoast is billed as managing SEO for inline svgs and has features to enable that, it should probably just leave them alone entirely. It looks like the function that does this is intended to target just the title element in the head, but instead crawls through the entire document.
@dtipson just as Google often does... Force rewrite is very slow so you really shouldn't really on that anyway and follow my advice above.
@jdevalk
I sent PR to fix this problem.
The force rewrite titles option is very useful when exporting a WordPress site as a static site, with WP2Static, Simply Static, etc.
In these cases, visitors to the site get the rewritten HTML, so there is no problem even if the rewriting is very slow.
Most helpful comment
The mitigation strategy doesn't have any direct relation to the problem and has other side effects. Unless Yoast is billed as managing SEO for inline svgs and has features to enable that, it should probably just leave them alone entirely. It looks like the function that does this is intended to target just the title element in the head, but instead crawls through the entire document.