Ian Beckett

RSS feed

    Recent comments

    Authors

    Add "nofollow" rel attribute by default for comments in Blog Engine .NET

    By default "nofollow" is not added to the comment user URLs in Blog Engine .NET. 

    You probably want to use "nofollow", because you do not necessarily trust the links being added by your visitors, and you do not want to lose page rank by linking to potentially bad sites.

    This is very easy to do with Blog Engine .NET version 1.5.  Simply follow the steps:

    1. Open the CommentView.ascx file in your theme directory (root\themes\).

    2. Find the only "href" character string in the file.  It's on this line:

    <%= Comment.Website != null ? "<a href=\"" + Comment.Website + "\" class=\"url fn\">" + Comment.Author + "</a>" : "<span class=\"fn\">" +Comment.Author + "</span>" %>

    3. Change "a href=\" to "a rel=\"nofollow\" href=\"

    4. Save the file, and you're done! 

    Refresh the page, take a look at the source, and you see the issue is fixed:


    Categories: .NET
    Posted by ibeckett on Saturday, October 10, 2009 5:47 AM
    Permalink | Comments (0) | Post RSSRSS comment feed

    Related posts