Skip to content

Commit

Permalink
Update README.md to prevent issues between oc and blazor routing (#16835
Browse files Browse the repository at this point in the history
)

Co-authored-by: Hisham Bin Ateya <hishamco_2007@yahoo.com>
Co-authored-by: Zoltán Lehóczky <zoltan.lehoczky@lombiq.com>
  • Loading branch information
3 people authored Oct 4, 2024
1 parent dc94fdd commit 17017e3
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion src/docs/guides/create-blazor-cms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,50 @@ Run the application. Click on the `Orchard Core` link on the Left Nav will load
# Add multitenancy to the Blazor App
One of the key features of Orchard Core is its multi-tenancy support. In this section, we will add multi-tenancy support to our Blazor application.

!!! note
Orchard Core listens for requests, also on '/' (e.g. when a site needs to be configured). So having our Blazor app listening to '/' as well can pose a problem.
A solution is to replace `@page "/"` with `@page "/home"` in our `home.razor` file (and update our `navmenu.razor`), so Blazor (the app) will listen to `/home` while Orchard Core is not hindered by that.

=== "Home.razor"

```razor
@page "/home"
<PageTitle>Home</PageTitle>
<h1>Hello, Orchard!</h1>
Welcome to your new Blazor CMS app.
```

=== "NavMenu.razor"

```razor
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">BlazorCMS</a>
</div>
</div>
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="home" Match="NavLinkMatch.All">
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="content">
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Orchard Core
</NavLink>
</div>
@*More Nav links here *@
</nav>
</div>
```

## Enable the tenant feature.

In orchard core admin, go to `Configuration` -> `Features` and enable the `Tenants` feature.
Expand Down Expand Up @@ -985,4 +1029,4 @@ To further verify that there is now an active SignalR connection with the server

In this guide, we have seen how to create a Blazor application, in a Razor class library, and serve it from an Orchard Core CMS application. We have seen how to add multi-tenancy support to the Blazor application, and how to make the Blazor application interactive.

The source code for this guide is available at [github.com/OrchardCMS/OrchardCore.Samples](https://github.com/OrchardCMS/OrchardCore.Samples)
The source code for this guide is available at [github.com/OrchardCMS/OrchardCore.Samples](https://github.com/OrchardCMS/OrchardCore.Samples)

0 comments on commit 17017e3

Please sign in to comment.