Skip to content

A self-hosted dashboard that puts all your feeds in one place

Allow some branding customization.

David Leonard3cfbe0c89b95
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" }}
<script>
@@ -28,7 +28,7 @@
<div class="header-container content-bounds">
<div class="header flex padding-inline-widget widget-content-frame">
<!-- TODO: Replace G with actual logo, first need an actual logo -->
- <div class="logo">G</div>
+ <div class="logo">{{ .App.Config.Branding.ShortName }}</div>
<div class="nav flex grow">
{{ template "navigation-links" . }}
</div>
@@ -57,6 +57,7 @@
</div>
</div>
+{{ if .App.Config.Branding.Show }}
<div class="footer flex items-center flex-column">
<div>
<span class="size-h3">Glance</span> ({{ .App.Version }})
@@ -67,3 +68,4 @@
</ul>
</div>
{{ end }}
+{{ end }}
diff --git a/internal/glance/config.go b/internal/glance/config.go
index 9acc3be..1d00522 100644
--- a/internal/glance/config.go
+++ b/internal/glance/config.go
@@ -8,9 +8,10 @@ import (
)
type Config struct {
- Server Server `yaml:"server"`
- Theme Theme `yaml:"theme"`
- Pages []Page `yaml:"pages"`
+ Server Server `yaml:"server"`
+ Theme Theme `yaml:"theme"`
+ Pages []Page `yaml:"pages"`
+ Branding Branding `yaml:"branding"`
}
func NewConfigFromYml(contents io.Reader) (*Config, error) {
@@ -40,6 +41,9 @@ func NewConfig() *Config {
config.Server.Host = ""
config.Server.Port = 8080
+ config.Branding.Show = true
+ config.Branding.Name = "Glance"
+ config.Branding.ShortName = "G"
return config
}
diff --git a/internal/glance/glance.go b/internal/glance/glance.go
index 653be75..9bdca4e 100644
--- a/internal/glance/glance.go
+++ b/internal/glance/glance.go
@@ -38,10 +38,16 @@ type Theme struct {
}
type Server struct {
- Host string `yaml:"host"`
- Port uint16 `yaml:"port"`
- AssetsPath string `yaml:"assets-path"`
- StartedAt time.Time `yaml:"-"`
+ Host string `yaml:"host"`
+ Port uint16 `yaml:"port"`
+ AssetsPath string `yaml:"assets-path"`
+ StartedAt time.Time `yaml:"-"`
+}
+
+type Branding struct {
+ Show bool `yaml:show`
+ Name string `yaml:name`
+ ShortName string `yaml:"short-name"`
}
type Column struct {