Skip to content

Commit 4e89adc

Browse files
authored
Clarify static asset paths in Blazor apps (dotnet#17024)
1 parent 3f91974 commit 4e89adc

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

aspnetcore/blazor/components.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to create and use Razor components, including how to bind
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 02/12/2020
8+
ms.date: 02/15/2020
99
no-loc: [Blazor, SignalR]
1010
uid: blazor/components
1111
---
@@ -58,7 +58,17 @@ To use a custom folder, add the custom folder's namespace to either the parent c
5858
@using BlazorApp.Components
5959
```
6060

61-
## Tag Helpers aren't used in components
61+
## Static asset paths
62+
63+
Use a base-relative path (`/`) to refer to the project root for a static asset:
64+
65+
```razor
66+
<img alt="Company logo" src="/images/logo.png" />
67+
```
68+
69+
Tilde-slash notation (`~/`) used in web apps is **not** supported in Razor components.
70+
71+
## Tag Helpers aren't supported in components
6272

6373
[Tag Helpers](xref:mvc/views/tag-helpers/intro) aren't supported in Razor components (*.razor* files). To provide Tag Helper-like functionality in Blazor, create a component with the same functionality as the Tag Helper and use the component instead.
6474

0 commit comments

Comments
 (0)