From bcddd3bbbea1a64a3fa9d71254f143246116b5b3 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 10 Nov 2023 14:23:27 +0100 Subject: feat: support for custom templates (#129) Adds a `-templates` flag that can be used to provide an alternative directory with templates for Sally to use. The new templates override the default set embedded in Sally. This includes a new 404 template so that 404 errors use the same theme as the rest of the website. Additionally, for HTTP status >400, this also sets the Cache-Control header to discourage CDNs like Cloudflare from caching the page. Resolves #125, #18 --- config_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'config_test.go') diff --git a/config_test.go b/config_test.go index e7ac247..21e67ef 100644 --- a/config_test.go +++ b/config_test.go @@ -9,7 +9,7 @@ import ( ) func TestParse(t *testing.T) { - path, clean := TempFile(t, ` + path := TempFile(t, ` url: google.golang.org packages: @@ -19,7 +19,6 @@ packages: vcs: svn `) - defer clean() config, err := Parse(path) assert.NoError(t, err) @@ -33,7 +32,7 @@ packages: } func TestParsePackageLevelURL(t *testing.T) { - path, clean := TempFile(t, ` + path := TempFile(t, ` url: google.golang.org packages: @@ -42,7 +41,6 @@ packages: url: go.uber.org `) - defer clean() config, err := Parse(path) assert.NoError(t, err) @@ -65,7 +63,7 @@ func TestParseGodocServer(t *testing.T) { for _, tt := range tests { t.Run(tt.give, func(t *testing.T) { - path, clean := TempFile(t, fmt.Sprintf(` + path := TempFile(t, fmt.Sprintf(` godoc: host: %q url: google.golang.org @@ -73,7 +71,6 @@ packages: grpc: repo: github.com/grpc/grpc-go `, tt.give)) - defer clean() config, err := Parse(path) require.NoError(t, err) -- cgit v1.2.3