From 28d73facd6af5541df697d1f2767e40d699299ce Mon Sep 17 00:00:00 2001 From: Mark Downie Date: Thu, 11 Mar 2021 18:58:03 -0500 Subject: [PATCH] Home page link turns into a span if commenter does not leave a home page reference. --- .../TagHelpers/Comments/CommentUserHomePageLink.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/DasBlog.Web.UI/TagHelpers/Comments/CommentUserHomePageLink.cs b/source/DasBlog.Web.UI/TagHelpers/Comments/CommentUserHomePageLink.cs index dfc1f87b..470ea3fe 100644 --- a/source/DasBlog.Web.UI/TagHelpers/Comments/CommentUserHomePageLink.cs +++ b/source/DasBlog.Web.UI/TagHelpers/Comments/CommentUserHomePageLink.cs @@ -13,15 +13,19 @@ public class CommentUserHomePageLink : TagHelper public override void Process(TagHelperContext context, TagHelperOutput output) { - output.TagName = "a"; output.TagMode = TagMode.StartTagAndEndTag; if (Comment.HomePageUrl?.Length > 0) { + output.TagName = "a"; output.Attributes.SetAttribute("href", Comment.HomePageUrl); + output.Attributes.SetAttribute("rel", "nofollow"); } - - output.Attributes.SetAttribute("rel", "nofollow"); + else + { + output.TagName = "span"; + } + output.Attributes.SetAttribute("class", "dbc-comment-user-homepage-name"); output.Content.SetHtmlContent(Comment.Name); }