This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove IHtmlHelper extension and prepare TagHelper - MetaDescription
- Loading branch information
KrzysztofPajak
committed
Aug 7, 2020
1 parent
d461b88
commit b5852a4
Showing
4 changed files
with
29 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Grand.Framework.UI; | ||
using Microsoft.AspNetCore.Razor.TagHelpers; | ||
using System.Threading.Tasks; | ||
|
||
namespace Grand.Framework.TagHelpers | ||
{ | ||
[HtmlTargetElement("meta-description", TagStructure = TagStructure.WithoutEndTag)] | ||
public class MetaDescriptionTagHelper : TagHelper | ||
{ | ||
|
||
private readonly IPageHeadBuilder _pageHeadBuilder; | ||
|
||
public MetaDescriptionTagHelper(IPageHeadBuilder pageHeadBuilder) | ||
{ | ||
_pageHeadBuilder = pageHeadBuilder; | ||
} | ||
|
||
public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) | ||
{ | ||
output.TagName = "meta"; | ||
output.Attributes.Add("name", "description"); | ||
output.Attributes.Add("content", _pageHeadBuilder.GenerateMetaDescription()); | ||
return Task.CompletedTask; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters