in reply to Re^5: rel="nofollow" tag syntax?
in thread rel="nofollow" tag syntax?

Hi Corion,
Got your code to work, sort of :-|
Not sure why it's reversing the order of things and putting the nofollow before the href in the HTML:
<a rel="nofollow" href="http://www.example.com/">http://www.example.com/</a>

Here's what I put in:
print a({-href => $val[5], -rel => 'nofollow'}, $linktext);

Obviously I'm still messing something up in modifying the script:
my $page_link; if ($val[5]) { # construct link if value is not NULL (undef) or empty my $linktext = $val[5]; $linktext = substr($linktext, 0, 27) . "..." . substr($linktext, - +10) if length($val[5]) > 40; $page_link = a ({-href => "$val[5]"}, $linktext);

Thanks again,

Replies are listed 'Best First'.
Re^7: rel="nofollow" tag syntax?
by Joost (Canon) on Apr 17, 2007 at 17:03 UTC
    Hashes like that { -href => ..., -rel => ...} construct are unsorted. You can't rely on any specific order.

    Thankfully, HTML is the same in this regard. the order of attributes doesn't matter, so <a rel="nofollow" href="http://www.example.com/">http://www.example.com/</a> is completely equivalent to <a href="http://www.example.com/" rel="nofollow">http://www.example.com/</a>

      Still not getting this :-|
      Is there a way that I can modify the line
      $page_link = a ({-href => "$val[5]"}, $linktext); without using the print function at this point in the script? Something like this perhaps? (but that works ;-)
      $page_link = a({-href => $val[5], -rel => 'nofollow'}, $linktext);


      Thanks,
      -Bob

      bobafifi.com