feat(telegraf): Use metadata from autogenerated Telegraf docs in template frontmatter.

- Use plugin type and version to build related links
- Insert tag list into frontmatter tags
- Rename metadata in content body
pull/5656/head
Jason Stirnaman 2025-03-31 08:36:14 -05:00
parent b8d8b9b3ef
commit 070cbbe5e1
7 changed files with 53 additions and 8 deletions

4
.gitignore vendored
View File

@ -11,6 +11,10 @@ node_modules
/content/influxdb*/**/api/**/*.html
!api-docs/**/.config.yml
/api-docs/redoc-static.html*
/telegraf-build
!telegraf-build/templates
!telegraf-build/scripts
!telegraf-build/README.md
.vscode/*
.idea
**/config.toml

View File

@ -68,14 +68,32 @@ To test manually run the build process on your local system
4. To generate the documentation, run the `telegraf-internal/telegraf_release/bin/docs` binary and include the Telegraf release tag to build--for example:
```bash
# From ~/Documents/github
telegraf-internal/telegraf_release/bin/docs v1.33.0
# Change to `telegraf-build` in your local docs-v2 repo.
cd ~/Documents/github/docs-v2/telegraf-build
# Run the `docs` binary to generate the documentation.
~/Documents/github/telegraf-internal/telegraf_release/bin/docs v1.33.0
```
Currently, the binary uses the templates in `telegraf-internal/telegraf_release/docs/templates/`, however we expect to permanently move them to `docs-v2/telegraf-build/templates` soon.
You can skip steps for local testing:
```bash
~/Documents/github/telegraf-internal/telegraf_release/bin/docs -skip changelog,pull-request v1.33.0
```
The binary looks for `.tmpl` template files in `./templates` `telegraf-internal/telegraf_release/docs/templates/`, however we expect to permanently move them to `docs-v2/telegraf-build/templates` soon.
The `docs` binary:
a. Clones the `docs-v2` repo and the `telegraf` repo and checks out the specified Telegraf release tag.
b. Commits the changes to the local `docs-v2` repo and creates a PR for the changes.
5. To test the templates and preview the changes on your local machine, review the generated files in the newly cloned `docs-v2/content/telegraf` or copy them into your existing local `docs-v2` repo (but, _don't_ commit them to version control).
5. To test the templates and preview the changes on your local machine, change to `telegraf-build/repos/docs-v2`, install dependencies, and start Hugo:
```bash
cd ~/Documents/github/docs-v2/telegraf-build/repos/docs-v2
# Install dependencies
yarn install
# Start Hugo server
npx hugo serve
```
Alternatively, copy the generated files your existing local `docs-v2` repo (but, _don't_ commit them to version control).

View File

@ -5,9 +5,14 @@ menu:
parent: aggregator_plugins_reference
name: {{.Name}}
identifier: aggregator-{{.ID}}
tags: [{{.Name}}, "aggregator-plugins", "configuration"]
tags: [{{.Name}}, "aggregator-plugins", "configuration"{{range .Tags}}, "{{.}}"{{end}}]
{{if .Introduced}}introduced: "{{.Introduced}}"{{end}}
{{if .Deprecated}}deprecated: "{{.Deprecated}}"{{end}}
{{if .Removal}}removal: "{{.Removal}}"{{end}}
{{if .OS}}os_support: "{{.OS}}"{{end}}
related:
- /telegraf/v1/configure_plugins/
- {{.URL}}, {{.Name}} Plugin Source
---
{{.Readme}}

View File

@ -5,9 +5,14 @@ menu:
parent: input_plugins_reference
name: {{.Name}}
identifier: input-{{.ID}}
tags: [{{.Name}}, "input-plugins", "configuration"]
tags: [{{.Name}}, "input-plugins", "configuration"{{range .Tags}}, "{{.}}"{{end}}]
{{if .Introduced}}introduced: "{{.Introduced}}"{{end}}
{{if .Deprecated}}deprecated: "{{.Deprecated}}"{{end}}
{{if .Removal}}removal: "{{.Removal}}"{{end}}
{{if .OS}}os_support: "{{.OS}}"{{end}}
related:
- /telegraf/v1/configure_plugins/
- {{.URL}}, {{.Name}} Plugin Source
---
{{.Readme}}

View File

@ -5,9 +5,14 @@ menu:
parent: output_plugins_reference
name: {{.Name}}
identifier: output-{{.ID}}
tags: [{{.Name}}, "output-plugins", "configuration"]
tags: [{{.Name}}, "output-plugins", "configuration"{{range .Tags}}, "{{.}}"{{end}}]
{{if .Introduced}}introduced: "{{.Introduced}}"{{end}}
{{if .Deprecated}}deprecated: "{{.Deprecated}}"{{end}}
{{if .Removal}}removal: "{{.Removal}}"{{end}}
{{if .OS}}os_support: "{{.OS}}"{{end}}
related:
- /telegraf/v1/configure_plugins/
- {{.URL}}, {{.Name}} Plugin Source
---
{{.Readme}}

View File

@ -8,5 +8,8 @@
{{- end }}
{{- with .Removal }}
removal: {{ . }}
{{- end }}
{{ with .OS }}
os_support: {{ . }}
{{- end }}
tags: [{{ .Tags | join ", " }}]

View File

@ -5,9 +5,14 @@ menu:
parent: processor_plugins_reference
name: {{.Name}}
identifier: processor-{{.ID}}
tags: [{{.Name}}, "processor-plugins", "configuration"]
tags: [{{.Name}}, "processor-plugins", "configuration"{{range .Tags}}, "{{.}}"{{end}}]
{{if .Introduced}}introduced: "{{.Introduced}}"{{end}}
{{if .Deprecated}}deprecated: "{{.Deprecated}}"{{end}}
{{if .Removal}}removal: "{{.Removal}}"{{end}}
{{if .OS}}os_support: "{{.OS}}"{{end}}
related:
- /telegraf/v1/configure_plugins/
- {{.URL}}, {{.Name}} Plugin Source
---
{{.Readme}}