Skip to content

Commit 791f565

Browse files
authored
Update applies_to Stack/Serverless/Deploy/Product render order (#1727)
* update applies_to render order Signed-off-by: bmorelli25 <[email protected]> * more complex test Signed-off-by: bmorelli25 <[email protected]> * Add brief docs Signed-off-by: bmorelli25 <[email protected]> * clean * ECH,ECK,ECE,SELF Signed-off-by: bmorelli25 <[email protected]> * test deployment type order Signed-off-by: bmorelli25 <[email protected]> * add docs Signed-off-by: bmorelli25 <[email protected]> --------- Signed-off-by: bmorelli25 <[email protected]>
1 parent 7804439 commit 791f565

File tree

4 files changed

+169
-92
lines changed

4 files changed

+169
-92
lines changed

docs/contribute/cumulative-docs/guidelines.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,37 @@ You generally do not need to tag:
115115

116116
### Versions
117117

118-
Always put the newest version first when listing multiple versions. As a result, the lifecycles should be in reverse order of product development progression, too.
118+
When listing multiple versions, author the newest version first whenever possible. This keeps files consistent and easier to maintain.
119+
Regardless of the source file, the build system automatically builds badge lifecycles in reverse chronological order.
120+
This means that badges will always appear to users from newest to oldest, which is the reverse of the product development timeline.
119121

120-
% TO DO: Add example / image
121-
% <image>
122+
For example:
123+
124+
{applies_to}`stack: preview 9.0.5, beta 9.1, ga 9.2`
122125

123-
% Reference: https://elastic.github.io/docs-builder/versions/#defaults-and-hierarchy
124-
% Needs work...
125126
### Keys
126127

127-
Always list [keys](/contribute/cumulative-docs/reference.md#key) in the same order for consistency. The order of keys should reflect organizational priorities. For example, use the following order:
128-
* **Serverless/Elastic Stack**: Serverless, Stack
129-
* **Deployment types**: Elastic Cloud Serverless, Elastic Cloud Hosted, Elastic Cloud on Kubernetes, Elastic Cloud Enterprise, Self-managed
130-
* **Monitoring for Java applications**: Elastic Distribution of OpenTelemetry (EDOT) Java, APM Java agent
128+
The build system automatically orders multiple [keys](/contribute/cumulative-docs/reference.md#key) in a consistent pattern. This reduces authoring overhead and makes content easier for users to scan.
129+
130+
:::{important}
131+
Key ordering only occurs if all keys are declared in the same directive. Keys declared seperately, for example: ``` {applies_to}`stack: ga` {applies_to}`serverless: preview` ```, will not be reordered by docs-builder.
132+
:::
133+
134+
Keys are ordered as follows:
131135

132-
% TO DO: Add example / image
133-
% <image>
136+
1. **Stack/Serverless**: Stack, Serverless
137+
2. **Deployment types**: ECH (Elastic Cloud Hosted), ECK (Elastic Cloud on Kubernetes), ECE (Elastic Cloud Enterprise), Self-Managed
138+
3. **ProductApplicability**: ECCTL, Curator, EDOT items (alphabetically), APM Agent items (alphabetically)
139+
140+
For example:
141+
142+
```{applies_to}
143+
deployment:
144+
ece: ga
145+
self: ga
146+
stack: ga
147+
serverless: ga
148+
```
134149

135150
## Product and deployment model applicability [products-and-deployment-models]
136151

docs/syntax/applies.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,15 @@ nec dignissim. Vestibulum ut felis nec massa auctor placerat. Maecenas vel dictu
287287
| `` {applies_to}`serverless: beta` `` | {applies_to}`serverless: beta` |
288288
| `` {applies_to}`serverless: deprecated` `` | {applies_to}`serverless: deprecated` |
289289
| `` {applies_to}`serverless: removed` `` | {applies_to}`serverless: removed` |
290+
291+
### Badge rendering order
292+
293+
`applies_to` badges are displayed in a consistent order regardless of how they appear in your source files. This ensures users always see badges in a predictable hierarchy:
294+
295+
1. **Stack** - Elastic Stack
296+
2. **Serverless** - Elastic Cloud Serverless offerings
297+
3. **Deployment** - Deployment options (ECH, ECK, ECE, Self-Managed)
298+
4. **ProductApplicability** - Specialized tools and agents (ECCTL, Curator, EDOT, APM Agents)
299+
5. **Product (generic)** - Generic product applicability
300+
301+
Within the ProductApplicability category, EDOT and APM Agent items are sorted alphabetically for easy scanning.

src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml

Lines changed: 82 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,6 @@
1717
appliesTo.Stack
1818
)
1919
}
20-
@if (appliesTo.Deployment is not null)
21-
{
22-
if (appliesTo.Deployment.Ece is not null)
23-
{
24-
@RenderProduct("ECE",
25-
"Elastic&nbsp;Cloud&nbsp;Enterprise",
26-
VersioningSystemId.Ece,
27-
appliesTo.Deployment.Ece
28-
)
29-
}
30-
31-
if (appliesTo.Deployment.Eck is not null)
32-
{
33-
@RenderProduct(
34-
"ECK",
35-
"Elastic&nbsp;Cloud&nbsp;on&nbsp;Kubernetes",
36-
VersioningSystemId.Eck,
37-
appliesTo.Deployment.Eck
38-
)
39-
}
40-
41-
if (appliesTo.Deployment.Ess is not null)
42-
{
43-
@RenderProduct(
44-
"ECH",
45-
"Elastic&nbsp;Cloud&nbsp;Hosted",
46-
VersioningSystemId.Ess,
47-
appliesTo.Deployment.Ess
48-
)
49-
}
50-
51-
if (appliesTo.Deployment.Self is not null)
52-
{
53-
@RenderProduct(
54-
"Self-Managed",
55-
"Self-managed Elastic&nbsp;deployments",
56-
VersioningSystemId.Self,
57-
appliesTo.Deployment.Self
58-
)
59-
}
60-
}
6120
@if (appliesTo.Serverless is not null)
6221
{
6322
if (appliesTo.Serverless.AllProjects is not null)
@@ -102,9 +61,47 @@
10261
}
10362
}
10463
}
105-
@if (appliesTo.Product is not null)
64+
@if (appliesTo.Deployment is not null)
10665
{
107-
@RenderProduct("", "", VersioningSystemId.All, appliesTo.Product)
66+
67+
if (appliesTo.Deployment.Ess is not null)
68+
{
69+
@RenderProduct(
70+
"ECH",
71+
"Elastic&nbsp;Cloud&nbsp;Hosted",
72+
VersioningSystemId.Ess,
73+
appliesTo.Deployment.Ess
74+
)
75+
}
76+
77+
if (appliesTo.Deployment.Eck is not null)
78+
{
79+
@RenderProduct(
80+
"ECK",
81+
"Elastic&nbsp;Cloud&nbsp;on&nbsp;Kubernetes",
82+
VersioningSystemId.Eck,
83+
appliesTo.Deployment.Eck
84+
)
85+
}
86+
87+
if (appliesTo.Deployment.Ece is not null)
88+
{
89+
@RenderProduct("ECE",
90+
"Elastic&nbsp;Cloud&nbsp;Enterprise",
91+
VersioningSystemId.Ece,
92+
appliesTo.Deployment.Ece
93+
)
94+
}
95+
96+
if (appliesTo.Deployment.Self is not null)
97+
{
98+
@RenderProduct(
99+
"Self-Managed",
100+
"Self-managed Elastic&nbsp;deployments",
101+
VersioningSystemId.Self,
102+
appliesTo.Deployment.Self
103+
)
104+
}
108105
}
109106
@if (appliesTo.ProductApplicability is not null)
110107
{
@@ -119,101 +116,105 @@
119116
@RenderProduct("Curator", "Curator", VersioningSystemId.Curator, pa.Curator)
120117
}
121118

