Skip to content

Commit

Permalink
Add autogen warning to index file (#2493)
Browse files Browse the repository at this point in the history
This pull request adds a Markdown comment containing an autogen warning
to the _index.md file.

It does so immediately inside the Hugo frontmatter. h/t to @iwahbe for
pointing out Markdown will work fine here.

Fixes #2485.
  • Loading branch information
guineveresaenger authored Oct 25, 2024
2 parents 7d17d64 + dda50da commit 32c8c4d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/tfgen/installation_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ func writeFrontMatter(providerName string) string {
// Capitalize the package name
capitalize := cases.Title(language.English)
title := capitalize.String(providerName)

return fmt.Sprintf(delimiter+
"# *** WARNING: This file was auto-generated. "+
"Do not edit by hand unless you're certain you know what you are doing! ***\n"+
"title: %[1]s Provider\n"+
"meta_desc: Provides an overview on how to configure the Pulumi %[1]s provider.\n"+
"layout: package\n"+
Expand Down
2 changes: 2 additions & 0 deletions pkg/tfgen/installation_docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ func TestWriteFrontMatter(t *testing.T) {
name: "Generates Front Matter for installation-configuration.md",
providerName: "test",
expected: delimiter +
"# *** WARNING: This file was auto-generated. " +
"Do not edit by hand unless you're certain you know what you are doing! ***\n" +
"title: Test Provider\n" +
"meta_desc: Provides an overview on how to configure the Pulumi Test provider.\n" +
"layout: package\n" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
# *** WARNING: This file was auto-generated. Do not edit by hand unless you're certain you know what you are doing! ***
title: Libvirt Provider
meta_desc: Provides an overview on how to configure the Pulumi Libvirt provider.
layout: package
Expand Down
1 change: 1 addition & 0 deletions pkg/tfgen/test_data/convert-index-file/expected.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
# *** WARNING: This file was auto-generated. Do not edit by hand unless you're certain you know what you are doing! ***
title: Libvirt Provider
meta_desc: Provides an overview on how to configure the Pulumi Libvirt provider.
layout: package
Expand Down

0 comments on commit 32c8c4d

Please sign in to comment.