Skip to content

Commit 04897dc

Browse files
committed
Set Title via JSInterop instead of partially unsupported component
1 parent 861ba68 commit 04897dc

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

LinkDotNet.Blog.Web/Pages/BlogPostPage.razor

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
@using LinkDotNet.Domain
55
@using LinkDotNet.Infrastructure.Persistence
66
@using Markdig
7-
@using Microsoft.AspNetCore.Components.Web.Extensions.Head
87
@inject IRepository _repository
98
@inject IJSRuntime _jsRuntime
109
@inherits MarkdownComponentBase

LinkDotNet.Blog.Web/Pages/_Host.cshtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@
4141
<a href="" class="reload">Reload</a>
4242
<a class="dismiss">🗙</a>
4343
</div>
44-
44+
<script>
45+
window.setDocumentTitle = (title) => {
46+
document.title = title;
47+
};
48+
</script>
4549
<script src="_framework/blazor.server.js"></script>
46-
<script async src="_content/Microsoft.AspNetCore.Components.Web.Extensions/headManager.js" type="module"></script>
4750
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.0.1/highlight.min.js" integrity="sha512-W7EehcwtSbRF63FIQlXEOOd5mnq0Et0V0nUOvwcUvjnCKgOLLYbqriQxEQSp63sfrkryxIg/A/O8v8O18QwQCQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
4851
<script async src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.0.1/languages/csharp.min.js" integrity="sha512-2GO++5/u4InQ3/o7fLh93nyZIzTFl7fYi7+RjP7pgxsXikSCRf5jjw8U8vQSfCfFolN8G8xAxct9696uVxtQSg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
4952
<script async src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/js/all.min.js" integrity="sha512-RXf+QSDCUQs5uwRKaDoXt55jygZZm2V++WUZduaU/Ui/9EGp3f/2KZVahFZBKGH0s774sd3HmrhUy+SgOFQLVQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@inject IJSRuntime _jsRuntime
2+
3+
@code {
4+
[Parameter]
5+
public string Value { get; set; }
6+
7+
protected override async Task OnParametersSetAsync()
8+
{
9+
await _jsRuntime.InvokeVoidAsync("setDocumentTitle", Value);
10+
}
11+
}

LinkDotNet.Blog.Web/appsettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"LinkedInAccountUrl": "",
1313
"Introduction": {
1414
"Description": "Hey, my name is **Steven**. I am a **.NET Developer** based in Zurich, Switzerland. This is my small blog, which I wrote completely in Blazor. If you want to know more about me just check out my LinkedIn or Github.\nAlso this blogsoftware is open source on [Github](https://github.com/linkdotnet/blog)",
15-
"BackgroundUrl": "assets/profile-background.png",
16-
"ProfilePictureUrl": "assets/profile-picture.jfif"
15+
"BackgroundUrl": "assets/profile-background.webp",
16+
"ProfilePictureUrl": "assets/profile-picture.webp"
1717
},
1818
"ConnectionString": "",
1919
"DatabaseName": "",

0 commit comments

Comments
 (0)