Skip to content

Commit 846c077

Browse files
authored
Redirect /schemas/latest to latest schema (open-telemetry#3475)
1 parent bdfed89 commit 846c077

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

layouts/index.redirects

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
/docs/reference/specification/* /docs/specs/otel/:splat
4545
/docs/specification/otel/* /docs/specs/otel/:splat
4646

47+
{{ $schemaFiles := partial "schema-file-list" . -}}
48+
{{ $latestSchemaFile := index $schemaFiles 0 -}}
49+
50+
/schemas/latest /schemas/{{ $latestSchemaFile.Name }}
51+
4752
{{/*
4853
Social-media image redirects. As mentioned in
4954
https://developers.facebook.com/docs/sharing/webmasters/images, we need to
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{/*
2+
Returns an array of schema files, sorted with the latest first.
3+
4+
Each schema file name is a semver. Sorting semver can be tricky, so for now we
5+
just sort by file size, descending, which gives us the same as a semver sort.
6+
This works because each published schema contains the text of all previously
7+
published schemas, and hence must be larger in size.
8+
9+
*/ -}}
10+
11+
{{ $schemaFiles := readDir "content-modules/semantic-conventions/schemas" -}}
12+
{{ $schemaFilesSortedLatestFirst := sort $schemaFiles "Size" "desc" -}}
13+
{{ return $schemaFilesSortedLatestFirst -}}

0 commit comments

Comments
 (0)