-
Hi all, I made a basic Tag Helper. I'll provide the source here. using Microsoft.AspNetCore.Razor.TagHelpers;
namespace LuzFaltex.Web
{
[HtmlTargetElement("github")]
public class GithubTagHelper : TagHelper
{
public string Name { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "a";
output.TagMode = TagMode.StartTagAndEndTag;
output.Attributes.Add("href", $"https://github.com/{Name}");
output.Attributes.Add("target", "_blank");
output.Attributes.Add("rel", "noopener");
output.PreContent.SetHtmlContent(Name);
}
}
} This is a fairly basic example that should then let me use When the site is built however, the anchor isn't rendered and instead the github tag is placed in the resultant HTML. This tells me that the tag helper isn't being recognized. I do have this line in my Do I need to perform any additional tasks to get this to render properly, such as registering it with a statiq pipeline? Edit: I should also note that built-in tag helpers don't work properly either. <div class="copyrightFooter">
<div class="layoutContainer">
<partial name="_footer" /> @*Renders raw*@
@await Html.PartialAsync("_footer") @*Renders as expected*@
</div>
</div> Edit 2: Adding |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
The |
Beta Was this translation helpful? Give feedback.
-
Solution was found: The project didn't seem to know what assembly it belonged to. Adding an explicit AssemblyName declaration appears to have resolved the issue. --- a/LuzFaltexWeb.csproj
+++ b/LuzFaltexWeb.csproj
@@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
+ <AssemblyName>LuzFaltex.Web</AssemblyName>
</PropertyGroup>
<ItemGroup> |
Beta Was this translation helpful? Give feedback.
Solution was found:
The project didn't seem to know what assembly it belonged to. Adding an explicit AssemblyName declaration appears to have resolved the issue.