调整优化修复bug
This commit is contained in:
parent
f3595874ae
commit
997839e98a
|
@ -10,7 +10,7 @@ func EnlighterJS(h *wp.Handle) {
|
|||
return `<link rel='stylesheet' id='enlighterjs-css' href='/wp-content/plugins/enlighter/cache/enlighterjs.min.css' media='all' />`
|
||||
})
|
||||
|
||||
h.PushGroupFooterScript(20, func(h *wp.Handle) string {
|
||||
h.PushGroupFooterScript(10, func(h *wp.Handle) string {
|
||||
return str.Join(`<script src='/wp-content/plugins/enlighter/cache/enlighterjs.min.js?ver=0A0B0C' id='enlighterjs-js'></script>`, "\n", enlighterjs)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
</ol>
|
||||
|
||||
{{end}}
|
||||
{{if eq .post.CommentStatus "open"}}
|
||||
{{if and (eq .post.CommentStatus "open") (eq ( "thread_comments" |getOption ) "1")}}
|
||||
<div id="respond" class="comment-respond">
|
||||
<h3 id="reply-title" class="comment-reply-title">发表回复
|
||||
<small>
|
||||
|
|
|
@ -40,24 +40,12 @@
|
|||
</div><!-- .site-branding -->
|
||||
|
||||
</div><!-- .custom-header -->
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
{{block "content" .}}
|
||||
|
||||
{{end}}
|
||||
|
||||
<footer id="colophon" class="site-footer">
|
||||
<div class="wrap">
|
||||
<div class="site-info">
|
||||
<a href="https://cn.wordpress.org/" class="imprint">自豪地采用WordPress</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
</div>
|
||||
{{template "layout/footer" .}}
|
||||
</body>
|
||||
|
|
9
internal/theme/twentyseventeen/layout/colophon.gohtml
Normal file
9
internal/theme/twentyseventeen/layout/colophon.gohtml
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{define "layout/colophon"}}
|
||||
<footer id="colophon" class="site-footer">
|
||||
<div class="wrap">
|
||||
<div class="site-info">
|
||||
<a href="https://cn.wordpress.org/" class="imprint">自豪地采用WordPress</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
{{end}}
|
|
@ -1,11 +1,4 @@
|
|||
{{define "layout/footer"}}
|
||||
<script id="twentyseventeen-skip-link-focus-fix-js-extra">
|
||||
var twentyseventeenScreenReaderText = {"quote":"<svg class=\"icon icon-quote-right\" aria-hidden=\"true\" role=\"img\"> <use href=\"#icon-quote-right\" xlink:href=\"#icon-quote-right\"><\/use> <\/svg>"};
|
||||
</script>
|
||||
|
||||
<script src="/wp-content/themes/twentyseventeen/assets/js/skip-link-focus-fix.js?ver=20161114" id="twentyseventeen-skip-link-focus-fix-js"></script>
|
||||
<script src="/wp-content/themes/twentyseventeen/assets/js/global.js?ver=20211130" id="twentyseventeen-global-js"></script>
|
||||
<script src="/wp-content/themes/twentyseventeen/assets/js/jquery.scrollTo.js?ver=2.1.3" id="jquery-scrollto-js"></script>
|
||||
{{template "common/footer" .}}
|
||||
{{ block "footer" .}}
|
||||
{{end}}
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="profile" href="https://gmpg.org/xfn/11">
|
||||
<link rel="pingback" href="/xmlrpc.php">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="/wp-content/themes/twentyfifteen/js/html5.js?ver=3.7.0"></script>
|
||||
<![endif]-->
|
||||
<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>
|
||||
<title>{{ .title }}</title>
|
||||
<meta name='robots' content='max-image-preview:large' />
|
||||
|
@ -48,24 +45,8 @@
|
|||
.wp-block-pullquote{font-size: 1.5em;line-height: 1.6;}
|
||||
</style>
|
||||
|
||||
<link rel='stylesheet' id='twentyseventeen-style-css' href='/wp-content/themes/twentyseventeen/style.css?ver=20221101' media='all' />
|
||||
<link rel='stylesheet' id='twentyseventeen-block-style-css' href='/wp-content/themes/twentyseventeen/assets/css/blocks.css?ver=20220912' media='all' />
|
||||
<!--[if lt IE 9]>
|
||||
<link rel='stylesheet' id='twentyseventeen-ie8-css' href='/wp-content/themes/twentyseventeen/assets/css/ie8.css?ver=20161202' media='all' />
|
||||
<![endif]-->
|
||||
<!--[if lt IE 9]>
|
||||
<script src='/wp-content/themes/twentyseventeen/assets/js/html5.js?ver=20161020' id='html5-js'></script>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
<script src='/wp-includes/js/jquery/jquery.min.js?ver=3.6.0' id='jquery-core-js'></script>
|
||||
<script src='/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2' id='jquery-migrate-js'></script>
|
||||
<link rel="https://api.w.org/" href="/wp-json/" /><link rel="EditURI" type="application/rsd+xml" title="RSD" href="/xmlrpc.php?rsd" />
|
||||
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="/wp-includes/wlwmanifest.xml" />
|
||||
<meta name="generator" content="WordPress 6.1.1" />
|
||||
<style>.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
|
||||
{{template "common/head" .}}
|
||||
{{block "head" .}}
|
||||
{{end}}
|
||||
{{template "common/head" .}}
|
||||
</head>
|
||||
{{end}}
|
|
@ -122,6 +122,9 @@
|
|||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{template "layout/colophon"}}
|
||||
|
||||
</div>
|
||||
|
||||
{{else}}
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
{{template "layout/empty" .}}
|
||||
{{end}}
|
||||
|
||||
{{end}}
|
||||
|
||||
</div>
|
||||
{{template "layout/colophon"}}
|
||||
</div>
|
||||
{{end}}
|
47
internal/theme/twentyseventeen/script.go
Normal file
47
internal/theme/twentyseventeen/script.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
package twentyseventeen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/fthvgb1/wp-go/internal/theme/wp"
|
||||
"github.com/fthvgb1/wp-go/internal/wpconfig"
|
||||
)
|
||||
|
||||
func pushHeadScripts(h *wp.Handle) {
|
||||
var head = headScript
|
||||
h.PushGroupHeadScript(30, func(h *wp.Handle) string {
|
||||
return head
|
||||
})
|
||||
}
|
||||
|
||||
func pushFooterScripts(h *wp.Handle) {
|
||||
var footer = footerScript
|
||||
h.PushGroupFooterScript(20, func(h *wp.Handle) string {
|
||||
if "dark" == wpconfig.GetThemeModsVal(ThemeName, "colorscheme", "light") {
|
||||
footer = fmt.Sprintf("%s\n%s", footerScript, ` <link rel="stylesheet" id="twentyseventeen-colors-dark-css" href="/wp-content/themes/twentyseventeen/assets/css/colors-dark.css?ver=20191025" media="all">`)
|
||||
}
|
||||
return footer
|
||||
})
|
||||
}
|
||||
|
||||
var headScript = `<link rel='stylesheet' id='twentyseventeen-style-css' href='/wp-content/themes/twentyseventeen/style.css?ver=20221101' media='all' />
|
||||
<link rel='stylesheet' id='twentyseventeen-block-style-css' href='/wp-content/themes/twentyseventeen/assets/css/blocks.css?ver=20220912' media='all' />
|
||||
<!--[if lt IE 9]>
|
||||
<link rel='stylesheet' id='twentyseventeen-ie8-css' href='/wp-content/themes/twentyseventeen/assets/css/ie8.css?ver=20161202' media='all' />
|
||||
<![endif]-->
|
||||
<!--[if lt IE 9]>
|
||||
<script src='/wp-content/themes/twentyseventeen/assets/js/html5.js?ver=20161020' id='html5-js'></script>
|
||||
<![endif]-->
|
||||
<script src='/wp-includes/js/jquery/jquery.min.js?ver=3.6.0' id='jquery-core-js'></script>
|
||||
<script src='/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2' id='jquery-migrate-js'></script>
|
||||
<link rel="https://api.w.org/" href="/wp-json/" /><link rel="EditURI" type="application/rsd+xml" title="RSD" href="/xmlrpc.php?rsd" />
|
||||
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="/wp-includes/wlwmanifest.xml" />
|
||||
<meta name="generator" content="WordPress 6.1.1" />
|
||||
<style>.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>`
|
||||
|
||||
var footerScript = `<script id="twentyseventeen-skip-link-focus-fix-js-extra">
|
||||
var twentyseventeenScreenReaderText = {"quote":"<svg class=\"icon icon-quote-right\" aria-hidden=\"true\" role=\"img\"> <use href=\"#icon-quote-right\" xlink:href=\"#icon-quote-right\"><\/use> <\/svg>"};
|
||||
</script>
|
||||
|
||||
<script src="/wp-content/themes/twentyseventeen/assets/js/skip-link-focus-fix.js?ver=20161114" id="twentyseventeen-skip-link-focus-fix-js"></script>
|
||||
<script src="/wp-content/themes/twentyseventeen/assets/js/global.js?ver=20211130" id="twentyseventeen-global-js"></script>
|
||||
<script src="/wp-content/themes/twentyseventeen/assets/js/jquery.scrollTo.js?ver=2.1.3" id="jquery-scrollto-js"></script>`
|
|
@ -56,12 +56,8 @@ func ready(next wp.HandleFn[*wp.Handle], h *wp.Handle) {
|
|||
h.PushHandleFn(constraints.ParamError, errHandle)
|
||||
h.PushHandleFn(constraints.InternalErr, errHandle)
|
||||
h.PushGroupHeadScript(10, colorScheme, customHeader)
|
||||
|
||||
if "dark" == wpconfig.GetThemeModsVal(ThemeName, "colorscheme", "light") {
|
||||
h.PushHeadScript(wp.NewComponents(func(h *wp.Handle) string {
|
||||
return ` <link rel="stylesheet" id="twentyseventeen-colors-dark-css" href="/wp-content/themes/twentyseventeen/assets/css/colors-dark.css?ver=20191025" media="all">`
|
||||
}, 10))
|
||||
}
|
||||
pushHeadScripts(h)
|
||||
pushFooterScripts(h)
|
||||
h.SetData("HeaderImage", getHeaderImage(h))
|
||||
h.SetData("scene", h.Scene())
|
||||
next(h)
|
||||
|
|
|
@ -101,8 +101,10 @@ func (d *DetailHandle) ContextPost() {
|
|||
}
|
||||
|
||||
func (d *DetailHandle) Render() {
|
||||
d.PreCodeAndStats()
|
||||
d.PreTemplate()
|
||||
if d.Post.CommentStatus == "open" && wpconfig.GetOption("thread_comments") == "1" {
|
||||
d.PushGroupFooterScript(30, func(h *Handle) string {
|
||||
d.PushGroupFooterScript(10, func(h *Handle) string {
|
||||
return `<script src='/wp-includes/js/comment-reply.min.js' id='comment-reply-js'></script>`
|
||||
})
|
||||
}
|
||||
|
|
|
@ -142,11 +142,14 @@ func (i *IndexHandle) ExecPostsPlugin(calls ...func(*models.Posts)) {
|
|||
}
|
||||
|
||||
func (i *IndexHandle) Render() {
|
||||
i.PreCodeAndStats()
|
||||
i.PreTemplate()
|
||||
i.PushHandleFn(constraints.Ok, NewHandleFn(func(h *Handle) {
|
||||
i.ExecPostsPlugin()
|
||||
i.Pagination()
|
||||
i.ginH["posts"] = i.Posts
|
||||
}, 10))
|
||||
|
||||
i.Handle.Render()
|
||||
}
|
||||
|
||||
|
|
|
@ -201,21 +201,19 @@ func (h *Handle) PreCodeAndStats() {
|
|||
}
|
||||
|
||||
func (h *Handle) Render() {
|
||||
h.PreCodeAndStats()
|
||||
h.PreTemplate()
|
||||
h.CommonComponents()
|
||||
h.ExecHandleFns()
|
||||
}
|
||||
|
||||
func (h *Handle) CommonComponents() {
|
||||
h.AddComponent("customLogo", CalCustomLogo)
|
||||
|
||||
h.PushGroupHeadScript(0, CalSiteIcon, CalCustomCss)
|
||||
|
||||
h.PushHandleFn(constraints.AllStats, NewHandleFn(func(h *Handle) {
|
||||
h.CalMultipleComponents()
|
||||
h.CalBodyClass()
|
||||
}, 10), NewHandleFn(func(h *Handle) {
|
||||
h.C.HTML(h.Code, h.templ, h.ginH)
|
||||
}, 0))
|
||||
|
||||
h.ExecHandleFns()
|
||||
|
||||
}
|
||||
|
||||
func (h *Handle) PushComponents(name string, components ...Components) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user