diff options
Diffstat (limited to 'templates/base.qtpl')
| -rw-r--r-- | templates/base.qtpl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/templates/base.qtpl b/templates/base.qtpl index b3df94a..6ff3d53 100644 --- a/templates/base.qtpl +++ b/templates/base.qtpl @@ -1,11 +1,28 @@ This is a base page template. All the other template pages implement this interface. {% import "context" %} +{% import "crypto/rand" %} +{% import "encoding/hex" %} {% import "strconv" %} {% import "time" %} -{% code +{% code + var Slug = "" + var Session = "" + + func init() { + Session = hex.EncodeToString(generateSmallTimeID()) +} + +func generateSmallTimeID() []byte { + b := make([]byte, 4) + _, err := rand.Read(b) + if err != nil { + panic(err) + } + return b +} %} {% interface @@ -58,8 +75,9 @@ Page prints a page implementing Page interface. <head> <meta charset="utf-8"> <link rel="icon" href="data:,"> - <title>{%= p.Title(ctx) %}</title> + <title>{%= p.Title(ctx) %}</title> <link rel="stylesheet" href="/static/main{%s Slug %}.css"> + <link rel="stylesheet" href="/static/theme.{%s Session %}{%s Slug %}.css"> <html data-bs-theme="dark"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="width=device-width, initial-scale=1" /> |
