From 754686a6bae78caaeea66860458c4f67ed77d1b7 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 3 Dec 2024 16:42:11 +0100 Subject: [PATCH] Fallback to relative path for title and navigation title --- docs/source/docset.yml | 1 + src/Elastic.Markdown/IO/MarkdownFile.cs | 5 +++++ src/docs-builder/Http/ReloadGeneratorService.cs | 2 ++ 3 files changed, 8 insertions(+) diff --git a/docs/source/docset.yml b/docs/source/docset.yml index 7ff94268..9d1e5678 100644 --- a/docs/source/docset.yml +++ b/docs/source/docset.yml @@ -45,4 +45,5 @@ toc: children: - folder: content - file: index.md + - file: test.md - folder: versioning diff --git a/src/Elastic.Markdown/IO/MarkdownFile.cs b/src/Elastic.Markdown/IO/MarkdownFile.cs index 87333ae7..27820531 100644 --- a/src/Elastic.Markdown/IO/MarkdownFile.cs +++ b/src/Elastic.Markdown/IO/MarkdownFile.cs @@ -72,6 +72,11 @@ private void ReadDocumentInstructions(MarkdownDocument document) Title = YamlFrontMatter.Title; NavigationTitle = YamlFrontMatter.NavigationTitle; } + else + { + Title = RelativePath; + NavigationTitle = RelativePath; + } var contents = document .Where(block => block is HeadingBlock { Level: 2 }) diff --git a/src/docs-builder/Http/ReloadGeneratorService.cs b/src/docs-builder/Http/ReloadGeneratorService.cs index 118681fd..11ad5e84 100644 --- a/src/docs-builder/Http/ReloadGeneratorService.cs +++ b/src/docs-builder/Http/ReloadGeneratorService.cs @@ -66,6 +66,8 @@ private void OnChanged(object sender, FileSystemEventArgs e) if (e.FullPath.EndsWith("docset.yml")) Reload(); + if (e.FullPath.EndsWith(".md")) + Reload(); Logger.LogInformation($"Changed: {e.FullPath}"); }