Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor application generates invalid tag for SEO tools like PageSpeed Insights

$
0
0

I am working on a Blazor Server application and facing an issue where the <title> tag is not rendered correctly when analyzed in PageSpeed Insights. While the <title> tag appears properly in the source code of the application when I inspect it in the browser, it doesn't show up in the "SEO" section of PageSpeed Insights.

Setup Details:

  • Framework: Blazor Server (.NET 9)
  • Meta tag setup: Defined <title> in app.razor and dynamically updated it in Blazor components using PageTitle and HeadContent from Microsoft.AspNetCore.Components.

Here is the relevant part of my app.razor file:

<!DOCTYPE html><html lang="fa" dir="rtl"><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><base href="/"/><meta name="googlebot" content="notranslate"/><meta name="google" content="nopagereadaloud"/><meta name="robots" content="index, follow"/><meta name="author" content="naghdone.ir"/><meta name="copyright" lang="fa" content="naghdone.ir"/><HeadOutlet @rendermode="new InteractiveServerRenderMode()" /> <link rel="preload" href="/bundle.css" as="style"/><link rel="preload" href="_framework/blazor.web.js" as="script"><link rel="preload" href="/scripts.js" as="script"><link href="/bundle.css" rel="stylesheet"/></head>

Generated HTML Source:

Below is the HTML source generated by Blazor when I view the page in the browser:

<!DOCTYPE html><html lang="fa" dir="rtl"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><base href="/"><meta name="googlebot" content="notranslate"><meta name="google" content="nopagereadaloud"><meta name="robots" content="index, follow"><meta name="author" content="naghdone.ir"><meta name="copyright" lang="fa" content="naghdone.ir"><!-- Blazor-specific metadata --><title>نقدونه;مرجعتخصصینقدوبررسیکسبوکارها</title><meta name="description" content="نقدونهاولینمرجعتخصصینقدوبررسیکسبکارها. naghdone.ir"><script type="application/ld+json">    {"@context": "https://schema.org","@type": "WebSite","name": "نقدونه","url": "https://naghdone.ir/"    }</script><link rel="preload" href="/bundle.css" as="style"><link rel="preload" href="_framework/blazor.web.js" as="script"><link rel="preload" href="/scripts.js" as="script"><link href="/bundle.css" rel="stylesheet"></head><body><!-- Blazor application content --></body></html>

Observed Issue:

The title appears as expected in the browser's source code.However, in PageSpeed Insights, the SEO section indicates that the tag is missing or not set.

This affects my SEO score and overall ranking.

enter image description here

What I have Tried:

Verified that the is set properly in the browser.Ensured there are no duplicate tags in the rendered HTML.Tested with a simple static HTML page, which works fine on PageSpeed Insights.

Question:

Is this behavior related to how Blazor Server prerenders the page or streams the content dynamically?

How can I ensure that the tag is properly detected by tools like PageSpeed Insights or web crawlers?

Any help or suggestions to resolve this issue would be appreciated!Tested url :https://blazor.naghdone.ir/


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>