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