How do Google, Bing and other sites index a blazor site?
When I view the page source of a blazor app, either Server or WebAssembly (WASM), then all I see is an HTML wrapper which loads the app. To see the generated source code I need to use the DOM inspector. This article discusses putting a robots.txt in place (Where is the best place to put Robots.txt in a Blazor Web Assembly project?) but when I create my site index, every detail page it will point to will be dynamically generated by a .razor file.
Do I need to do anything special to ensure that Google, Bing and others can index my site as I want them to?
This is not strictly a Blazor issue. Search engine crawlers like Googlebot (Google's crawler) and Bing do not execute WASM code, so they can't index a statically generated site like Blazor does. Although, looking at Blazor's release notes, it seems you can enable pre-rendering and host Blazor on a server, thus allowing HTML content to be rendered on the server and sent back to the user. This type of server side rendering (SSR) allows search engine indexing and increases SEO. Take a look at an example here: https://andrewlock.net/enabling-prerendering-for-blazor-webassembly-apps/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With