diff --git a/src/Elastic.Markdown/HtmlWriter.cs b/src/Elastic.Markdown/HtmlWriter.cs
index 1d446c041..c841ab8b0 100644
--- a/src/Elastic.Markdown/HtmlWriter.cs
+++ b/src/Elastic.Markdown/HtmlWriter.cs
@@ -138,6 +138,7 @@ private async Task RenderLayout(MarkdownFile markdown, MarkdownDoc
UrlPathPrefix = markdown.UrlPathPrefix,
AppliesTo = markdown.YamlFrontMatter?.AppliesTo,
GithubEditUrl = editUrl,
+ MarkdownUrl = markdown.Url.TrimEnd('/') + ".md",
AllowIndexing = DocumentationSet.Context.AllowIndexing && (markdown.CrossLink.Equals("docs-content://index.md", StringComparison.OrdinalIgnoreCase) || markdown is DetectionRuleFile || !current.Hidden),
CanonicalBaseUrl = DocumentationSet.Context.CanonicalBaseUrl,
GoogleTagManager = DocumentationSet.Context.GoogleTagManager,
diff --git a/src/Elastic.Markdown/Layout/_TableOfContents.cshtml b/src/Elastic.Markdown/Layout/_TableOfContents.cshtml
index 6acd8711f..6302f666b 100644
--- a/src/Elastic.Markdown/Layout/_TableOfContents.cshtml
+++ b/src/Elastic.Markdown/Layout/_TableOfContents.cshtml
@@ -7,6 +7,14 @@
+ -
+
+
+ View as markdown
+
+
@if (!string.IsNullOrEmpty(Model.GithubEditUrl))
{
-
diff --git a/src/Elastic.Markdown/MarkdownLayoutViewModel.cs b/src/Elastic.Markdown/MarkdownLayoutViewModel.cs
index e28feda47..b310675b3 100644
--- a/src/Elastic.Markdown/MarkdownLayoutViewModel.cs
+++ b/src/Elastic.Markdown/MarkdownLayoutViewModel.cs
@@ -12,6 +12,8 @@ public record MarkdownLayoutViewModel : GlobalLayoutViewModel
{
public required string? GithubEditUrl { get; init; }
+ public required string MarkdownUrl { get; init; }
+
public required bool HideEditThisPage { get; init; }
public required string? ReportIssueUrl { get; init; }
diff --git a/src/Elastic.Markdown/Page/Index.cshtml b/src/Elastic.Markdown/Page/Index.cshtml
index 014ee76fd..e8624ab0f 100644
--- a/src/Elastic.Markdown/Page/Index.cshtml
+++ b/src/Elastic.Markdown/Page/Index.cshtml
@@ -29,6 +29,7 @@
NavigationFileName = Model.NavigationFileName,
UrlPathPrefix = Model.UrlPathPrefix,
GithubEditUrl = Model.GithubEditUrl,
+ MarkdownUrl = Model.MarkdownUrl,
HideEditThisPage = Model.Features.DisableGitHubEditLink && Model.IsAssemblerBuild,
AllowIndexing = Model.AllowIndexing,
CanonicalBaseUrl = Model.CanonicalBaseUrl,
@@ -48,6 +49,7 @@
{
+
}
if (name == GlobalSections.Head && Model.Products is { Count: > 0 })
{
diff --git a/src/Elastic.Markdown/Page/IndexViewModel.cs b/src/Elastic.Markdown/Page/IndexViewModel.cs
index 56281c75d..0adce5bdd 100644
--- a/src/Elastic.Markdown/Page/IndexViewModel.cs
+++ b/src/Elastic.Markdown/Page/IndexViewModel.cs
@@ -43,6 +43,7 @@ public class IndexViewModel
public required VersionDrownDownItemViewModel[]? VersionDropdownItems { get; init; }
public required string? UrlPathPrefix { get; init; }
public required string? GithubEditUrl { get; init; }
+ public required string MarkdownUrl { get; init; }
public required string? ReportIssueUrl { get; init; }
public required ApplicableTo? AppliesTo { get; init; }
public required bool AllowIndexing { get; init; }