feat(seo): complete OG/Twitter/structured-data coverage + clean encoding
CI/CD / CI · dotnet build (push) Successful in 2m1s
CI/CD / Deploy · drsousan (push) Successful in 35s

Blog list (/blog): add robots, full Open Graph + Twitter, Blog +
BreadcrumbList JSON-LD, per-page self-canonical, and rel=prev/next for
paginated pages.

Blog post: add robots, og:site_name, article:published_time /
modified_time / author / section, twitter:image, og:image:alt, and a
BreadcrumbList JSON-LD (Home → Blog → Category → Post).

Gallery (/gallery): add robots, full OG + Twitter (with first image as
og:image), ImageGallery + BreadcrumbList JSON-LD.

Encoding: register HtmlEncoder.Create(UnicodeRanges.All) so Persian text
in meta tags and JSON-LD renders literally instead of &#xXXXX; entities
(smaller, cleaner output; friendlier to SEO validators).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-25 13:44:37 +03:30
parent 5a1f1a8ccb
commit 00a138fe46
4 changed files with 140 additions and 5 deletions
+6
View File
@@ -1,6 +1,8 @@
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
@@ -49,6 +51,10 @@ builder.Services.AddCors(opt =>
// Razor Pages for SSR public pages
builder.Services.AddRazorPages();
// Don't entity-encode non-ASCII (Persian) or chars like '+' in markup output.
// Default encoder turns "application/ld+json" into "application/ld&#x2B;json" and
// Persian text into \&#x06XX; entities — valid but bloated and trips some validators.
builder.Services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
// Fix circular JSON references (BlogPost ↔ BlogCategory)
builder.Services.ConfigureHttpJsonOptions(opts =>