diff options
| author | Henrique Dias <hacdias@gmail.com> | 2023-11-10 14:23:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-10 05:23:27 -0800 |
| commit | bcddd3bbbea1a64a3fa9d71254f143246116b5b3 (patch) | |
| tree | 9954499e5a916a1b1a1b1f67d06656e832b4b871 /templates | |
| parent | a068bd4dd4b5040bd7b8ac514b32d3141f882b8a (diff) | |
| download | sally-bcddd3bbbea1a64a3fa9d71254f143246116b5b3.tar.gz | |
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
Diffstat (limited to '')
| -rw-r--r-- | templates/404.html | 11 | ||||
| -rw-r--r-- | templates/templates.go | 15 |
2 files changed, 11 insertions, 15 deletions
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 @@ +<!DOCTYPE html> +<html> + <head> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css" /> + </head> + <body> + <div class="container"> + <p>No packages found under: "{{ .Path }}".</p> + </div> + </body> +</html> 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 |