GithubHelp home page GithubHelp logo

marinasundstrom / headless-wordpress-blazor Goto Github PK

View Code? Open in Web Editor NEW
14.0 1.0 2.0 19.72 MB

Headless Wordpress with Blazor frontend

License: Other

HTML 18.77% C# 10.74% CSS 66.97% PHP 3.52%
wordpress headless-cms blazor blazor-server tye aspnet-core php csharp dotnet peachpie bootstrap5

headless-wordpress-blazor's Introduction

Headless WordPress with Blazor frontend

Frontend build with Blazor, using Wordpress, running on .NET, as a headless CMS,

Pre-configured for a containerized development environment using Docker Compose

Watch Demo Video

Features

  • List excerpts of posts, and view full posts.
  • Display a Menu/Navigation that has been defined in Wordpress.

Acknowledgements

Thanks to the guys at Iolevel, and the community, for the wonderful Peachpie PHP compiler, and Wordpress.NET.

And a special thanks to the Wordpress community for this awesome ecosystem

Screenshots

Frontend (Blazor)

Index Post

Run the app with Docker Compose

This is the simplest way of running this project.

But you need to do the necessary configuration of Wordpress.

$ docker compose up -d

The Blazor Frontend is served at: https://localhost:5001/

While Wordpress is at: https://localhost:5005/.

Tip

** This seem to break the Gutenberg Editor since it is using the setting when sending requests to Wordpress. **

For convenience, you can change the Site Address (URL) in WP Admin (Settings > General) to be the address of the frontend. Now the links in WP Admin that lead to the frontend will be correct.

Manual installation

Create MySQL database

WordPress requires you to start your database server with a database in it. By default it expects a database server on localhost, port 3306, with a database named "wordpress".

You can use docker to quickly start a database server in virtual environment:

docker run -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=wordpress -p 3306:3306 -d mysql

Build & Run

Note, this is a regular ASP.NET web project. Building, running, debugging, and deploying the site take advantage of dotnet, optionally Visual Studio.

dotnet run

Configuration

The configuration itself serves as a demonstration of combining a legacy PHP application with .NET. The demo takes advantage of the ASP.NET Core configuration mechanism, namely the files appsettings.json, appsettings.deployment.json and appsettings.production.json. This allows for having a different configuration for each environment without the need of altering the source code of the project.

More on configuring WpDotNet on https://docs.peachpie.io/scenarios/wordpress/configuration/.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.