|
2 | 2 |
|
3 | 3 | ABP theming system places the page layout into the [theme](theming.md) NuGet packages. That means the final application doesn't include a layout, so you can't directly change the layout code to customize it.
|
4 | 4 |
|
5 |
| -> If you create a Blazor WASM project, the `index.html` file will be included within the template. You can also customize it to your needs. |
| 5 | +> If you created your Blazor application with ABP templates, then you'll have an `App.razor` file in your project. You can customize it to your needs and even extend it with layout hooks. |
6 | 6 |
|
7 | 7 | You can copy the theme code into your solution. In this case, you are completely free to customize it. However, then you won't be able to get automatic updates of the theme (by upgrading the theme NuGet package).
|
8 | 8 |
|
@@ -101,11 +101,41 @@ See the *Layouts* section below to learn more about the layout system.
|
101 | 101 |
|
102 | 102 | There are some pre-defined layout hook points. The standard hook points are:
|
103 | 103 |
|
| 104 | +* `LayoutHooks.Head.First`: Used to add a component as the first item in the HTML head tag. |
| 105 | +* `LayoutHooks.Head.Last`: Used to add a component as the last item in the HTML head tag. |
104 | 106 | * `LayoutHooks.Body.First`: Used to add a component as the first item in the HTML body tag.
|
105 | 107 | * `LayoutHooks.Body.Last`: Used to add a component as the last item in the HTML body tag.
|
106 | 108 |
|
107 | 109 | > You (or the modules you are using) can add **multiple items to the same hook point**. All of them will be added to the layout in the order they were added.
|
108 | 110 |
|
| 111 | +### Render LayoutHooks.Head in App.razor |
| 112 | + |
| 113 | +In your Blazor application, there is an `App.razor` file, which acts as the entry point of your application. If you need to render layout hooks between the **head** tags, then you should manually register the layout hooks as below: |
| 114 | + |
| 115 | +```csharp |
| 116 | +@using Volo.Abp.AspNetCore.Components.Web.Theming.Components.LayoutHooks; |
| 117 | +@using Volo.Abp.Ui.LayoutHooks; |
| 118 | +@using Volo.Abp.AspNetCore.Components.Web.Theming.Layout; |
| 119 | + |
| 120 | +<!DOCTYPE html> |
| 121 | +<html> |
| 122 | +<head> |
| 123 | + <LayoutHook Name="@LayoutHooks.Head.First" Layout="@StandardLayouts.Application" /> |
| 124 | + |
| 125 | + // Your head content |
| 126 | + // ... |
| 127 | +
|
| 128 | + <LayoutHook Name="@LayoutHooks.Head.Last" Layout="@StandardLayouts.Application" /> |
| 129 | +</head> |
| 130 | +<body> |
| 131 | + // Your body content |
| 132 | + // ... |
| 133 | +</body> |
| 134 | +</html> |
| 135 | +``` |
| 136 | + |
| 137 | +After registering the related layout hooks, you can define components to render in the specific place accordingly as mentioned above. |
| 138 | + |
109 | 139 | ## Layouts
|
110 | 140 |
|
111 | 141 | The layout system allows themes to define the standard named layouts and allows any page to select a proper layout for its purpose. There is one pre-defined layout:
|
|
0 commit comments