Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/docs-builder/Http/DocumentationWebHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,14 @@ private static async Task<IResult> ServeDocumentationFile(ReloadableGeneratorSta
case ImageFile image:
return Results.File(image.SourceFile.FullName, image.MimeType);
default:
if (generator.DocumentationSet.FlatMappedFiles.TryGetValue("404.md", out var notFoundDocumentationFile))
{
var renderedNotFound = await generator.RenderLayout((notFoundDocumentationFile as MarkdownFile)!, ctx);
return Results.Content(renderedNotFound, "text/html", null, (int)HttpStatusCode.NotFound);
}
return Results.NotFound();
if (s == "index.md")
return Results.Redirect(generator.DocumentationSet.MarkdownFiles.First().Value.Url);

if (!generator.DocumentationSet.FlatMappedFiles.TryGetValue("404.md", out var notFoundDocumentationFile))
return Results.NotFound();

var renderedNotFound = await generator.RenderLayout((notFoundDocumentationFile as MarkdownFile)!, ctx);
return Results.Content(renderedNotFound, "text/html", null, (int)HttpStatusCode.NotFound);
}
}
}
Loading