Skip to content

Commit

Permalink
Merge pull request #662 from buildpacks/feat/redirect-pack-uris
Browse files Browse the repository at this point in the history
Generate older aliases to `pack` documentation
  • Loading branch information
AidanDelaney authored Feb 29, 2024
2 parents 04677b7 + a6d67c3 commit 84b38b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/get_pack_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
gendocFrontmatterTemplate = `+++
title="%s"
no_edit="true"
aliases=[ "/docs/tools/pack" ]
+++
<!--more-->
`
Expand All @@ -30,7 +31,8 @@ no_edit="true"
var filePrepender = func(filename string) string {
name := filepath.Base(filename)
name = strings.Replace(name, ".md", "", -1)
return fmt.Sprintf(gendocFrontmatterTemplate, strings.Replace(name, "_", " ", -1))
presentationName := strings.Replace(name, "_", " ", -1)
return fmt.Sprintf(gendocFrontmatterTemplate, presentationName)
}

var linkHandler = func(name string) string {
Expand All @@ -52,7 +54,7 @@ func main() {
}

if _, err := os.Stat(filepath.Join(outputPath, indexFile)); os.IsNotExist(err) {
if err := ioutil.WriteFile(filepath.Join(outputPath, indexFile), []byte(filePrepender("Pack CLI")), os.ModePerm); err != nil {
if err := os.WriteFile(filepath.Join(outputPath, indexFile), []byte(filePrepender("Pack CLI")), os.ModePerm); err != nil {
log.Fatal(err)
}
}
Expand Down

0 comments on commit 84b38b5

Please sign in to comment.