From 147d382a1a467bbd2e76b8677597c5152618e8dc Mon Sep 17 00:00:00 2001 From: xing Date: Mon, 19 Sep 2022 00:07:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/layout/base.gohtml | 36 ++ templates/layout/base.html | 36 -- templates/layout/empty.gohtml | 37 ++ templates/layout/empty.html | 37 -- .../layout/{footer.html => footer.gohtml} | 0 templates/layout/head.gohtml | 485 ++++++++++++++++++ templates/layout/head.html | 43 -- .../{pagination.html => pagination.gohtml} | 0 .../layout/{sidebar.html => sidebar.gohtml} | 0 .../posts/{detail.html => detail.gohtml} | 0 templates/posts/index.gohtml | 70 +++ templates/posts/index.html | 70 --- 12 files changed, 628 insertions(+), 186 deletions(-) create mode 100644 templates/layout/base.gohtml delete mode 100644 templates/layout/base.html create mode 100644 templates/layout/empty.gohtml delete mode 100644 templates/layout/empty.html rename templates/layout/{footer.html => footer.gohtml} (100%) create mode 100644 templates/layout/head.gohtml delete mode 100644 templates/layout/head.html rename templates/layout/{pagination.html => pagination.gohtml} (100%) rename templates/layout/{sidebar.html => sidebar.gohtml} (100%) rename templates/posts/{detail.html => detail.gohtml} (100%) create mode 100644 templates/posts/index.gohtml delete mode 100644 templates/posts/index.html diff --git a/templates/layout/base.gohtml b/templates/layout/base.gohtml new file mode 100644 index 0000000..550232f --- /dev/null +++ b/templates/layout/base.gohtml @@ -0,0 +1,36 @@ +{{ define "layout/base"}} + + + + {{template "layout/head" .}} + {{block "head" .}} + {{end}} + + +
+ + + +
+ {{block "content" .}} + + {{end}} +
+
+ {{template "layout/footer" .}} +
+ +
+ + +{{ end }} \ No newline at end of file diff --git a/templates/layout/base.html b/templates/layout/base.html deleted file mode 100644 index 6ea3512..0000000 --- a/templates/layout/base.html +++ /dev/null @@ -1,36 +0,0 @@ -{{ define "layout/base"}} - - - - {{template "layout/head" .}} - {{block "head" .}} - {{end}} - - -
- - - -
- {{block "content" .}} - - {{end}} -
-
- {{template "layout/footer" .}} -
- -
- - -{{ end }} \ No newline at end of file diff --git a/templates/layout/empty.gohtml b/templates/layout/empty.gohtml new file mode 100644 index 0000000..d431380 --- /dev/null +++ b/templates/layout/empty.gohtml @@ -0,0 +1,37 @@ +{{define "layout/empty"}} +
+
+ +
+ + +
+ +

{{if .search}} + 抱歉,没有符合您搜索条件的结果。请换其它关键词再试。 + {{else}} + 这儿似乎什么都没有,试试搜索? + {{end}} +

+ + +
+
+ +
+
+{{end}} \ No newline at end of file diff --git a/templates/layout/empty.html b/templates/layout/empty.html deleted file mode 100644 index d84c0db..0000000 --- a/templates/layout/empty.html +++ /dev/null @@ -1,37 +0,0 @@ -{{define "layout/empty"}} -
-
- -
- - -
- -

{{if .search}} - 抱歉,没有符合您搜索条件的结果。请换其它关键词再试。 - {{else}} - 这儿似乎什么都没有,试试搜索? - {{end}} -

- - -
-
- -
-
-{{end}} \ No newline at end of file diff --git a/templates/layout/footer.html b/templates/layout/footer.gohtml similarity index 100% rename from templates/layout/footer.html rename to templates/layout/footer.gohtml diff --git a/templates/layout/head.gohtml b/templates/layout/head.gohtml new file mode 100644 index 0000000..9b9750b --- /dev/null +++ b/templates/layout/head.gohtml @@ -0,0 +1,485 @@ +{{define "layout/head"}} + + + + {{ .title }} + + + + + + + + + + + + + + +{{end}} \ No newline at end of file diff --git a/templates/layout/head.html b/templates/layout/head.html deleted file mode 100644 index 0744828..0000000 --- a/templates/layout/head.html +++ /dev/null @@ -1,43 +0,0 @@ -{{define "layout/head"}} - - - -{{ .title }} - - - - - - - - - - - - - - -{{end}} \ No newline at end of file diff --git a/templates/layout/pagination.html b/templates/layout/pagination.gohtml similarity index 100% rename from templates/layout/pagination.html rename to templates/layout/pagination.gohtml diff --git a/templates/layout/sidebar.html b/templates/layout/sidebar.gohtml similarity index 100% rename from templates/layout/sidebar.html rename to templates/layout/sidebar.gohtml diff --git a/templates/posts/detail.html b/templates/posts/detail.gohtml similarity index 100% rename from templates/posts/detail.html rename to templates/posts/detail.gohtml diff --git a/templates/posts/index.gohtml b/templates/posts/index.gohtml new file mode 100644 index 0000000..9956ef2 --- /dev/null +++ b/templates/posts/index.gohtml @@ -0,0 +1,70 @@ +{{template "layout/base" .}} +{{define "content" }} + {{if .posts}} +
+
+ {{if .header}} + + {{end}} + {{ range $k,$v:=.posts}} + + {{end}} + + {{template "layout/page" .}} +
+
+ {{else }} + {{template "layout/empty" .}} + {{end}} + +{{end}} diff --git a/templates/posts/index.html b/templates/posts/index.html deleted file mode 100644 index a4f7af0..0000000 --- a/templates/posts/index.html +++ /dev/null @@ -1,70 +0,0 @@ -{{template "layout/base" .}} -{{define "content" }} -{{if .posts}} -
-
- {{if .header}} - - {{end}} - {{ range $k,$v:=.posts}} - - {{end}} - - {{template "layout/page" .}} -
-
-{{else }} -{{template "layout/empty" .}} -{{end}} - -{{end}}