diff --git a/internal/pkg/constraints/components/constraints.go b/internal/pkg/constraints/widgets/constraints.go similarity index 89% rename from internal/pkg/constraints/components/constraints.go rename to internal/pkg/constraints/widgets/constraints.go index ae9b950..c978f70 100644 --- a/internal/pkg/constraints/components/constraints.go +++ b/internal/pkg/constraints/widgets/constraints.go @@ -1,4 +1,4 @@ -package components +package widgets const ( SearchFormArgs = "SearchFormArgs" diff --git a/internal/theme/fs.go b/internal/theme/fs.go index 2563a58..9a1be26 100644 --- a/internal/theme/fs.go +++ b/internal/theme/fs.go @@ -38,7 +38,7 @@ func commonTemplate(t *multipTemplate.MultipleFsTemplate) { for _, main := range m { file := filepath.Base(main) dir := strings.Split(main, "/")[0] - templ := template.Must(template.New(file).Funcs(t.FuncMap).ParseFS(t.Fs, main, filepath.Join(dir, "layout/*.gohtml"), "wp/template.gohtml", "wp/*/*/*.gohtml")) + templ := template.Must(template.New(file).Funcs(t.FuncMap).ParseFS(t.Fs, main, filepath.Join(dir, "layout/*.gohtml"), "wp/template.gohtml")) t.SetTemplate(main, templ) } } diff --git a/internal/theme/twentyfifteen/twentyfifteen.go b/internal/theme/twentyfifteen/twentyfifteen.go index 90e7f18..5ab6ebb 100644 --- a/internal/theme/twentyfifteen/twentyfifteen.go +++ b/internal/theme/twentyfifteen/twentyfifteen.go @@ -5,10 +5,11 @@ import ( "encoding/json" "github.com/fthvgb1/wp-go/internal/pkg/config" "github.com/fthvgb1/wp-go/internal/pkg/constraints" - "github.com/fthvgb1/wp-go/internal/pkg/constraints/components" + "github.com/fthvgb1/wp-go/internal/pkg/constraints/widgets" "github.com/fthvgb1/wp-go/internal/pkg/logs" "github.com/fthvgb1/wp-go/internal/plugins/wphandle" "github.com/fthvgb1/wp-go/internal/theme/wp" + "github.com/fthvgb1/wp-go/internal/theme/wp/components" "strings" ) @@ -39,9 +40,9 @@ func Hook(h *wp.Handle) { } func dispatch(next wp.HandleFn[*wp.Handle], h *wp.Handle) { - h.WidgetArea() + components.WidgetArea(h) h.GetPassword() - h.PushComponentFilterFn(components.SearchFormArgs, func(h *wp.Handle, s string) string { + h.PushComponentFilterFn(widgets.SearchFormArgs, func(h *wp.Handle, s string) string { return strings.ReplaceAll(s, `class="search-submit"`, `class="search-submit screen-reader-text"`) }) wphandle.RegisterPlugins(h, config.GetConfig().Plugins...) diff --git a/internal/theme/twentyseventeen/layout/sidebar.gohtml b/internal/theme/twentyseventeen/layout/sidebar.gohtml index 1bc0095..37b69ba 100644 --- a/internal/theme/twentyseventeen/layout/sidebar.gohtml +++ b/internal/theme/twentyseventeen/layout/sidebar.gohtml @@ -1,21 +1,5 @@ {{define "layout/sidebar" }} - - {{template "common/recent-posts" .}} - {{template "common/recent-comments" .}} - {{template "common/archives" .}} + {{template "common/sidebarWidget" .}}

分类