feat: add RSS/Atom feed support - fix Razor XML rendering
TaxBaik CI/CD / build-and-deploy (push) Successful in 8m35s
TaxBaik CI/CD / build-and-deploy (push) Successful in 8m35s
Changes: - Rss.cshtml: Fixed Razor/XML syntax by using StringBuilder - Feed.cshtml: Alias for /feed.xml - Both pages use RssModel (BlogService) - robots.txt: Added feed references Fix: - Removed @page duplicate directive - Used StringBuilder for proper XML generation - Avoided Razor XML tag nesting issues - Both /rss.xml and /feed.xml now available URLs: ✓ https://www.taxbaik.com/taxbaik/rss.xml ✓ https://www.taxbaik.com/taxbaik/feed.xml Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using TaxBaik.Application.Services;
|
||||
using TaxBaik.Domain.Entities;
|
||||
|
||||
namespace TaxBaik.Web.Pages;
|
||||
|
||||
public class RssModel : PageModel
|
||||
{
|
||||
private readonly BlogService _blogService;
|
||||
|
||||
public List<BlogPost> Posts { get; set; } = [];
|
||||
public string LastBuildDate { get; set; } = DateTime.UtcNow.ToString("R");
|
||||
|
||||
public RssModel(BlogService blogService)
|
||||
{
|
||||
_blogService = blogService;
|
||||
}
|
||||
|
||||
public async Task OnGetAsync()
|
||||
{
|
||||
// 최근 50개 블로그 포스트 (RSS는 일반적으로 최신 기사만 포함)
|
||||
var (posts, _) = await _blogService.GetPublishedPagedAsync(1, 50, categoryId: null, ct: default);
|
||||
Posts = posts.OrderByDescending(p => p.PublishedAt).ToList();
|
||||
|
||||
LastBuildDate = Posts.FirstOrDefault()?.PublishedAt?.ToString("R") ?? DateTime.UtcNow.ToString("R");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user