Skip to content

Commit 268953d

Browse files
committed
feat: favicon customizable in config
rhnvrm#5 - added default favicon file
1 parent 2de2b96 commit 268953d

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

config.sample.toml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ write_timeout="3s"
44
dbfile="app.db"
55

66
page_logo_url="/static/icon.png"
7+
page_favicon_url="/static/favicon.ico"
78
page_title="LinkPage"
89
page_intro="Your friendly neighbourhood self-hostable FOSS link page."
910

home.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<link rel="stylesheet" href="/static/app/css/skeleton.css">
1111
<link rel="stylesheet" href="/static/app/css/app.css">
1212
<link rel="stylesheet" href="/static/custom/custom.css">
13-
<link rel="icon" href="/static/custom/favicon.ico" type="image/x-icon" />
13+
<link rel="icon" href="{{.FaviconURL}}" type="image/x-icon" />
1414

1515
<link rel="preconnect" href="https://fonts.gstatic.com">
1616
<link href="https://fonts.googleapis.com/css2?family=Inter&display=swap" rel="stylesheet">

main.go

+14-11
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ type Config struct {
4242
WriteTimeout time.Duration `koanf:"write_timeout"`
4343
DBFile string `koanf:"dbfile"`
4444

45-
PageLogoURL string `koanf:"page_logo_url"`
46-
PageTitle string `koanf:"page_title"`
47-
PageIntro string `koanf:"page_intro"`
45+
PageLogoURL string `koanf:"page_logo_url"`
46+
PageFaviconURL string `koanf:"page_favicon_url"`
47+
PageTitle string `koanf:"page_title"`
48+
PageIntro string `koanf:"page_intro"`
4849

4950
StaticFileDir string `koanf:"static_files"`
5051

@@ -90,10 +91,11 @@ type Link struct {
9091
}
9192

9293
type Page struct {
93-
LogoURL string
94-
Title string
95-
Intro string
96-
Links []Link
94+
LogoURL string
95+
FaviconURL string
96+
Title string
97+
Intro string
98+
Links []Link
9799

98100
Error string
99101
Success string
@@ -293,10 +295,11 @@ func runApp(configFilePath string) {
293295

294296
app := &App{
295297
Data: Page{
296-
LogoURL: cfg.PageLogoURL,
297-
Title: cfg.PageTitle,
298-
Intro: cfg.PageIntro,
299-
Social: cfg.Social,
298+
LogoURL: cfg.PageLogoURL,
299+
FaviconURL: cfg.PageFaviconURL,
300+
Title: cfg.PageTitle,
301+
Intro: cfg.PageIntro,
302+
Social: cfg.Social,
300303
},
301304
DB: &LinkDB{db},
302305
Templates: Templates{

static/favicon.ico

1.12 KB
Binary file not shown.

0 commit comments

Comments
 (0)