diff --git a/README.md b/README.md index cc70ef5..8e3fa9f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ ## wp-go a simple front of wordpress build with golang. -一个go写的wordress的前端,功能比较简单,只有列表页和详情页,rss2,主题只有一个twentyfifeen主题,插件的话只有一个简单的列表页的摘要生成和enlighter代码高亮。本身只用于展示文章,添加评论走的转发请求到php的wordpress。 \ No newline at end of file +一个go写的wordress的前端,功能比较简单,只有列表页和详情页,rss2,主题只有一个twentyfifteen主题,插件的话只有一个简单的列表页的摘要生成和enlighter代码高亮。本身只用于展示文章,添加评论走的转发请求到php的wordpress。 \ No newline at end of file diff --git a/actions/detail.go b/actions/detail.go index c4175c7..b09dd9f 100644 --- a/actions/detail.go +++ b/actions/detail.go @@ -45,7 +45,7 @@ func Detail(c *gin.Context) { status = http.StatusInternalServerError c.Error(err) } - c.HTML(status, "posts/detail.gohtml", h) + c.HTML(status, "twentyfifteen/posts/detail.gohtml", h) }() id := c.Param("id") Id := 0 diff --git a/actions/index.go b/actions/index.go index 3aaef7f..128eee5 100644 --- a/actions/index.go +++ b/actions/index.go @@ -195,7 +195,7 @@ func Index(c *gin.Context) { c.Error(err) stat = http.StatusInternalServerError } - c.HTML(stat, "posts/index.gohtml", ginH) + c.HTML(stat, "twentyfifteen/posts/index.gohtml", ginH) }() if err != nil { return diff --git a/templates/feed/feed.gohtml b/templates/feed/feed.gohtml deleted file mode 100644 index 22d962d..0000000 --- a/templates/feed/feed.gohtml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - {{ .options.blogname }} - - {{.options.siteurl}}/ - {{.options.blogdescription}} - {{.now}} - zh-CN - - hourly - - - 1 - - https://wordpress.org/?v=6.0.2 - {{range $k,$v := .posts}} - - {{$v.PostTitle}} - {{$v.Link}} - {{if $v.CommentLink}} - {{ $v.CommentLink}} - {{end}} - - {{$v.Date}} - - {{$v.Guid}} - - - {{if gt $v.CommentCount 0 }} - {{$v.CommentLink}} - {{$v.CommentCount}} - {{end}} - - - {{end}} - - diff --git a/templates/templatefs.go b/templates/templatefs.go index 910d0bf..e607ee2 100644 --- a/templates/templatefs.go +++ b/templates/templatefs.go @@ -8,7 +8,7 @@ import ( "path/filepath" ) -//go:embed posts layout feed +//go:embed twentyfifteen var TemplateFs embed.FS type FsTemplate struct { @@ -21,13 +21,13 @@ func NewFsTemplate(funcMap template.FuncMap) *FsTemplate { } func (t *FsTemplate) SetTemplate() *FsTemplate { - mainTemplates, err := fs.Glob(TemplateFs, "*[^layout]/*.gohtml") + mainTemplates, err := fs.Glob(TemplateFs, `twentyfifteen/*[^layout]/*.gohtml`) if err != nil { panic(err) } for _, include := range mainTemplates { name := filepath.Base(include) - t.Templates[include] = template.Must(template.New(name).Funcs(t.FuncMap).ParseFS(TemplateFs, include, "layout/*.gohtml")) + t.Templates[include] = template.Must(template.New(name).Funcs(t.FuncMap).ParseFS(TemplateFs, include, "twentyfifteen/layout/*.gohtml")) } return t } diff --git a/templates/layout/base.gohtml b/templates/twentyfifteen/layout/base.gohtml similarity index 100% rename from templates/layout/base.gohtml rename to templates/twentyfifteen/layout/base.gohtml diff --git a/templates/layout/empty.gohtml b/templates/twentyfifteen/layout/empty.gohtml similarity index 100% rename from templates/layout/empty.gohtml rename to templates/twentyfifteen/layout/empty.gohtml diff --git a/templates/layout/footer.gohtml b/templates/twentyfifteen/layout/footer.gohtml similarity index 100% rename from templates/layout/footer.gohtml rename to templates/twentyfifteen/layout/footer.gohtml diff --git a/templates/layout/head.gohtml b/templates/twentyfifteen/layout/head.gohtml similarity index 100% rename from templates/layout/head.gohtml rename to templates/twentyfifteen/layout/head.gohtml diff --git a/templates/layout/message.gohtml b/templates/twentyfifteen/layout/message.gohtml similarity index 100% rename from templates/layout/message.gohtml rename to templates/twentyfifteen/layout/message.gohtml diff --git a/templates/layout/pagination.gohtml b/templates/twentyfifteen/layout/pagination.gohtml similarity index 100% rename from templates/layout/pagination.gohtml rename to templates/twentyfifteen/layout/pagination.gohtml diff --git a/templates/layout/sidebar.gohtml b/templates/twentyfifteen/layout/sidebar.gohtml similarity index 100% rename from templates/layout/sidebar.gohtml rename to templates/twentyfifteen/layout/sidebar.gohtml diff --git a/templates/layout/svg.gohtml b/templates/twentyfifteen/layout/svg.gohtml similarity index 100% rename from templates/layout/svg.gohtml rename to templates/twentyfifteen/layout/svg.gohtml diff --git a/templates/posts/detail.gohtml b/templates/twentyfifteen/posts/detail.gohtml similarity index 100% rename from templates/posts/detail.gohtml rename to templates/twentyfifteen/posts/detail.gohtml diff --git a/templates/posts/index.gohtml b/templates/twentyfifteen/posts/index.gohtml similarity index 100% rename from templates/posts/index.gohtml rename to templates/twentyfifteen/posts/index.gohtml