The blog of Ross Fruen, a .NET consultant

Adding nofollow to FlatPress comments

To try and dissuade spam comments from FlatPress blogs it is worth adding a nofollow rel attribute to the web address associated with a comment.

To achieve this it is necessary to modify the comments.tpl file found in the root folder for the theme you currently have selected, i.e. fp-interface/themes/ramblingross/comments.tpl

Within the ordered list with an id of "comments" there is a single list item. This list item contains a link when the $url variable contains something. Modify this link to contain a rel="nofollow" attribute, e.g.


<strong class='comment-name'>
using this tag combo, the name is displayed as a link only
if user entered a URL.

Syntax is quite intuitive:
"if $url is not empty, show $name between a tags,
else default fallback on displaying plain $name"

{$url|notempty:"<a rel=\"nofollow\" href=\"$url\" title=\"Permalink to $name's comment\">$name</a>"|default:$name}


Add a comment

If you want your comment to appear on this page please complete the form below. Your name and email address are optional, although the latter will be required if you want a response. Your email address will not appear against your comment and will only be used to correspond with yourself (where appropriate).


Thank you for submitting your comment, it will appear here after moderation is complete.


There was a problem sending your comment, please try again.