Files
taxbaik/src/TaxBaik.Web/Pages/Sitemap.cshtml.cs
T
kjh2064 3bfb1bab7e
TaxBaik CI/CD / build-and-deploy (push) Failing after 5m30s
fix: add root path redirect - EMERGENCY
The request reached the end of the pipeline - critical fix.

Added root path mapping to redirect to /taxbaik/
This ensures the root endpoint is handled.

Emergency deployment to fix production 500 error.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-04 05:44:58 +09:00

53 lines
1.5 KiB
C#

using Microsoft.AspNetCore.Mvc.RazorPages;
using TaxBaik.Application.Services;
namespace TaxBaik.Web.Pages;
public class SitemapModel : PageModel
{
private readonly BlogService _blogService;
public List<string> Urls { get; set; } = [];
public SitemapModel(BlogService blogService)
{
_blogService = blogService;
}
public async Task OnGetAsync()
{
var baseUrl = "https://www.taxbaik.com/taxbaik";
// 정적 페이지 (항상 포함)
Urls.AddRange(new[]
{
$"{baseUrl}",
$"{baseUrl}/about",
$"{baseUrl}/services",
$"{baseUrl}/contact",
$"{baseUrl}/privacy",
$"{baseUrl}/terms",
$"{baseUrl}/blog",
$"{baseUrl}/faq",
$"{baseUrl}/announcement",
$"{baseUrl}/inquiry"
});
// 동적 블로그 포스트 (DB 오류 처리)
try
{
var (posts, _) = await _blogService.GetPublishedPagedAsync(1, 1000, categoryId: null, ct: default);
foreach (var post in posts)
{
Urls.Add($"{baseUrl}/blog/{post.Slug}");
}
}
catch (Exception ex)
{
// DB 연결 실패 등의 경우, 정적 페이지만으로도 sitemap 제공
// 프로덕션에서는 DB가 있으므로 이 경로는 사용되지 않음
System.Diagnostics.Debug.WriteLine($"Sitemap: Blog posts load failed: {ex.Message}");
}
}
}