It can be done at the theme layer, but what about allowing to select a rel="nofollow" attribute for all the links in a given view ? The links to the nodes and the pagination. It would be nice for those wanting to scult their Pagerank.
It can be done at the theme layer, but what about allowing to select a rel="nofollow" attribute for all the links in a given view ? The links to the nodes and the pagination. It would be nice for those wanting to scult their Pagerank.
Comments
Comment #1
drewish commentedit would be kind of tricky because you'd have to do it on every field handler... and that wouldn't take care of the ones in other contrib modules.
Comment #2
todd nienkerk commented+1
Checking "Add field as link" (or whatever the text is) could display an option to nofollow that field. This is particularly useful for aggregator-based views and any other view that natively creates or overrides link output.
As drewish mentioned above, contributed modules would have to provide their own nofollow option.
Comment #3
chawl commentedUsing theme suggestion just for rel="nofollow" attribute is an overkill. Also there are many other rel attributes which you might want to set.
IMHO this field should be included in "Output this field as a link" at least.
Tx.
Comment #4
dawehnerAs alternative there could be a hook_views_field_render_advanced_alter, which allows to alter the link array, to add a nofollow attribute.
Comment #5
chawl commentedEven a simple "extras" field can be useful, which you can add not only rel but also other events or attributes like onClick, lang, style, id, name etc. manually.
In fact whole link functionality can be reduced to a single tokenized field for maximum freedom, but may be cryptic for the ones who are not familiar with (X)HTML links anyway.
Comment #6
jmcintyre commented+1.
I need to build a link to open a page into a Shadowbox, so I need to find a way to add a rel="" attribute. I guess I can just rewrite the field output and build my own a tag, but that doesn't seem like the "right" way.
Comment #7
miruoss commentedsubscribe
Comment #8
cerup commentedEasiest way is just to "rewrite output of the field" like:
Where [url] is the replacement pattern link. Make sure to switch the 'display' field setting to 'url as plain text'. [title] can either be another replacement pattern field (above the current one) or just text you put in. This is what I'm currently using. I guess if you need to do it to every field link, you could theme it somehow.
Comment #9
jarizaro commentedThanks, this solved my issue. And it gave me a hint about the other problem i were having.
If you try to use it in a Link CCK field...:
In the output you'll get (source):
which is not correct.
To solve this issue:
- in cck link field: [x] exclude from display, and Display: URL, as plain.
- create a new Global: CustomText field. and:
Thanks.
Comment #10
Bazookatooth commentedok, but where are you getting [url] from? I want to do what you are doing, but i need the URL to be the node's url.
So the end result is the node's title listed in a view and when you click on it it opens the node in a lightframe. So i need the rel="lightframe" in the link.
Comment #11
A Romka commentedis there a way to add JS into a link?
i.e. have something like this -
the whole "onclick=..." gets stripped out for me .. any suggestions?
Comment #12
dawehner#11
No.
This is a security hole and no clean way of developing a website. Better you add a class/id and have your js logic in a extra js file.
Comment #13
WorldFallz commentedqueue cleanup: this issues has deviated from the original request which is handled by the 'rewrite' option.