最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

I have a problem with a Blazor .NET 9 web app regarding SEO - Stack Overflow

programmeradmin0浏览0评论

I have built a Blazor .NET 9 web app that has the @rendermode="InteractiveServer" set in the App.razor file.

In my MainLayout, I have

protected override void OnInitialized()

which just creates an instance of a class and then in the

protected override async Task OnAfterRenderAsync(bool firstRender)

method, I build the page which is dynamically created from the database (no static files in this website). I have to build the pages here in the OnAfterRenderAsync as I need to grab the users cookie details to get their user details and if I put in the OnInitialized then I get thrown a JSOp error.

All runs great, builds the website pages and displays to the user great but when I "view source" of the page in the browser, there is no html apart from the blazer style links and the script tags, no header or body text, things like:

<body><!--Blazor:{"type":"server","prerenderId":"ec741368070d42e89a1ad871ff4ea12d"
<!--Blazor:{"prerenderId":"ec741368070d42e89a1ad871ff4ea12d"}-->
<!--Blazor-Web-Initializers:WwogICJfY29udGVudC9UaW55TUNFLkJsYXpvci9UaW55TWNlLkJsYXpvci5saWIubW9kdWxlLmpzIgpd--><!--Blazor-Server-Component-State:CfD

If I don't view source but instead click inspect (using google chrome browser), it will show the HTML.

My issue is google webmaster tools doesn't see the html text when it crawls the site and gives errors that all pages have the same data (the style and script tags) and no html so google won't index my website.

What do I need to do to push the HTML into the page so that when a user clicks on view source it sees the actual html?

Regards

J

发布评论

评论列表(0)

  1. 暂无评论