• Home
  • Web Hub
  • Blazor
  • Security & Anonymity
  • Tools
  • Tests & Reviews

Blazor localization

Build SEO-friendly culture URLs in Blazor

Price
5 €Approximately $5.80
Last Update 1/29/2026

Use /en-us/page-name/ routes for direct access.

The goal is a stable URL system, not just translated text.

Start implementation Check SEO signals
Route pattern /en-us/guide/
  1. 01
    Language

    The words and UI labels a visitor reads.

  2. 02
    Region

    The market context for spelling, currency, rules, and examples.

  3. 03
    Route

    The public path users and crawlers can open directly.

  4. 04
    Content

    The visible page version metadata and schema must describe.

Why it matters

Culture URLs help people and crawlers choose the right page

A cookie can change language after a request.

A URL can be shared, crawled, indexed, cached, and audited.

Culture routes fit public articles, product pages, docs, and tools.

Crawlable language pages Clear regional intent Stable internal links Predictable fallbacks
Table of Content
  • 01
    Why it matters
  • 02
    Core concepts
  • 03
    SEO signals
  • 04
    Implementation
  • 05
    Translated slugs
  • 06
    Navigation
  • 07
    Common mistakes
  • 08
    Validation
  • 09
    Related resources
  • 10
    Culture URL questions

Core concepts

Separate language, region, route, and content version

Keep these terms separate before you write routing code.

Language

Use language for readable text.

English, German, and French are language choices.

Region

Use region for local intent.

en-us and en-gb can need different spelling, examples, and offers.

Route

Use routes for discovery.

A route like /de-de/blazor/ gives everyone one stable address.

Content version

Use content when intent differs.

Write a separate version when legal notes, prices, or examples differ.

SEO signals

Connect culture routes with canonical and hreflang rules

The URL is only one signal. Metadata must match it.

01

Canonical URL

Point each localized page at its own preferred URL.

02

hreflang

Link every real language or region version with hreflang.

03

x-default

Use x-default for a neutral selector or global fallback.

04

BreadcrumbList

Keep breadcrumbs culture-aware so schema matches the visible route hierarchy.

Related reference

Metadata and schema must tell the same story

Use these guides when you add metadata and structured data.

Blazor metadata guide Read JSON-LD guide

Implementation

Build the route rules in small pieces

Start with one service, one redirect, and one route pattern.

Culture service contract

Centralize supported cultures and URL parsing.

C#
public sealed class CultureRouteService
{
    private static readonly string[] SupportedCultures = ["en-us", "en-gb", "de-de"];

    public string ResolveCulture(string? routeCulture)
    {
        if (SupportedCultures.Contains(routeCulture, StringComparer.OrdinalIgnoreCase))
        {
            return routeCulture!.ToLowerInvariant();
        }

        return "en-us";
    }
}

Culture redirect endpoint

Set the cookie, then return to the culture route.

C#
[Route("culture")]
public sealed class CultureController : Controller
{
    [HttpGet("set")]
    public IActionResult Set(string culture, string returnUrl)
    {
        Response.Cookies.Append(
            CookieRequestCultureProvider.DefaultCookieName,
            CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)));

        return LocalRedirect(returnUrl);
    }
}

Program setup

Register localization before you map controller routes.

C#
builder.Services.AddLocalization();
builder.Services.AddScoped<CultureRouteService>();

app.UseRequestLocalization(options =>
{
    options.SetDefaultCulture("en-us");
    options.AddSupportedCultures("en-us", "en-gb", "de-de");
    options.AddSupportedUICultures("en-us", "en-gb", "de-de");
});

app.MapControllers();

Page route

Make the culture segment part of every public route.

Razor
@page "/{Culture}/pricing/"

<a href="@BuildCultureLink(PageLinks.Blazor)">
    Blazor guides
</a>

Route reality

Blazor can localize content, not route templates

The culture segment changes; the slug stays stable. Translated slugs need their own routing layer.

