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 --- templates/404.html | 11 +++++++++++ templates/templates.go | 15 --------------- 2 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 templates/404.html delete mode 100644 templates/templates.go (limited to 'templates') diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..ab5b34a --- /dev/null +++ b/templates/404.html @@ -0,0 +1,11 @@ + + + + + + +
+

No packages found under: "{{ .Path }}".

+
+ + diff --git a/templates/templates.go b/templates/templates.go deleted file mode 100644 index 4217a5a..0000000 --- a/templates/templates.go +++ /dev/null @@ -1,15 +0,0 @@ -// Package templates exposes the template used by Sally -// to render the HTML pages. -package templates - -import _ "embed" // needed for go:embed - -// Index holds the contents of the index.html template. -// -//go:embed index.html -var Index string - -// Package holds the contents of the package.html template. -// -//go:embed package.html -var Package string -- cgit v1.2.3