Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions src/Elastic.Codex/Page/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@
{
if (name == GlobalSections.Head)
{
<meta class="elastic" name="product_version" content="@(new HtmlString(Model.CurrentVersion))"/>
<meta name="DC.identifier" content="@(new HtmlString(Model.CurrentVersion))"/>
@if (Model.CurrentVersion is not null)
{
<meta class="elastic" name="product_version" content="@(new HtmlString(Model.CurrentVersion))"/>
<meta name="DC.identifier" content="@(new HtmlString(Model.CurrentVersion))"/>
}
<link rel="alternate" type="text/markdown" href="@(Model.MarkdownUrl)" title="Markdown export"/>
<script type="application/ld+json">
@(new HtmlString(Model.StructuredBreadcrumbsJson))
Expand Down
4 changes: 3 additions & 1 deletion src/Elastic.Markdown/HtmlWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ private async Task<RenderResult> RenderLayout(MarkdownFile markdown, MarkdownDoc
?? throw new InvalidOperationException($"No versioning system available for page '{markdown.RelativePath}'. " +
"Ensure VersionsConfiguration contains a Stack versioning system or the inferred product has a VersioningSystem defined.");

var currentBaseVersion = $"{pageVersioning.Base.Major}.{pageVersioning.Base.Minor}+";
var currentBaseVersion = pageVersioning.IsVersionless
? null
: $"{pageVersioning.Base.Major}.{pageVersioning.Base.Minor}+";

//TODO should we even distinctby
var breadcrumbs = parents.Reverse().DistinctBy(p => p.Url).ToArray();
Expand Down
7 changes: 5 additions & 2 deletions src/Elastic.Markdown/Page/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@
{
if (name == GlobalSections.Head)
{
<meta class="elastic" name="product_version" content="@(new HtmlString(Model.CurrentVersion))"/>
<meta name="DC.identifier" content="@(new HtmlString(Model.CurrentVersion))"/>
@if (Model.CurrentVersion is not null)
{
<meta class="elastic" name="product_version" content="@(new HtmlString(Model.CurrentVersion))"/>
<meta name="DC.identifier" content="@(new HtmlString(Model.CurrentVersion))"/>
}
<link rel="alternate" type="text/markdown" href="@(Model.MarkdownUrl)" title="Markdown export"/>
<script type="application/ld+json">
@(new HtmlString(Model.StructuredBreadcrumbsJson))
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.Markdown/Page/IndexViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class IndexViewModel

public required string NavigationHtml { get; init; }

public required string CurrentVersion { get; init; }
public required string? CurrentVersion { get; init; }

public required string? AllVersionsUrl { get; init; }
public required LegacyPageMapping[]? LegacyPages { get; init; }
Expand Down
Loading