Razor @page routes use literal templates. Localization translates page text only. PageLinks and @page strings stay code-owned.

Stable culture URL /de-de/seo-friendly-culture-links-in-blazor/

Only the culture changes.

Custom translated slug /de-de/seo-freundliche-culture-links-in-blazor/

Translated slugs need a slug table. They also need redirects, canonicals, sitemaps, and hreflang.

Practical recommendation BuildCultureLink(PageLinks.Blazor)

BuildCultureLink changes culture, not slugs.

Navigation

Render real links for every culture-aware page

Use anchors with real href values.

Do not hide language routes behind click handlers.

Razor
<NavLink href="@BuildCultureLink(PageLinks.WhatIsBlazor)">
    What is Blazor?
</NavLink>

<NavLink href="@BuildCultureSectionLink(PageLinks.BlazorSEOFriendlyCultureLinks, "faq")">
    Culture URL FAQ
</NavLink>
  • Use central PageLinks instead of hand-written paths.
  • Build links with BuildCultureLink or BuildCultureSectionLink.
  • BuildCultureLink changes culture, not slugs.
  • Render anchors during the first HTML response.
  • Keep navigation, canonical URLs, and hreflang data in sync.

Common mistakes

Most culture URL bugs are routing mismatches

The route template is rarely the hard part.

Keep every signal aligned after a language change.

Redirect loops

Do not redirect a valid culture forever.

Normalize the culture once, then stop when the route already matches.

Wrong default

Do not guess the default culture late.

Use one default culture for routing, metadata, sitemap, and fallback logic.

Duplicate slugs

Do not let two pages own the same culture slug.

Central page links make accidental route collisions easier to review.

Hidden links

Do not hide language routes in client-only state.

Crawlers and users need real href values before Blazor becomes interactive.

Validation

Check each culture route before publishing

Validate rendered HTML, not only Razor code.

Review Blazor basics
  • Open at least one URL for each supported culture.
  • Check canonical and hreflang tags in the rendered source.
  • Confirm FAQ schema matches the visible questions and answers.
  • Crawl redirects so unsupported cultures do not loop.
  • Review translated titles, descriptions, H1 text, and keywords.
Blazor learning pick

Build confident Blazor apps with real-world patterns

Tip from me I learned a lot here through practical video guidance on Blazor fundamentals, architecture choices, and maintainable component design.

  • Step-by-step labs for Razor components, state, and dependency injection.
  • Practical guidance on hosting, performance, and deployment workflows.
  • Clean UI techniques that keep your Blazor codebase maintainable.
Explore the Blazor course

Related resources

Read these next when localization touches SEO

Use these guides for Blazor basics, metadata, schema, and hubs.

Related guide
Blazor hub
Browse Blazor guides for routing, hosting, metadata, and SEO.
Read guide
Related guide
Blazor SEO Metadata Component
Keep titles, canonical URLs, hreflang, Open Graph, and JSON-LD aligned.
Read guide
Related guide
What is Blazor?
Review Blazor render modes before you choose a localization architecture.
Read guide
Related guide
JSON-LD schema guide
Choose Article, FAQPage, and BreadcrumbList schema without conflicting data.
Read guide

FAQ

Are culture URLs better than cookies for SEO?

Yes. Culture URLs create crawlable and shareable pages.

What is the difference between language and region?

Language controls text. Region controls local examples and offers.

Do I still need hreflang with culture routes?

Yes. Culture routes make URLs clear. hreflang connects them.

What should canonical point to on localized pages?

Usually, canonical points to the same localized page.

How do I avoid redirect loops?

Redirect unsupported cultures once, then stop.

GhostlyInc.com

No tracking, analytics, or personal data storage.

Independent guides, tools, and reviews for practical web work.

Quick links

About Terms of service GitHub YouTube

Products

Tools Gumroad Microsoft Store Microsoft Store web page

Select language

Made with by Copyright 2022 - 2026 GhostlyInc.com