36 lines
843 B
Plaintext
36 lines
843 B
Plaintext
@using Microsoft.Extensions.Options
|
|
@using OpenArchival.Blazor.Config;
|
|
|
|
@page "/"
|
|
|
|
<PageTitle>Home</PageTitle>
|
|
@if (string.IsNullOrEmpty(_htmlContent))
|
|
{
|
|
<p>Loading content...</p>
|
|
}
|
|
else
|
|
{
|
|
@((MarkupString)_htmlContent)
|
|
}
|
|
|
|
@inject IOptions<ApplicationOptions> AppOptions;
|
|
@code {
|
|
private string _htmlContent = $"<h1>HTML file not found for homepage. Create one at /admin/homepageeditor</h1>";
|
|
|
|
protected override async void OnInitialized()
|
|
{
|
|
try
|
|
{
|
|
using var reader = new StreamReader(AppOptions.Value.HomepageContentLocation);
|
|
_htmlContent = await reader.ReadToEndAsync();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_htmlContent = $"<h1>HTML file not found for homepage. Create one at /admin/homepageeditor</h1>";
|
|
}
|
|
|
|
StateHasChanged();
|
|
}
|
|
|
|
}
|