grav
grav copied to clipboard
If multiple attributes are added to URL link the `rel` attribute is ignored
If multiple attributes are added to URL link the rel
attribute is ignored.
These two links will be rendered differently:
[„Google“ privacy policy](https://policies.google.com/privacy?hl=en?rel=nofollow).
the rel=nofollow
will be ignored of ?hl=en
[Deny](https://adssettings.google.com/autenced?rel=nofollow)
attribute ?rel=nofollow
will be rendered
Hi @01Kuzma
First of all, you must define the attribute in system.yaml, in pages.markdown.valid_link_attributes, you must add the attribute to use. By default, Grav offers the most used ones (rel, id, classes, target and class). Once you have added the attributes you want to use, the way to put them in the link is as follows:
[Google Privacy Policy](https://policies.google.com/privacy?lang=en&rel=nofollow)
.
'?' is used to separate the attributes from the rest of the link, but for each attribute you want to use you must use '&'. In your example this is wrong and that is why it does not work for you, but in this case Grav works perfectly. The previous example has the following html output:
<a href="https://policies.google.com/privacy" lang="en" rel="nofollow">Google Privacy Policy</a>
I think that in this case, this issue can be closed.
Hi @pmoreno-rodriguez
'?' is used to separate the attributes from the rest of the link, but for each attribute you want to use you must use '&'. Indeed, it was a typo. Thank you for pointing it out!
@pmoreno-rodriguez , but now after recheking I found one issue with this:
[Google Fonts](https://developers.google.com/fonts/faq#what_does_using_the_google_fonts_api_mean_for_the_privacy_of_my_users?rel=nofollow)
Is rendered as:
<a href="https://developers.google.com/fonts/faq#what_does_using_the_google_fonts_api_mean_for_the_privacy_of_my_users?rel=nofollow">Google Fonts</a>
without nofollow
param
Any thoughts?
I've had a look at the Excerpts.php file, and played around with the processLinkExcerpt
function, which I think is responsible for this, but the most I got was returning download=""
.
@pmoreno-rodriguez , so, it seems it's a bug. It's a pity, that dev's haven't checked it since September 2022!
I've had a look at the Excerpts.php file, and played around with the
processLinkExcerpt
function, which I think is responsible for this, but the most I got was returningdownload=""
.
Sorry, I think this answer is for other issue
@pmoreno-rodriguez , but now after recheking I found one issue with this:
[Google Fonts](https://developers.google.com/fonts/faq#what_does_using_the_google_fonts_api_mean_for_the_privacy_of_my_users?rel=nofollow)
Is rendered as:
<a href="https://developers.google.com/fonts/faq#what_does_using_the_google_fonts_api_mean_for_the_privacy_of_my_users?rel=nofollow">Google Fonts</a>
withoutnofollow
paramAny thoughts?
Hi @01Kuzma
Finally I've found a solution for this issue.
It seems that you have to add the attributes to the url with ?
(the first one) and &
the others, and after all that, the anchor is set with #, for the part of the page indicated. In the case at hand, your example, this would be the correct way to establish it:
[Google Fonts](https://developers.google.com/fonts/faq?lang=es&rel=nofollow#what_does_using_the_google_fonts_api_mean_for_the_privacy_of_my_users)
I hope I have helped you with this solution.
@pmoreno-rodriguez thank you! This does work!