diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/PopularTags/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/PopularTags/Default.cshtml index 0946744aaa..eb67129d8c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/PopularTags/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/PopularTags/Default.cshtml @@ -10,7 +10,7 @@
@foreach (var tag in Model.Tags) { - if (Model.UrlFactory == null) + if (Model.UrlFormat.IsNullOrWhiteSpace()) { @tag.Name @@ -18,7 +18,7 @@ } else { - + @tag.Name diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/PopularTags/PopularTagsViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/PopularTags/PopularTagsViewComponent.cs index 465805642b..1a766ae452 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/PopularTags/PopularTagsViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/PopularTags/PopularTagsViewComponent.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.Uow; using Volo.CmsKit.Tags; namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.PopularTags; @@ -17,12 +16,12 @@ public class PopularTagsViewComponent : AbpViewComponent _tagAppService = tagAppService; } - public async Task InvokeAsync(string entityType, int maxCount, Func urlFactory = null) + public async Task InvokeAsync(string entityType, int maxCount, string urlFormat) { var model = new PopularTagsViewModel { Tags = await _tagAppService.GetPopularTagsAsync(entityType, maxCount), - UrlFactory = urlFactory + UrlFormat = urlFormat }; return View("~/Pages/CmsKit/Shared/Components/PopularTags/Default.cshtml", model); } @@ -30,6 +29,6 @@ public class PopularTagsViewComponent : AbpViewComponent public class PopularTagsViewModel { public List Tags { get; set; } - public Func UrlFactory { get; set; } + public string UrlFormat { get; set; } } } \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml index c8b588debc..e9567b8b3e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Tags/Default.cshtml @@ -16,7 +16,7 @@ } else { - var formattedUrl = Model.UrlFormat.Replace("{TagId}", tag.Id.ToString()); + var formattedUrl = Model.UrlFormat.Replace("{TagId}", tag.Id.ToString()).Replace("{TagName}", tag.Name); @tag.Name } }