Compare commits
No commits in common. "a6ee333232dcbba69b83317b7f02d52309f39d69" and "871649a7e97e9619c65cdaa134812a3c559e8843" have entirely different histories.
a6ee333232
...
871649a7e9
@ -13,9 +13,6 @@
|
|||||||
{{if .footerScript}}
|
{{if .footerScript}}
|
||||||
{{.footerScript|unescaped}}
|
{{.footerScript|unescaped}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if .externFooter}}
|
|
||||||
{{.externFooter|unescaped}}
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package wp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/fthvgb1/wp-go/app/cmd/reload"
|
"github.com/fthvgb1/wp-go/app/cmd/reload"
|
||||||
"github.com/fthvgb1/wp-go/app/pkg/config"
|
|
||||||
"github.com/fthvgb1/wp-go/app/pkg/constraints"
|
"github.com/fthvgb1/wp-go/app/pkg/constraints"
|
||||||
"github.com/fthvgb1/wp-go/app/pkg/logs"
|
"github.com/fthvgb1/wp-go/app/pkg/logs"
|
||||||
"github.com/fthvgb1/wp-go/app/plugins/wphandle/apply"
|
"github.com/fthvgb1/wp-go/app/plugins/wphandle/apply"
|
||||||
@ -13,7 +12,6 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Handle struct {
|
type Handle struct {
|
||||||
@ -241,32 +239,6 @@ func (h *Handle) CommonComponents() {
|
|||||||
h.PushCacheGroupHeadScript(constraints.AllScene, "siteIconAndCustomCss", 0, CalSiteIcon, CalCustomCss)
|
h.PushCacheGroupHeadScript(constraints.AllScene, "siteIconAndCustomCss", 0, CalSiteIcon, CalCustomCss)
|
||||||
h.PushRender(constraints.AllStats, NewHandleFn(CalComponents, 10, "wp.CalComponents"))
|
h.PushRender(constraints.AllStats, NewHandleFn(CalComponents, 10, "wp.CalComponents"))
|
||||||
h.PushRender(constraints.AllStats, NewHandleFn(PreRenderTemplate, 0, "wp.PreRenderTemplate"))
|
h.PushRender(constraints.AllStats, NewHandleFn(PreRenderTemplate, 0, "wp.PreRenderTemplate"))
|
||||||
AdditionScript(h)
|
|
||||||
}
|
|
||||||
|
|
||||||
func AdditionScript(h *Handle) {
|
|
||||||
s := config.GetConfig().ExternScript
|
|
||||||
if len(s) < 1 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
fn := func(f, name string) {
|
|
||||||
if f == "" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ss, err := os.ReadFile(f)
|
|
||||||
if err != nil {
|
|
||||||
logs.Error(err, str.Join("解析", name, "失败"), f)
|
|
||||||
} else {
|
|
||||||
h.PushComponents(constraints.AllScene, constraints.HeadScript, NewComponent(name, string(ss), false, 0, nil))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch len(s) {
|
|
||||||
case 1:
|
|
||||||
fn(s[0], "externHead")
|
|
||||||
case 2:
|
|
||||||
fn(s[0], "externHead")
|
|
||||||
fn(s[1], "externFooter")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func PreRenderTemplate(h *Handle) {
|
func PreRenderTemplate(h *Handle) {
|
||||||
|
@ -98,5 +98,3 @@ plugins: ["enlightjs"]
|
|||||||
pluginPath: "./plugins"
|
pluginPath: "./plugins"
|
||||||
# 列表页面post使用的插件
|
# 列表页面post使用的插件
|
||||||
listPagePlugins: ["digest"]
|
listPagePlugins: ["digest"]
|
||||||
# 额外引入的脚本 第一个为head 第二个为footer
|
|
||||||
externScript: ["",""]
|
|
Loading…
Reference in New Issue
Block a user