For an update to this post – check out my update – Blazor and WordPress – The Story Continues
As I mentioned in my previous post, I have been tinkering with Blazor, seeing how it will fit into my application development pattern. When I first saw that Blazor web assembly can run on Linux servers, it occured to me that this might be the best tool to be able to build applications that run inside WordPress. So one of the first things I did was to see if I could get that working.
Naturally it wasn’t as straightforward as I was hoping, and I ran into a few pre-release issues with Blazor that slowed me down, but I think I have done enough to see that Blazor will be my tool of choice to build apps inside WordPress.
As you might of figured out, this blog runs on WordPress, and it runs on a Linux host. WordPress is a great tool to through up a reasonably good looking ‘brochure’ website quickly. A Brochure site gives your company or product a Web presence and acts as an online version of a business card. WordPress comes with a simple registration/login system, and a zillion plugins to make site development productive and efficient. I have been using AngularJS inside WordPress to build applications, and that has worked pretty well. But I made the decision to wait on migrating to full Angular until I learned more about Blazor. After using Blazor a bit, I have decided I will not be moving to angular X – and start migrating my angularJS code to Blazor.
So here is my first application written in Blazor for WordPress. the dottet box below is a little app that pulls the most current weather forecast for Seattle from the US Weather Service (this may take a while to load):
Adding this application to WordPress was much simpler that I expected. All had to do was publish the application from Microsoft Visual Studio to a file on my development machine, then FTP the files up to a folder I added in the WordPress root directory. Then I just added the following script to this blog post:
After a few failed attempts (which really helped me understand some concepts of Blazor and Web Assembly), it all came together in my head and magically appeared on the page. I must admit the first time I got this working I felt the same way Dr Frankenstein felt
The Frankenstein analogy is not too far off, piecing together disparate technologies to create a web application platform, is somewhat amazing. My favorite feature of this approach is I wrote the application in the familiar confines of Microsoft Visual Studio, all in C Sharp, and no javascript. It’s a thing of beauty.
If you haven’t had a chance yet to look at Microsoft.net Blazor, check it out here. It is still in pre-release until May of 2020, but its worth experimenting with now. The more I work with it, the better I feel the dark days of javascript front end scripting frameworks and packages and transpiling are behind us. This is such a better model.
Hi Virtual Dan
I am very interested in this approach. I have a mostly completed website I did in Blazor, and I would like to bust it into its main components, and then publish it as a Word Press site.
Thank you for this article,
Daniel
Also I have a question.
If I have one page I would like to display as Blazor, but the other parts of the Blazor app I would prefer to send the text back to my WordPress page to show it.
So, I should be able to get by with only one assembly plugin correct?
thanks
Daniel
Hello Daniel,
I don’t know if you saw my updated post on this – http://dano.vfsystems.net/2020/10/blazor-and-wordpress-the-story-continues/ but I think that describes what you are trying to do.
in you blazor app, you could link to the wordpress pages (i.e. link to /wp-admin in your blazor page should take you to the wordpress admin page because I think the wordpress router will pick it up rather than the blazor router.
I havent messed with this much since 2020 – I know lean towards just going full on blazor, and if I need dynamic content just call the content out of a different wordpress site using the wordpress api.
One last note – I had to run blazor in wordpress by just copying the _framework, _content & _css folders built by blazor into my wordpress folder. So I was limited to having one Blazor app per wordpress site. But you should be able to sniff your current url in the blazor app to decide what content to display.
Hope that helps – again, I havent been working with this for a couple years, so my knowledge of how to configure it might be pretty outdated.
-Dan