From 3cfbe0c89b95971413df7f533c095db050f9ad9a Mon Sep 17 00:00:00 2001 From: David Leonard Date: Fri, 17 May 2024 14:37:05 -0700 Subject: [PATCH 01/18] Allow some branding customization. --- docs/configuration.md | 28 ++++++++++++++++++++++++++++ internal/assets/templates/page.html | 6 ++++-- internal/glance/config.go | 10 +++++++--- internal/glance/glance.go | 14 ++++++++++---- 4 files changed, 49 insertions(+), 9 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index e698fdd..40ff0cc 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -3,6 +3,7 @@ - [Intro](#intro) - [Preconfigured page](#preconfigured-page) - [Server](#server) +- [Branding](#branding) - [Theme](#theme) - [Themes](#themes) - [Pages & Columns](#pages--columns) @@ -162,6 +163,33 @@ To be able to point to an asset from your assets path, use the `/assets/` path l icon: /assets/gitea-icon.png ``` +## Branding +You can adjust the various parts of the branding through a top level `branding` property. Example: + +```yaml +branding: + show: true + name: Glance + short-name: G +``` + +### Properties + +| Name | Type | Required | Default | +| ---- | ---- | -------- | ------- | +| show | bool | no | true | +| name | string | no | Glance | +| short-name | string | no | G | + +#### `show` +True will show the glance footer, false will hide it. + +#### `name` +Sets the name presented after the page name in the title. + +#### `short-name` +Sets the name presented before the pages in the header. + ## Theme Theming is done through a top level `theme` property. Values for the colors are in [HSL](https://giggster.com/guide/basics/hue-saturation-lightness/) (hue, saturation, lightness) format. You can use a color picker [like this one](https://hslpicker.com/) to convert colors from other formats to HSL. The values are separated by a space and `%` is not required for any of the numbers. diff --git a/internal/assets/templates/page.html b/internal/assets/templates/page.html index 61fad9e..c50dfe2 100644 --- a/internal/assets/templates/page.html +++ b/internal/assets/templates/page.html @@ -1,6 +1,6 @@ {{ template "document.html" . }} -{{ define "document-title" }}{{ .Page.Title }} - Glance{{ end }} +{{ define "document-title" }}{{ .Page.Title }} - {{ .App.Config.Branding.Name }}{{ end }} {{ define "document-head-before" }} {{ block "document-head-after" . }}{{ end }} diff --git a/internal/assets/templates/page.html b/internal/assets/templates/page.html index efb8529..d0add29 100644 --- a/internal/assets/templates/page.html +++ b/internal/assets/templates/page.html @@ -32,7 +32,7 @@
- + @@ -63,7 +63,7 @@
- {{ if not .App.Config.Branding.Show }} + {{ if not .App.Config.Branding.HideFooter }}