Mark Oliver's World

Posted: 01/03/2021

How I Built This Blog

I wanted to build a blog website, as its all the rage, but primarily, because its a great way to learn more about Blazor WebAssembly (WASM).

My thinking was that I can host the blog for free in Azure Static Web Apps, and run the dynamic parts using Blazor WASM.
Most of a blog is static, so seemed a sensible start.

One thing I wanted though is the blog posts themselves to be loaded dynamically.

Dynamic in a static app does not easily go together, hence Blazor, where you can run your C# code in the Browser directly, and thus create dynamic things.

However as you are running in a Browser you are also in a security sandbox, and that is going to be a headache for loading the posts.

My first thought was to hold all the blog posts in Markdown on github. I can render the markdown directly as HTML using the Markdig nuget package.

My second thoughts were to host the posts and images in github. However due to the Sandbox constraints, it would seem a Blazor WASM app cannot access a "Raw" version of a github file. It hits the CORS restriction, which seems to be a bug in Blazor here.

So version 1 of this blog is setup like this:

Well this is all working, fine, but I want it to be better.

  • The posts ordered in date order.
  • The list of posts to be determined programmatically not from a hard coded list
  • Somewhere to store images for the posts for free (not my google drive account as at present)
  • A way to feedback on a post - preferably via Twitter.

More to come another day.


Thanks for reading this post.

If you want to reach out, catch me on Twitter!

I am always open to mentoring people, so get in touch.