Insert rel=nofollow in link if not present
Posted: Wed Mar 27, 2013 1:31 am
Hi,
I am struggling with the inserting of rel="nofollow" in all links within a certain text block if the link does not has this string.
Example of the textblock:
<!--menu2-->
...
<!--menu3-->
Insert in all links within the textblock <!--menu2-->(.*)<!--menu3--> after
the two characters
<a
shoulds read now <a rel="nofollow"
if the string rel="nofollow" is not already there. So <a class=" will become <a rel="nofollow" class="
My problem is the detection of the string
rel="nofollow"
in existing links
As a workaround I could just insert rel="nofollow" in all links and delete thereafter the string
rel="nofollow" rel="nofollow" to just rel="nofollow"
but the problem is that there other strings like class="..." target="_..." etc. which appear in some links in different places. Thus, I cannot detect if the string rel="nofollow" is already there. Do you have any idea of the filter?
thanks
gerd
I am struggling with the inserting of rel="nofollow" in all links within a certain text block if the link does not has this string.
Example of the textblock:
<!--menu2-->
...
<!--menu3-->
Insert in all links within the textblock <!--menu2-->(.*)<!--menu3--> after
the two characters
<a
shoulds read now <a rel="nofollow"
if the string rel="nofollow" is not already there. So <a class=" will become <a rel="nofollow" class="
My problem is the detection of the string
rel="nofollow"
in existing links
As a workaround I could just insert rel="nofollow" in all links and delete thereafter the string
rel="nofollow" rel="nofollow" to just rel="nofollow"
but the problem is that there other strings like class="..." target="_..." etc. which appear in some links in different places. Thus, I cannot detect if the string rel="nofollow" is already there. Do you have any idea of the filter?
thanks
gerd