개선: 배포 검증과 관리자 UX 안정화
This commit is contained in:
@@ -142,6 +142,60 @@ if (!app.Environment.IsDevelopment())
|
||||
app.MapControllers();
|
||||
app.MapHealthChecks("/healthz");
|
||||
app.MapRazorPages();
|
||||
app.MapGet("/blog/{slug}", async (string slug, TaxBaik.Application.Services.BlogService blogService, HttpContext context) =>
|
||||
{
|
||||
var post = await blogService.GetBySlugAsync(slug, context.RequestAborted);
|
||||
if (post == null)
|
||||
return Results.NotFound();
|
||||
|
||||
var baseUrl = $"{context.Request.Scheme}://{context.Request.Host}{context.Request.PathBase}";
|
||||
var canonical = $"{baseUrl}/blog/{post.Slug}";
|
||||
var html = $"""
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{System.Net.WebUtility.HtmlEncode(post.SeoTitle ?? post.Title)}</title>
|
||||
<meta name="description" content="{System.Net.WebUtility.HtmlEncode(post.SeoDescription ?? string.Empty)}" />
|
||||
<link rel="canonical" href="{canonical}" />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>{System.Net.WebUtility.HtmlEncode(post.Title)}</h1>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
""";
|
||||
return Results.Content(html, "text/html; charset=utf-8");
|
||||
});
|
||||
app.MapGet("/taxbaik/blog/{slug}", async (string slug, TaxBaik.Application.Services.BlogService blogService, HttpContext context) =>
|
||||
{
|
||||
var post = await blogService.GetBySlugAsync(slug, context.RequestAborted);
|
||||
if (post == null)
|
||||
return Results.NotFound();
|
||||
|
||||
var baseUrl = $"{context.Request.Scheme}://{context.Request.Host}{context.Request.PathBase}";
|
||||
var canonical = $"{baseUrl}/blog/{post.Slug}";
|
||||
var html = $"""
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{System.Net.WebUtility.HtmlEncode(post.SeoTitle ?? post.Title)}</title>
|
||||
<meta name="description" content="{System.Net.WebUtility.HtmlEncode(post.SeoDescription ?? string.Empty)}" />
|
||||
<link rel="canonical" href="{canonical}" />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>{System.Net.WebUtility.HtmlEncode(post.Title)}</h1>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
""";
|
||||
return Results.Content(html, "text/html; charset=utf-8");
|
||||
});
|
||||
app.MapRazorComponents<TaxBaik.Web.Components.Admin.App>().AddInteractiveServerRenderMode();
|
||||
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user