Skip to content

Commit e69d739

Browse files
reakaleekCopilot
andauthored
Add products frontmatter (#1226)
* Add `products` frontmatter * Add link to documentation * Cleanup * Fix linter' * Fix * Use EnumGenerator * Move suggestion logic into its own class * Update docs/syntax/frontmatter.md Co-authored-by: Copilot <[email protected]> * Cleanup * Move PackageVersion to appropriate ItemGroup --------- Co-authored-by: Copilot <[email protected]>
1 parent e145934 commit e69d739

File tree

13 files changed

+583
-14
lines changed

13 files changed

+583
-14
lines changed

Directory.Packages.props

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<PackageVersion Include="Amazon.Lambda.SQSEvents" Version="2.2.0" />
1616
<PackageVersion Include="AWSSDK.Core" Version="4.0.0.2" />
1717
<PackageVersion Include="AWSSDK.SQS" Version="4.0.0.1" />
18-
<PackageVersion Include="AWSSDK.S3" Version="4.0.0.1"/>
18+
<PackageVersion Include="AWSSDK.S3" Version="4.0.0.1" />
1919
</ItemGroup>
2020
<!-- Build -->
2121
<ItemGroup>
@@ -32,7 +32,7 @@
3232
<PackageVersion Include="Crayon" Version="2.0.69" />
3333
<PackageVersion Include="DotNet.Glob" Version="3.1.3" />
3434
<PackageVersion Include="Errata" Version="0.14.0" />
35-
<PackageVersion Include="Github.Actions.Core" Version="9.0.0"/>
35+
<PackageVersion Include="Github.Actions.Core" Version="9.0.0" />
3636
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.4" />
3737
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.4" />
3838
<PackageVersion Include="Markdig" Version="0.41.1" />
@@ -48,6 +48,7 @@
4848
<PackageVersion Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="16.1.3" PrivateAssets="All" />
4949
<PackageVersion Include="Westwind.AspNetCore.LiveReload" Version="0.5.2" />
5050
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
51+
<PackageVersion Include="Supernova.Enum.Generators" Version="1.0.17" />
5152
</ItemGroup>
5253
<!-- Test packages -->
5354
<ItemGroup>
@@ -63,4 +64,4 @@
6364
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
6465
<PackageVersion Include="xunit.v3" Version="1.1.0" />
6566
</ItemGroup>
66-
</Project>
67+
</Project>

docs/syntax/frontmatter.md

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,111 @@ navigation_title: This is the navigation title <1>
1212
description: This is a description of the page <2>
1313
applies_to: <3>
1414
serverless: all
15+
products: <4>
16+
- apm-java-agent
17+
- edot-java
1518
---
1619
```
20+
1721
1. [`navigation_title`](#navigation-title)
1822
2. [`description`](#description)
1923
3. [`applies_to`](#applies-to)
24+
4. [`products`](#products)
2025

2126
## Navigation Title
27+
2228
See [](./titles.md)
2329

2430
## Description
2531

26-
Use the `description` frontmatter to set the description meta tag for a page.
32+
Use the `description` frontmatter to set the description meta tag for a page.
2733
This helps search engines and social media.
2834
It also sets the `og:description` and `twitter:description` meta tags.
2935

30-
The `description` frontmatter is a string, recommended to be around 150 characters. If you don't set a `description`,
36+
The `description` frontmatter is a string, recommended to be around 150 characters. If you don't set a `description`,
3137
it will be generated from the first few paragraphs of the page until it reaches 150 characters.
3238

3339
## Applies to
40+
3441
See [](./applies.md)
42+
43+
## Products
44+
45+
The products frontmatter is a list of products that the page relates to.
46+
This is used for the "Products" filter in the Search UI.
47+
48+
The products frontmatter is a list of strings, each string is the id of a product.
49+
50+
| Product ID | Product Name |
51+
|---------------------------------------------|-----------------------------------------------|
52+
| `apm` | APM |
53+
| `apm-android-agent` | APM Android Agent |
54+
| `apm-attacher` | APM Attacher |
55+
| `apm-aws-lambda-extension` | APM AWS Lambda extension |
56+
| `apm-dotnet-agent` | APM .NET Agent |
57+
| `apm-go-agent` | APM Go Agent |
58+
| `apm-ios-agent` | APM iOS Agent |
59+
| `apm-java-agent` | APM Java Agent |
60+
| `apm-node-agent` | APM Node.js Agent |
61+
| `apm-php-agent` | APM PHP Agent |
62+
| `apm-python-agent` | APM Python Agent |
63+
| `apm-ruby-agent` | APM Ruby Agent |
64+
| `apm-rum-agent` | APM RUM Agent |
65+
| `beats-logging-plugin` | Beats Logging plugin |
66+
| `cloud-control-ecctl` | Cloud Control ECCTL |
67+
| `cloud-enterprise` | Cloud Enterprise |
68+
| `cloud-hosted` | Cloud Hosted |
69+
| `cloud-kubernetes` | Cloud Kubernetes |
70+
| `cloud-native-ingest` | Cloud Native Ingest |
71+
| `cloud-serverless` | Cloud Serverless |
72+
| `cloud-terraform` | Cloud Terraform |
73+
| `ecs` | Elastic Common Schema (ECS) |
74+
| `ecs-logging-dotnet` | ECS Logging .NET |
75+
| `ecs-logging-go-logrus` | ECS Logging Go Logrus |
76+
| `ecs-logging-go-zap` | ECS Logging Go Zap |
77+
| `ecs-logging-go-zerolog` | ECS Logging Go Zerolog |
78+
| `ecs-logging-java` | ECS Logging Java |
79+
| `ecs-logging-node` | ECS Logging Node.js |
80+
| `ecs-logging-php` | ECS Logging PHP |
81+
| `ecs-logging-python` | ECS Logging Python |
82+
| `ecs-logging-ruby` | ECS Logging Ruby |
83+
| `edot-android` | Elastic Distribution of OpenTelemetry Android |
84+
| `edot-collector` | Elastic Distribution of OpenTelemetry Collector |
85+
| `edot-dotnet` | Elastic Distribution of OpenTelemetry .NET |
86+
| `edot-ios` | Elastic Distribution of OpenTelemetry iOS |
87+
| `edot-java` | Elastic Distribution of OpenTelemetry Java |
88+
| `edot-nodejs` | Elastic Distribution of OpenTelemetry Node.js |
89+
| `edot-php` | Elastic Distribution of OpenTelemetry PHP |
90+
| `edot-python` | Elastic Distribution of OpenTelemetry Python |
91+
| `elastic-agent` | Elastic Agent |
92+
| `elastic-products-platform` | Elastic Products platform |
93+
| `elastic-stack` | Elastic Stack |
94+
| `elasticsearch` | Elasticsearch |
95+
| `elasticsearch-apache-hadoop` | Elasticsearch Apache Hadoop |
96+
| `elasticsearch-cloud-hosted-heroku` | Elasticsearch Cloud Hosted Heroku |
97+
| `elasticsearch-community-clients` | Elasticsearch community clients |
98+
| `elasticsearch-curator` | Elasticsearch Curator |
99+
| `elasticsearch-dotnet-client` | Elasticsearch .NET Client |
100+
| `elasticsearch-eland-python-client` | Elasticsearch Eland Python Client |
101+
| `elasticsearch-go-client` | Elasticsearch Go Client |
102+
| `elasticsearch-groovy-client` | Elasticsearch Groovy Client |
103+
| `elasticsearch-java-client` | Elasticsearch Java Client |
104+
| `elasticsearch-java-script-client` | Elasticsearch JavaScript Client |
105+
| `elasticsearch-painless-scripting-language` | Elasticsearch Painless scripting language |
106+
| `elasticsearch-perl-client` | Elasticsearch Perl Client |
107+
| `elasticsearch-php-client` | Elasticsearch PHP Client |
108+
| `elasticsearch-plugins` | Elasticsearch plugins |
109+
| `elasticsearch-python-client` | Elasticsearch Python Client |
110+
| `elasticsearch-resiliency-status` | Elasticsearch Resiliency Status |
111+
| `elasticsearch-ruby-client` | Elasticsearch Ruby Client |
112+
| `elasticsearch-rust-client` | Elasticsearch Rust Client |
113+
| `fleet` | Fleet |
114+
| `ingest` | Ingest |
115+
| `integrations` | Integrations |
116+
| `kibana` | Kibana |
117+
| `logstash` | Logstash |
118+
| `machine-learning` | Machine Learning |
119+
| `observability` | Observability |
120+
| `reference-architectures` | Reference Architectures |
121+
| `search-ui` | Search UI |
122+
| `security` | Security |

src/Elastic.Markdown/Elastic.Markdown.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
<PackageReference Include="Microsoft.Extensions.Logging" />
5757
<PackageReference Include="RazorSlices" />
5858
<PackageReference Include="Slugify.Core" />
59+
<PackageReference Include="Supernova.Enum.Generators" />
5960
<PackageReference Include="Utf8StreamReader" />
6061
<PackageReference Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" />
6162
<PackageReference Include="YamlDotNet" />

src/Elastic.Markdown/IO/MarkdownFile.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ private YamlFrontMatter ReadYamlFrontMatter(string raw)
330330
{
331331
return YamlSerialization.Deserialize<YamlFrontMatter>(raw);
332332
}
333+
catch (InvalidProductException e)
334+
{
335+
Collector.EmitError(FilePath, "Invalid product in yaml front matter.", e);
336+
return new YamlFrontMatter();
337+
}
333338
catch (Exception e)
334339
{
335340
Collector.EmitError(FilePath, "Failed to parse yaml front matter block.", e);

src/Elastic.Markdown/Myst/FrontMatter/FrontMatterParser.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
using System.Runtime.Serialization;
65
using YamlDotNet.Serialization;
76

87
namespace Elastic.Markdown.Myst.FrontMatter;
98

10-
public enum LayoutName
11-
{
12-
[EnumMember(Value = "landing-page")] LandingPage,
13-
[EnumMember(Value = "not-found")] NotFound,
14-
[EnumMember(Value = "archive")] Archive
15-
}
16-
179
[YamlSerializable]
1810
public class YamlFrontMatter
1911
{
@@ -38,4 +30,7 @@ public class YamlFrontMatter
3830

3931
[YamlMember(Alias = "mapped_pages")]
4032
public IReadOnlyCollection<string>? MappedPages { get; set; }
33+
34+
[YamlMember(Alias = "products")]
35+
public IReadOnlyCollection<Product>? Products { get; set; }
4136
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
using System.Runtime.Serialization;
6+
7+
namespace Elastic.Markdown.Myst.FrontMatter;
8+
9+
public enum LayoutName
10+
{
11+
[EnumMember(Value = "landing-page")] LandingPage,
12+
[EnumMember(Value = "not-found")] NotFound,
13+
[EnumMember(Value = "archive")] Archive
14+
}

0 commit comments

Comments
 (0)