Skip to content

Commit e6ae834

Browse files
committed
Use built-in meta and title update
1 parent 48c6d9d commit e6ae834

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

LinkDotNet.Blog.Web/LinkDotNet.Blog.Web.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2222
</PackageReference>
2323
<PackageReference Include="Toolbelt.Blazor.HeadElement" Version="6.0.0" />
24-
<PackageReference Include="Toolbelt.Blazor.HeadElement.ServerPrerendering" Version="6.0.0" />
2524
</ItemGroup>
2625

2726
<ItemGroup>

LinkDotNet.Blog.Web/Pages/BlogPostPage.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
else
1818
{
19-
<Title>@BlogPost.Title</Title>
19+
<PageTitle>@BlogPost.Title</PageTitle>
2020
<OgData Title="@BlogPost.Title"
2121
AbsolutePreviewImageUrl="@BlogPost.PreviewImageUrl"
2222
Description="@(Markdown.ToPlainText(BlogPost.ShortDescription))"

LinkDotNet.Blog.Web/Pages/SearchByTag.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@inject IRepository<BlogPost> blogPostRepository
77
@inject IUserRecordService userRecordService
88

9-
<Title>Search for tag: @Tag</Title>
9+
<PageTitle>Search for tag: @Tag</PageTitle>
1010

1111
<h3>All posts with Tag <em>@Tag</em></h3>
1212

LinkDotNet.Blog.Web/Pages/_Host.cshtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@page "/"
22
@namespace LinkDotNet.Blog.Web.Pages
3+
@using Microsoft.AspNetCore.Components.Web
34
@inject AppConfiguration appConfiguration
45
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
56
@{
@@ -33,6 +34,7 @@
3334
<link rel="preload" href="_content/Blazored.Toast/blazored-toast.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'"><noscript><link rel="stylesheet" href="_content/Blazored.Toast/blazored-toast.min.css"></noscript>
3435
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
3536
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/monokai.min.css" integrity="sha512-RLF8eOxhuwsRINc7r56dpl9a3VStqrXD+udWahutJrYdyh++2Ghnf+s4jFsOyryKZt/GNjPwbXVPH3MJpKrn2g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
37+
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
3638
</head>
3739
<body>
3840
<component type="typeof(App)" render-mode="ServerPrerendered"/>

LinkDotNet.Blog.Web/Shared/OgData.razor

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
@inject NavigationManager navigationManager
22
@using Toolbelt.Blazor.HeadElement
33

4-
<Meta Name="title" Property="og:title" Content="@Title" />
5-
<Meta Name="image" Property="og:image" Content="@AbsolutePreviewImageUrl" />
6-
<Meta Property="og:type" Content="article" />
7-
<Meta Property="og:url" Content="@navigationManager.Uri" />
8-
@if (Keywords != null)
9-
{
10-
<Meta name="keywords" content="@Keywords"/>
11-
}
12-
@if (Description != null)
13-
{
14-
<Meta name="description" property="og:description" content="@Description" />
15-
}
16-
4+
<HeadContent>
5+
<meta name="title" property="og:title" content="@Title" />
6+
<meta name="image" property="og:image" content="@AbsolutePreviewImageUrl" />
7+
<meta property="og:type" content="article" />
8+
<meta property="og:url" content="@navigationManager.Uri" />
9+
@if (Keywords != null)
10+
{
11+
<meta name="keywords" content="@Keywords"/>
12+
}
13+
@if (Description != null)
14+
{
15+
<meta name="description" property="og:description" content="@Description" />
16+
}
17+
</HeadContent>
1718
@code {
1819

1920
[Parameter]

LinkDotNet.Blog.Web/Startup.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
5757
app.UseHsts();
5858
}
5959

60-
app.UseHeadElementServerPrerendering();
61-
6260
app.UseHttpsRedirection();
6361
app.UseStaticFiles();
6462

@@ -74,4 +72,4 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
7472
endpoints.MapFallbackToPage("/_Host");
7573
});
7674
}
77-
}
75+
}

0 commit comments

Comments
 (0)