diff --git a/.gitignore b/.gitignore index f33ebb0..45bf28e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules *.swp *.swo +static/local/custom.css build tmp *.ini diff --git a/app.go b/app.go index 4c4aeb9..896081f 100644 --- a/app.go +++ b/app.go @@ -356,6 +356,11 @@ func pageForReq(app *App, r *http.Request) page.StaticPage { Version: "v" + softwareVer, } + // Use custom style, if file exists + if _, err := os.Stat(filepath.Join(staticDir, "local", "custom.css")); err == nil { + p.CustomCSS = true + } + // Add user information, if given var u *User accessToken := r.FormValue("t") diff --git a/page/page.go b/page/page.go index 2cfb6cc..cc4094e 100644 --- a/page/page.go +++ b/page/page.go @@ -21,6 +21,7 @@ type StaticPage struct { config.AppCfg Version string HeaderNav bool + CustomCSS bool // Request values Path string diff --git a/templates/bare.tmpl b/templates/bare.tmpl index f76eed9..37fc574 100644 --- a/templates/bare.tmpl +++ b/templates/bare.tmpl @@ -5,6 +5,7 @@ {{if .Editing}}Editing {{if .Post.Title}}{{.Post.Title}}{{else}}{{.Post.Id}}{{end}}{{else}}New Post{{end}} — {{.SiteName}} + {{if .CustomCSS}}{{end}} diff --git a/templates/base.tmpl b/templates/base.tmpl index 604d0ff..6c4489d 100644 --- a/templates/base.tmpl +++ b/templates/base.tmpl @@ -3,6 +3,7 @@ {{ template "head" . }} + {{if .CustomCSS}}{{end}} diff --git a/templates/chorus-collection-post.tmpl b/templates/chorus-collection-post.tmpl index 537e4ef..4fe1990 100644 --- a/templates/chorus-collection-post.tmpl +++ b/templates/chorus-collection-post.tmpl @@ -6,6 +6,7 @@ {{.PlainDisplayTitle}} {{localhtml "title dash" .Language.String}} {{.Collection.DisplayTitle}} + {{if .CustomCSS}}{{end}} diff --git a/templates/chorus-collection.tmpl b/templates/chorus-collection.tmpl index d105dff..45fc9cb 100644 --- a/templates/chorus-collection.tmpl +++ b/templates/chorus-collection.tmpl @@ -6,6 +6,7 @@ {{.DisplayTitle}}{{if not .SingleUser}} — {{.SiteName}}{{end}} + {{if .CustomCSS}}{{end}} {{if gt .CurrentPage 1}}{{end}} diff --git a/templates/classic.tmpl b/templates/classic.tmpl index ecc8cb9..6ff2b55 100644 --- a/templates/classic.tmpl +++ b/templates/classic.tmpl @@ -6,6 +6,7 @@ + {{if .CustomCSS}}{{end}} diff --git a/templates/collection-post.tmpl b/templates/collection-post.tmpl index 5d56abd..7eedb86 100644 --- a/templates/collection-post.tmpl +++ b/templates/collection-post.tmpl @@ -6,6 +6,7 @@ {{.PlainDisplayTitle}} {{localhtml "title dash" .Language.String}} {{.Collection.DisplayTitle}} + {{if .CustomCSS}}{{end}} {{ if .IsFound }} diff --git a/templates/collection-tags.tmpl b/templates/collection-tags.tmpl index e2f8962..eb87221 100644 --- a/templates/collection-tags.tmpl +++ b/templates/collection-tags.tmpl @@ -6,6 +6,7 @@ {{.Tag}} — {{.Collection.DisplayTitle}} + {{if .CustomCSS}}{{end}} {{if not .Collection.IsPrivate}}{{end}} diff --git a/templates/collection.tmpl b/templates/collection.tmpl index 493e6b7..96646ab 100644 --- a/templates/collection.tmpl +++ b/templates/collection.tmpl @@ -6,6 +6,7 @@ {{.DisplayTitle}}{{if not .SingleUser}} — {{.SiteName}}{{end}} + {{if .CustomCSS}}{{end}} {{if gt .CurrentPage 1}}{{end}} diff --git a/templates/edit-meta.tmpl b/templates/edit-meta.tmpl index 9f7faed..cef6717 100644 --- a/templates/edit-meta.tmpl +++ b/templates/edit-meta.tmpl @@ -5,6 +5,7 @@ Edit metadata: {{if .Post.Title}}{{.Post.Title}}{{else}}{{.Post.Id}}{{end}} — {{.SiteName}} + {{if .CustomCSS}}{{end}}