feat(seo): complete OG/Twitter/structured-data coverage + clean encoding
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:
@@ -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+json" and
|
||||
// Persian text into \XX; 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 =>
|
||||
|
||||
Reference in New Issue
Block a user