docs: improve structure for example templates (#9842)

Co-authored-by: Kyle Carberry <kyle@carberry.com>
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
This commit is contained in:
Ben Potter
2023-12-17 08:05:13 -06:00
committed by GitHub
parent 3f6096b0d7
commit 2e86b76fb8
38 changed files with 473 additions and 1343 deletions

View File

@ -67,7 +67,7 @@ func run() error {
return xerrors.Errorf("parse example %q front matter: %w", exampleID, err)
}
nameRaw, exists := frontMatter.FrontMatter["name"]
nameRaw, exists := frontMatter.FrontMatter["display_name"]
if !exists {
return xerrors.Errorf("example %q front matter does not contain name", exampleID)
}
@ -110,6 +110,12 @@ func run() error {
if !valid {
return xerrors.Errorf("example %q icon isn't a string", exampleID)
}
icon, err = filepath.Rel("../site/static/", filepath.Join(examplesDir, name, icon))
if err != nil {
return xerrors.Errorf("example %q icon is not in site/static: %w", exampleID, err)
}
// The FE needs a static path!
icon = "/" + icon
}
examples = append(examples, codersdk.TemplateExample{