Search code examples
blazorgithub-pagesblazor-server-side

Problem with Blazor and github page (index.cshtml)


So I built a website using Blazor Server-side and I want to host it into Github Pages. I have two problems:

  1. All of my pages are located into the "pages" folder and I assume the Github page only able to read the HTML files from the root directory or the "docs" folder. That is the easy fix for me but just wondering is there any settings to overcome that.

  2. the real issue is Github Pages only recognizes index.html as the starting point, and it doesn't recognize index.cshtml. Is there any fix for this? I tried to create a new index.html redirect to index.cshtml using this tag but it's only downloading the index.cshtml page and doesn't go directly to it:


Solution

  • You won't be able to publish blazor server-side as it needs to run off a server. Github Page can host static web pages so you can publish blazor client-side (wasm) though.

    See https://www.davideguida.com/how-to-deploy-blazor-webassembly-on-github-pages-using-github-actions/