Skip to content

Commit

Permalink
Merge pull request #397 from warrenbuckley/fix/category-tags-rss-feeds
Browse files Browse the repository at this point in the history
Fix Category & Tags RSS Feeds
  • Loading branch information
Shazwazza authored Jul 6, 2022
2 parents ef94400 + 6b59225 commit ffd51bb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/Articulate/Controllers/ArticulateRssController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public IActionResult Categories(string tag, int? maxItems)

if (!maxItems.HasValue) maxItems = 25;

return RenderTagsOrCategoriesRss("ArticulateCategories", "categories", maxItems.Value);
return RenderTagsOrCategoriesRss("ArticulateCategories", "categories", maxItems.Value, tag);
}

public IActionResult Tags(string tag, int? maxItems)
Expand All @@ -130,23 +130,18 @@ public IActionResult Tags(string tag, int? maxItems)

if (!maxItems.HasValue) maxItems = 25;

return RenderTagsOrCategoriesRss("ArticulateTags", "tags", maxItems.Value);
return RenderTagsOrCategoriesRss("ArticulateTags", "tags", maxItems.Value, tag);
}

public IActionResult RenderTagsOrCategoriesRss(string tagGroup, string baseUrl, int maxItems)
public IActionResult RenderTagsOrCategoriesRss(string tagGroup, string baseUrl, int maxItems, string tag)
{
if (CurrentPage is not ArticulateVirtualPage tagPage)
{
throw new InvalidOperationException("The RenderModel.Content instance must be of type " + typeof(ArticulateVirtualPage));
}

//create a blog model of the main page
var rootPageModel = new MasterModel(CurrentPage.Parent, _publishedValueFallback, _variationContextAccessor);
var rootPageModel = new MasterModel(CurrentPage, _publishedValueFallback, _variationContextAccessor);

PostsByTagModel contentByTag = _articulateTagService.GetContentByTag(
_umbracoHelper,
rootPageModel,
tagPage.Name,
tag,
tagGroup,
baseUrl,
1,
Expand All @@ -159,7 +154,7 @@ public IActionResult RenderTagsOrCategoriesRss(string tagGroup, string baseUrl,
contentByTag = _articulateTagService.GetContentByTag(
_umbracoHelper,
rootPageModel,
tagPage.Name.Replace('-', '.'),
tag.Replace('-', '.'),
tagGroup,
baseUrl,
1, maxItems);
Expand Down

0 comments on commit ffd51bb

Please sign in to comment.