Support custom instance-level stylesheet
Will render if a file exists at: static/local/custom.css Ref T563
This commit is contained in:
parent
46bb8e65a1
commit
9ee83ae885
|
@ -3,6 +3,7 @@ node_modules
|
||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
|
|
||||||
|
static/local/custom.css
|
||||||
build
|
build
|
||||||
tmp
|
tmp
|
||||||
*.ini
|
*.ini
|
||||||
|
|
5
app.go
5
app.go
|
@ -356,6 +356,11 @@ func pageForReq(app *App, r *http.Request) page.StaticPage {
|
||||||
Version: "v" + softwareVer,
|
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
|
// Add user information, if given
|
||||||
var u *User
|
var u *User
|
||||||
accessToken := r.FormValue("t")
|
accessToken := r.FormValue("t")
|
||||||
|
|
|
@ -21,6 +21,7 @@ type StaticPage struct {
|
||||||
config.AppCfg
|
config.AppCfg
|
||||||
Version string
|
Version string
|
||||||
HeaderNav bool
|
HeaderNav bool
|
||||||
|
CustomCSS bool
|
||||||
|
|
||||||
// Request values
|
// Request values
|
||||||
Path string
|
Path string
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<title>{{if .Editing}}Editing {{if .Post.Title}}{{.Post.Title}}{{else}}{{.Post.Id}}{{end}}{{else}}New Post{{end}} — {{.SiteName}}</title>
|
<title>{{if .Editing}}Editing {{if .Post.Title}}{{.Post.Title}}{{else}}{{.Post.Id}}{{end}}{{else}}New Post{{end}} — {{.SiteName}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
<meta name="google" value="notranslate">
|
<meta name="google" value="notranslate">
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
{{ template "head" . }}
|
{{ template "head" . }}
|
||||||
<link rel="stylesheet" type="text/css" href="{{.Host}}/css/{{.Theme}}.css" />
|
<link rel="stylesheet" type="text/css" href="{{.Host}}/css/{{.Theme}}.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="{{.Host}}/local/custom.css" />{{end}}
|
||||||
<link rel="shortcut icon" href="{{.Host}}/favicon.ico" />
|
<link rel="shortcut icon" href="{{.Host}}/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>{{.PlainDisplayTitle}} {{localhtml "title dash" .Language.String}} {{.Collection.DisplayTitle}}</title>
|
<title>{{.PlainDisplayTitle}} {{localhtml "title dash" .Language.String}} {{.Collection.DisplayTitle}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="canonical" href="{{.CanonicalURL .Host}}" />
|
<link rel="canonical" href="{{.CanonicalURL .Host}}" />
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>{{.DisplayTitle}}{{if not .SingleUser}} — {{.SiteName}}{{end}}</title>
|
<title>{{.DisplayTitle}}{{if not .SingleUser}} — {{.SiteName}}{{end}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<link rel="canonical" href="{{.CanonicalURL}}">
|
<link rel="canonical" href="{{.CanonicalURL}}">
|
||||||
{{if gt .CurrentPage 1}}<link rel="prev" href="{{.PrevPageURL .Prefix .CurrentPage .IsTopLevel}}">{{end}}
|
{{if gt .CurrentPage 1}}<link rel="prev" href="{{.PrevPageURL .Prefix .CurrentPage .IsTopLevel}}">{{end}}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="/css/prose.css" />
|
<link rel="stylesheet" type="text/css" href="/css/prose.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
<meta name="google" value="notranslate">
|
<meta name="google" value="notranslate">
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>{{.PlainDisplayTitle}} {{localhtml "title dash" .Language.String}} {{.Collection.DisplayTitle}}</title>
|
<title>{{.PlainDisplayTitle}} {{localhtml "title dash" .Language.String}} {{.Collection.DisplayTitle}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
{{ if .IsFound }}
|
{{ if .IsFound }}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>{{.Tag}} — {{.Collection.DisplayTitle}}</title>
|
<title>{{.Tag}} — {{.Collection.DisplayTitle}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
{{if not .Collection.IsPrivate}}<link rel="alternate" type="application/rss+xml" title="{{.Tag}} posts on {{.DisplayTitle}}" href="{{.CanonicalURL}}tag:{{.Tag}}/feed/" />{{end}}
|
{{if not .Collection.IsPrivate}}<link rel="alternate" type="application/rss+xml" title="{{.Tag}} posts on {{.DisplayTitle}}" href="{{.CanonicalURL}}tag:{{.Tag}}/feed/" />{{end}}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>{{.DisplayTitle}}{{if not .SingleUser}} — {{.SiteName}}{{end}}</title>
|
<title>{{.DisplayTitle}}{{if not .SingleUser}} — {{.SiteName}}{{end}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<link rel="canonical" href="{{.CanonicalURL}}">
|
<link rel="canonical" href="{{.CanonicalURL}}">
|
||||||
{{if gt .CurrentPage 1}}<link rel="prev" href="{{.PrevPageURL .Prefix .CurrentPage .IsTopLevel}}">{{end}}
|
{{if gt .CurrentPage 1}}<link rel="prev" href="{{.PrevPageURL .Prefix .CurrentPage .IsTopLevel}}">{{end}}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<title>Edit metadata: {{if .Post.Title}}{{.Post.Title}}{{else}}{{.Post.Id}}{{end}} — {{.SiteName}}</title>
|
<title>Edit metadata: {{if .Post.Title}}{{.Post.Title}}{{else}}{{.Post.Id}}{{end}} — {{.SiteName}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
dt {
|
dt {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<title>{{if .Editing}}Editing {{if .Post.Title}}{{.Post.Title}}{{else}}{{.Post.Id}}{{end}}{{else}}New Post{{end}} — {{.SiteName}}</title>
|
<title>{{if .Editing}}Editing {{if .Post.Title}}{{.Post.Title}}{{else}}{{.Post.Id}}{{end}}{{else}}New Post{{end}} — {{.SiteName}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
<meta name="google" value="notranslate">
|
<meta name="google" value="notranslate">
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<title>{{.DisplayTitle}}{{if not .SingleUser}} — {{.SiteName}}{{end}}</title>
|
<title>{{.DisplayTitle}}{{if not .SingleUser}} — {{.SiteName}}{{end}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<link rel="canonical" href="{{.CanonicalURL}}">
|
<link rel="canonical" href="{{.CanonicalURL}}">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<link rel="stylesheet" href="/css/lib/mono-blue.min.css">
|
<link rel="stylesheet" href="/css/lib/mono-blue.min.css">
|
||||||
{{end}}
|
{{end}}
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<link rel="canonical" href="{{.Host}}/{{if .SingleUser}}d/{{end}}{{.ID}}" />
|
<link rel="canonical" href="{{.Host}}/{{if .SingleUser}}d/{{end}}{{.ID}}" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
<title>{{.PageTitle}} {{if .Separator}}{{.Separator}}{{else}}—{{end}} {{.SiteName}}</title>
|
<title>{{.PageTitle}} {{if .Separator}}{{.Separator}}{{else}}—{{end}} {{.SiteName}}</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
||||||
|
{{if .CustomCSS}}<link rel="stylesheet" type="text/css" href="/local/custom.css" />{{end}}
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="theme-color" content="#888888" />
|
<meta name="theme-color" content="#888888" />
|
||||||
|
|
Loading…
Reference in New Issue