Skip to content

Commit

Permalink
Add image to home and leaderboard meta data
Browse files Browse the repository at this point in the history
  • Loading branch information
Simyon264 committed Aug 22, 2024
1 parent 7915a48 commit 242d064
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ReplayBrowser/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@inject ReplayHelper ReplayHelper
@inject AuthenticationStateProvider AuthenticationStateProvider

<MetaDataSpecifer/>
<MetaDataSpecifer IncludeImage="true"/>

<PageTitle>Replay browser</PageTitle>

Expand Down
1 change: 1 addition & 0 deletions ReplayBrowser/Pages/Leaderboard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<MetaDataSpecifer
Title="Leaderboards"
Description="View leaderboards for various tracked statistics. See how you compare to other players!"
IncludeImage="true"
/>

<PageTitle>Leaderboard</PageTitle>
Expand Down
19 changes: 16 additions & 3 deletions ReplayBrowser/Pages/Shared/MetaDataSpecifer.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,38 @@
<meta name="title" content="Replay Browser @Title" />
<meta name="description" content="@Description" />
<meta name="theme-color" content="#9d32a8">

<meta property="og:type" content="website" />
<meta property="og:url" content="@NavigationManager.Uri" />
<meta property="og:title" content="Replay Browser @Title" />
<meta property="og:description" content="@Description" />

<meta property="og:locale" content="en_GB">

<meta property="twitter:card" content="summary" />
<meta property="twitter:url" content="@NavigationManager.Uri" />
<meta property="twitter:title" content="Replay Browser @Title" />
<meta property="twitter:description" content="@Description" />

@if (IncludeImage)
{
<meta property="og:image" content="@ImageUrl" />
<meta property="twitter:image" content="@ImageUrl" />
}

</HeadContent>

@code {
[Parameter]
public string? Title { get; set; }

[Parameter]
public string? Description { get; set; }

[Parameter]
public bool IncludeImage { get; set; } = false;

private string ImageUrl => $"{NavigationManager.BaseUri}assets/img/replaybrowser-white.png";

protected override void OnInitialized()
{
Description ??= "Search and browse replays for Space Station 14.";
Expand Down

0 comments on commit 242d064

Please sign in to comment.