122-
if (pa.ApmAgentAndroid is not null)
119+
if (pa.EdotAndroid is not null)
123120
{
124-
@RenderProduct("APM Agent Android", "Application&nbsp;Performance&nbsp;Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
121+
@RenderProduct("EDOT Android", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
125122
}
126123

127-
if (pa.ApmAgentDotnet is not null)
124+
if (pa.EdotCfAws is not null)
128125
{
129-
@RenderProduct("APM Agent .NET", "Application&nbsp;Performance&nbsp;Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
126+
@RenderProduct("EDOT CF AWS", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Cloud&nbsp;Forwarder for AWS", VersioningSystemId.EdotCfAws, pa.EdotCfAws)
130127
}
131128

132-
if (pa.ApmAgentGo is not null)
129+
if (pa.EdotCollector is not null)
133130
{
134-
@RenderProduct("APM Agent Go", "Application&nbsp;Performance&nbsp;Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
131+
@RenderProduct("EDOT Collector", "Elastic Distribution of OpenTelemetry Collector", VersioningSystemId.EdotCollector, pa.EdotCollector)
135132
}
136133

137-
if (pa.ApmAgentIos is not null)
134+
if (pa.EdotDotnet is not null)
138135
{
139-
@RenderProduct("APM Agent iOS", "Application&nbsp;Performance&nbsp;Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
136+
@RenderProduct("EDOT .NET", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;.NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
140137
}
141138

142-
if (pa.ApmAgentJava is not null)
139+
if (pa.EdotIos is not null)
143140
{
144-
@RenderProduct("APM Agent Java", "Application&nbsp;Performance&nbsp;Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
141+
@RenderProduct("EDOT iOS", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;iOS", VersioningSystemId.EdotIos, pa.EdotIos)
145142
}
146143

147-
if (pa.ApmAgentNode is not null)
144+
if (pa.EdotJava is not null)
148145
{
149-
@RenderProduct("APM Agent Node.js", "Application&nbsp;Performance&nbsp;Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
146+
@RenderProduct("EDOT Java", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Java", VersioningSystemId.EdotJava, pa.EdotJava)
150147
}
151148

152-
if (pa.ApmAgentPhp is not null)
149+
if (pa.EdotNode is not null)
153150
{
154-
@RenderProduct("APM Agent PHP", "Application&nbsp;Performance&nbsp;Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
151+
@RenderProduct("EDOT Node.js", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
155152
}
156153

157-
if (pa.ApmAgentPython is not null)
154+
if (pa.EdotPhp is not null)
158155
{
159-
@RenderProduct("APM Agent Python", "Application&nbsp;Performance&nbsp;Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
156+
@RenderProduct("EDOT PHP", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
160157
}
161158

162-
if (pa.ApmAgentRuby is not null)
159+
if (pa.EdotPython is not null)
163160
{
164-
@RenderProduct("APM Agent Ruby", "Application&nbsp;Performance&nbsp;Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
161+
@RenderProduct("EDOT Python", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Python", VersioningSystemId.EdotPython, pa.EdotPython)
165162
}
166163

167-
if (pa.ApmAgentRum is not null)
164+
if (pa.ApmAgentAndroid is not null)
168165
{
169-
@RenderProduct("APM Agent RUM", "Application&nbsp;Performance&nbsp;Monitoring Agent for Real&nbsp;User&nbsp;Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
166+
@RenderProduct("APM Agent Android", "Application&nbsp;Performance&nbsp;Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
170167
}
171168

172-
if (pa.EdotIos is not null)
169+
if (pa.ApmAgentDotnet is not null)
173170
{
174-
@RenderProduct("EDOT iOS", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;iOS", VersioningSystemId.EdotIos, pa.EdotIos)
171+
@RenderProduct("APM Agent .NET", "Application&nbsp;Performance&nbsp;Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
175172
}
176173

177-
if (pa.EdotAndroid is not null)
174+
if (pa.ApmAgentGo is not null)
178175
{
179-
@RenderProduct("EDOT Android", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
176+
@RenderProduct("APM Agent Go", "Application&nbsp;Performance&nbsp;Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
180177
}
181178

182-
if (pa.EdotDotnet is not null)
179+
if (pa.ApmAgentIos is not null)
183180
{
184-
@RenderProduct("EDOT .NET", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;.NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
181+
@RenderProduct("APM Agent iOS", "Application&nbsp;Performance&nbsp;Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
185182
}
186183

187-
if (pa.EdotJava is not null)
184+
if (pa.ApmAgentJava is not null)
188185
{
189-
@RenderProduct("EDOT Java", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Java", VersioningSystemId.EdotJava, pa.EdotJava)
186+
@RenderProduct("APM Agent Java", "Application&nbsp;Performance&nbsp;Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
190187
}
191188

192-
if (pa.EdotNode is not null)
189+
if (pa.ApmAgentNode is not null)
193190
{
194-
@RenderProduct("EDOT Node.js", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
191+
@RenderProduct("APM Agent Node.js", "Application&nbsp;Performance&nbsp;Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
195192
}
196193

197-
if (pa.EdotPhp is not null)
194+
if (pa.ApmAgentPhp is not null)
198195
{
199-
@RenderProduct("EDOT PHP", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
196+
@RenderProduct("APM Agent PHP", "Application&nbsp;Performance&nbsp;Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
200197
}
201198

202-
if (pa.EdotPython is not null)
199+
if (pa.ApmAgentPython is not null)
203200
{
204-
@RenderProduct("EDOT Python", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Python", VersioningSystemId.EdotPython, pa.EdotPython)
201+
@RenderProduct("APM Agent Python", "Application&nbsp;Performance&nbsp;Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
205202
}
206203

207-
if (pa.EdotCfAws is not null)
204+
if (pa.ApmAgentRuby is not null)
208205
{
209-
@RenderProduct("EDOT CF AWS", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Cloud&nbsp;Forwarder for AWS", VersioningSystemId.EdotCfAws, pa.EdotCfAws)
206+
@RenderProduct("APM Agent Ruby", "Application&nbsp;Performance&nbsp;Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
210207
}
211208

212-
if (pa.EdotCollector is not null)
209+
if (pa.ApmAgentRum is not null)
213210
{
214-
@RenderProduct("EDOT Collector", "Elastic Distribution of OpenTelemetry Collector", VersioningSystemId.EdotCollector, pa.EdotCollector)
211+
@RenderProduct("APM Agent RUM", "Application&nbsp;Performance&nbsp;Monitoring Agent for Real&nbsp;User&nbsp;Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
215212
}
216213
}
214+
@if (appliesTo.Product is not null)
215+
{
216+
@RenderProduct("", "", VersioningSystemId.All, appliesTo.Product)
217+
}
217218

218219
@functions {
219220

tests/authoring/Applicability/AppliesToFrontMatter.fs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,55 @@ applies_to:
214214
let ``does not render label`` () =
215215
markdown |> appliesTo (Unchecked.defaultof<ApplicableTo>)
216216

217+
type ``parses applies_to with multiple categories in any order`` () =
218+
static let markdown = frontMatter """
219+
applies_to:
220+
product: ga
221+
deployment:
222+
eck: ga 9.0
223+
serverless:
224+
security: ga 9.0.0
225+
stack: ga 9.1
226+
ecctl: ga 10.0
227+
apm_agent_dotnet: ga 9.0
228+
"""
229+
[<Fact>]
230+
let ``parses all categories regardless of YAML order`` () =
231+
markdown |> appliesTo (ApplicableTo(
232+
Stack=AppliesCollection.op_Explicit "ga 9.1",
233+
Serverless=ServerlessProjectApplicability(
234+
Security=AppliesCollection.op_Explicit "ga 9.0.0"
235+
),
236+
Deployment=DeploymentApplicability(
237+
Eck=AppliesCollection.op_Explicit "ga 9.0"
238+
),
239+
ProductApplicability=ProductApplicability(
240+
Ecctl=AppliesCollection.op_Explicit "ga 10.0",
241+
ApmAgentDotnet=AppliesCollection.op_Explicit "ga 9.0"
242+
),
243+
Product=AppliesCollection.op_Explicit "ga"
244+
))
245+
246+
type ``deployment types are rendered in correct order`` () =
247+
static let markdown = frontMatter """
248+
applies_to:
249+
deployment:
250+
self: ga 9.0
251+
ece: ga 9.1
252+
ess: ga 9.2
253+
eck: ga 9.3
254+
"""
255+
[<Fact>]
256+
let ``deployment types are rendered in ESS ECK ECE Self order`` () =
257+
markdown |> appliesTo (ApplicableTo(
258+
Deployment=DeploymentApplicability(
259+
Ess=AppliesCollection.op_Explicit "ga 9.2",
260+
Eck=AppliesCollection.op_Explicit "ga 9.3",
261+
Ece=AppliesCollection.op_Explicit "ga 9.1",
262+
Self=AppliesCollection.op_Explicit "ga 9.0"
263+
)
264+
))
265+
217266
type ``sorts applies_to versions in descending order`` () =
218267
static let markdown = frontMatter """
219268
applies_to:

0 commit comments

Comments
 (0)