Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: icon.png not loading #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.sample.toml
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ write_timeout="3s"
dbfile="app.db"

page_logo_url="/static/icon.png"
page_favicon_url="/static/favicon.ico"
page_title="LinkPage"
page_intro="Your friendly neighbourhood self-hostable FOSS link page."

2 changes: 1 addition & 1 deletion home.html
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
<link rel="stylesheet" href="/static/app/css/skeleton.css">
<link rel="stylesheet" href="/static/app/css/app.css">
<link rel="stylesheet" href="/static/custom/custom.css">
<link rel="icon" href="/static/custom/favicon.ico" type="image/x-icon" />
<link rel="icon" href="{{.FaviconURL}}" type="image/x-icon" />

<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Inter&display=swap" rel="stylesheet">
26 changes: 15 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
@@ -42,9 +42,10 @@ type Config struct {
WriteTimeout time.Duration `koanf:"write_timeout"`
DBFile string `koanf:"dbfile"`

PageLogoURL string `koanf:"page_logo_url"`
PageTitle string `koanf:"page_title"`
PageIntro string `koanf:"page_intro"`
PageLogoURL string `koanf:"page_logo_url"`
PageFaviconURL string `koanf:"page_favicon_url"`
PageTitle string `koanf:"page_title"`
PageIntro string `koanf:"page_intro"`

StaticFileDir string `koanf:"static_files"`

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

type Page struct {
LogoURL string
Title string
Intro string
Links []Link
LogoURL string
FaviconURL string
Title string
Intro string
Links []Link

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

app := &App{
Data: Page{
LogoURL: cfg.PageLogoURL,
Title: cfg.PageTitle,
Intro: cfg.PageIntro,
Social: cfg.Social,
LogoURL: cfg.PageLogoURL,
FaviconURL: cfg.PageFaviconURL,
Title: cfg.PageTitle,
Intro: cfg.PageIntro,
Social: cfg.Social,
},
DB: &LinkDB{db},
Templates: Templates{
@@ -570,6 +573,7 @@ func runApp(configFilePath string) {
})

r.PathPrefix("/static/app").Handler(http.FileServer(http.FS(staticFS)))
r.PathPrefix("/static").Handler(http.FileServer(http.FS(staticFS)))

if cfg.StaticFileDir != "" {
r.PathPrefix("/static/custom").Handler(
Binary file added static/favicon.ico
Binary file not shown.