Skip to content

Commit

Permalink
Schemas: add latest redirect, index page, fix content-type
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Nov 1, 2023
1 parent 2b5555e commit 92c8871
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
17 changes: 17 additions & 0 deletions content/en/schemas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: OpenTelemetry Schemas
linkTitle: Schemas
---

{{% blocks/section color="white" %}}

## {{% param title %}}

Available schemas are listed below. To learn more about schemas, see [Telemetry
Schemas][].

{{% schemas %}}

{{% /blocks/section %}}

[Telemetry Schemas]: /docs/specs/otel/schemas/#opentelemetry-schema
5 changes: 5 additions & 0 deletions layouts/index.redirects
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
/docs/reference/specification/* /docs/specs/otel/:splat
/docs/specification/otel/* /docs/specs/otel/:splat

{{ $schemaFiles := partial "schema-file-list" . -}}
{{ $latestSchemaFile := index $schemaFiles 0 -}}

/schemas/latest /schemas/{{ $latestSchemaFile.Name }}

{{/*
Social-media image redirects. As mentioned in
https://developers.facebook.com/docs/sharing/webmasters/images, we need to
Expand Down
13 changes: 13 additions & 0 deletions layouts/partials/schema-file-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{/*
Returns an array of schema files, sorted with the latest first.

Each schema file name is a semver. Sorting semver can be tricky, so for now we
just sort by file size, descending, which gives us the same as a semver sort.
This works because each published schema contains the text of all previously
published schemas, and hence must be larger in size.

*/ -}}

{{ $schemaFiles := readDir "content-modules/semantic-conventions/schemas" -}}
{{ $schemaFilesSortedLatestFirst := sort $schemaFiles "Size" "desc" -}}
{{ return $schemaFilesSortedLatestFirst -}}
4 changes: 4 additions & 0 deletions layouts/shortcodes/schemas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{ $schemaFiles := partial "schema-file-list.html" . -}}
{{ range $schemaFiles }}
- [`{{ .Name }}`](/schemas/{{ .Name }})
{{- end -}}
7 changes: 6 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ force = true
[[redirects]]
from = "https://blog.opentelemetry.io/*"
to = "https://opentelemetry.io/blog/:splat"
force = true
force = true

[[headers]]
for = "/schemas/*"
[headers.values]
content-type = "application/x-yaml"

0 comments on commit 92c8871

Please sign in to comment.