-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
CanonicalLink->prepForRender() - noindex detection fails for multiple meta robots values #1378
Comments
Yeah the code was just wrong; since we render the attributes, its always going to be a string. Addressed in: 50c4e71 & 7cd91f2 Craft CMS 3: You can try it now by setting your semver in your "nystudio107/craft-seomatic": "dev-develop as 3.4.64”, Then do a ….. Craft CMS 4: You can try it now by setting your semver in your "nystudio107/craft-seomatic": "dev-develop-v4 as 4.0.34”, Then do a |
Wow, thanks for the quick response! But now there is the problem that no canonical tag is displayed if
|
Not doing well on this one, am I? :) Addressed in: aaf8ea4 & 8ba39a7 Craft CMS 3: You can try it now by setting your semver in your "nystudio107/craft-seomatic": "dev-develop as 3.4.64”, Then do a ….. Craft CMS 4: You can try it now by setting your semver in your "nystudio107/craft-seomatic": "dev-develop-v4 as 4.0.34”, Then do a |
This working for you @Abromeit ? |
@khalwat tested successfully – all fine now. 👍 |
Bug description
I have noticed that seomatic does correctly avoid issuing a canonical tag if a post is set to meta robots=noindex or meta robots=none. This is the expected behavior.
In addition, one would expect that a combined value of "noindex, nofollow" would have the same effect on the generated HTML as the value "none". That is, no canonical tag should be output.
However, if you assign more than one value to the meta robots field, e.g.
a canonical tag will be rendered in the HTML.
To reproduce
Steps to reproduce the behaviour:
live
environment or enforce the environment in the respecitve seomatic settingAlways include canonical links regardless of environment
is inactive / falseVersions
Presumed cause
In
src/models/metalink/CanonicalLink.php
theprepForRender()
method expects the return value of$robotsArray['content']
to be an array, if multiple values were entered.craft-seomatic/src/models/metalink/CanonicalLink.php
Lines 81 to 87 in a3daa47
On my test instance i just var_dumped the value of
$robotsArray['content']
and it is a string, like one that would also be used for the final output. (Like "noindex,nofollow".)To solve this, you could probably use explode() on the string. But I suspect that there is already a more suitable solution in this project. For example, a method that can actually still return the raw array.
The text was updated successfully, but these errors were encountered: