From adf4e045d219591202bc5cb351eec98f91a1bbc6 Mon Sep 17 00:00:00 2001 From: jesselau76 Date: Tue, 19 Mar 2019 11:43:12 +1300 Subject: alllist style --- README-zh.md | 3 +- README.md | 3 +- exampleSite/config.toml | 2 + layouts/_default/baseof.html | 7 ++ layouts/_default/list.html | 213 +++++++++++++++++++++++++------------------ 5 files changed, 138 insertions(+), 90 deletions(-) diff --git a/README-zh.md b/README-zh.md index 1c9fba2..1e7ed71 100644 --- a/README-zh.md +++ b/README-zh.md @@ -7,6 +7,7 @@ + # Hugo W3 SIMPLE @@ -26,7 +27,7 @@ - 当前版本四种快捷方式:Info, Warning, Colorcode, quote. [演示](https://jesselau.com/hugo-w3-simple-shortcodes-demo/ - Sphinx 或者Manticore search全文本搜索支持. 直接生成可被Sphinx 或者Manticore search检索的XML文件。[运行演示](https://jesselau.com/search/) - 滑屏时自动显示文章目录、进度条指示和回到顶端按钮 - - 网格化风格和极简化风格可切换。 + - 全部列表式风格、网格化风格和极简化风格,三种风格可切换。 - 全部帖子可集中于一页,并带表格排序、标题过滤功能. [运行演示](https://jesselau.com/allposts/) - Google翻译. - 社交按钮. diff --git a/README.md b/README.md index 107ce68..d5d3930 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ + # Hugo W3 SIMPLE [Demo](https://themes.gohugo.io/theme/hugo-w3-simple/) | [Live](https://jesselau.com/) | [中文说明](https://github.com/jesselau76/hugo-w3-simple/blob/master/README-zh.md) @@ -26,7 +27,7 @@ - Shortcodes:Info, Warning, Colorcode, quote. [Demo Here](https://jesselau.com/w3-simple-shortcodes-demo/) - Sphinx or Manticore search supported. Output xml file which can be indexed by sphinx and manticore search. Example site can not include search function because it need server-side setting. [Live Search function Demo Here](https://jesselau.com/search/) - Table of content and back to top button on scroll. - - Grid style and simple list style. + - Alllist, Grid style and simple list style. - All posts in one page. With a filterable, sortable and responsive table powered by w3.js. [Live Demo Here.](https://jesselau.com/en/allposts/) - Google translate. - Social icon. diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 9806712..634aac1 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -80,6 +80,7 @@ contentDir = "content/chinese" [params] + welcomemessage = false #if set true. The home page will display the content of _index.md authorandlicense = true authorimgurl = "https://raw.githubusercontent.com/jesselau76/hugo-w3-simple/master/exampleSite/images/johndoe.jpg" #if authorandlicense set true, this one must be set too @@ -88,6 +89,7 @@ contentDir = "content/chinese" lazyload = true #if set true, lazy load images on websites asynchronously — that is, after the above-the-fold content is fully loaded, or even conditionally, only when they appear in the browser's viewport. glowlogo = true # if want logo to have glowing style, set true. scrollindicator = true # if need scroll indicator on the top, set true + allliststyle = false # list post with sortable all list style. If false then gridstyle or simple style gridstyle = true # list post with grid style. If false then simple list readingtime = true #display reading time firstpic = true # display first picture as thumbnail if no thumbnail set. For gridstyle only diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index f246adc..fd97097 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -22,6 +22,11 @@
+ {{ if and .IsHome .Site.Params.welcomemessage }} +
+ {{ .Content | markdownify }} +
+ {{ end }}
{{ block "main" . }}{{ end }}
@@ -189,6 +194,7 @@ window.onscroll = function() {scrollFunction()}; function scrollFunction() { + {{ if not .IsHome }} {{ if and (ge (len .TableOfContents) 100) (ne .Params.toc "false") }} if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) { @@ -197,6 +203,7 @@ function scrollFunction() { document.getElementById("toc").style.display = "none"; } {{ end }} + {{ end }} {{ if .Site.Params.cookie_info }} if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) { diff --git a/layouts/_default/list.html b/layouts/_default/list.html index c128195..03c71e7 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -5,113 +5,150 @@ {{ end }} {{ $paginator := .Paginate (where .Data.Pages "Section" "!=" "") }} -{{ if .Site.Params.gridstyle }} - +{{ if .Site.Params.allliststyle }} + +

+ +

+
+ + + + + + + {{ if .IsHome }} + {{range where .Site.RegularPages "Section" "posts"}} + + + + + + {{end}} + + {{ else }} + {{range .Pages }} + + + + + + {{end}} + {{ end }} + +
{{ T "poststitle"}} {{ T "postsdate"}}   {{ T "postsword"}}     
{{.Title}}{{ .Date.Format "2006/01/02" }}{{.WordCount}}
{{.Title}}{{ .Date.Format "2006/01/02" }}{{.WordCount}}
+
+{{ else }} -{{ range $i, $e:= $paginator.Pages }} - {{ if modBool $i 3 }} -
- {{ end }} - {{ if .Site.Params.lazyload | and (gt $i 1) }} - {{ $.Scratch.Set "novisual" 1 }} - {{ end }} -
-
+ {{ if .Site.Params.gridstyle }} + - {{ with .Params.thumbnail }} -
- {{ if eq ( $.Scratch.Get "novisual") 1 }} - - Thumbnail - {{ else }} - - Thumbnail - {{ end }} -
- {{ else }} - {{ if .Site.Params.firstpic}} + + {{ range $i, $e:= $paginator.Pages }} + {{ if modBool $i 3 }} +
+ {{ end }} + {{ if .Site.Params.lazyload | and (gt $i 1) }} + {{ $.Scratch.Set "novisual" 1 }} + {{ end }} +
+
+ + {{ with .Params.thumbnail }} +
+ {{ if eq ( $.Scratch.Get "novisual") 1 }} - {{ $img := findRE "(?i)" .Content 1 }} - {{ range $img }} - -
- {{ if eq ( $.Scratch.Get "novisual") 1 }} - - " "$1" . }}" alt="Thumbnail"/>
- - {{ else }} - " "$1" . }}" alt="Thumbnail" />
- {{ end }} - + Thumbnail + {{ else }} + + Thumbnail + {{ end }} +
+ {{ else }} + {{ if .Site.Params.firstpic}} + + {{ $img := findRE "(?i)" .Content 1 }} + {{ range $img }} + +
+ {{ if eq ( $.Scratch.Get "novisual") 1 }} + + " "$1" . }}" alt="Thumbnail"/>
+ + {{ else }} + " "$1" . }}" alt="Thumbnail" />
+ {{ end }} + + {{ end }} {{ end }} {{ end }} - {{ end }} - -
-

{{ .Title | markdownify }}

- - -
+ +
+

{{ .Title | markdownify }}

+ + +
-
- {{ .Date.Format "2006/01/02" }} +
+ {{ .Date.Format "2006/01/02" }} + - - {{ if gt (len .Summary) 200 }} + {{ if gt (len .Summary) 200 }} - -

{{substr .Summary 0 200 }}...

- - - {{ end }} - -
+ +

{{substr .Summary 0 200 }}...

+ + + {{ end }} + +
- -
-
- {{ if or (modBool (add $i 1) 3) (ge (add $i 1) $paginator.Pages) }} +
- {{ end }} - -{{ end }} +
+ {{ if or (modBool (add $i 1) 3) (ge (add $i 1) $paginator.Pages) }} +
+ {{ end }} -{{ else }} + {{ end }} - + {{ else }} -
+ {{ range $paginator.Pages }} +
  • + {{ .Date.Format "2006/01/02" }}   + {{ .Title | markdownify }} +
  • + {{ end }} + {{ end }} + -
    -
    -
    - - {{ with $paginator.Prev -}} - ❮ Previous - {{- end }} - {{ with $paginator.Next -}} - Next ❯ - {{- end }} -
    - -
    + -{{- end }} +
    +
    +
    + + {{ with $paginator.Prev -}} + ❮ Previous + {{- end }} + {{ with $paginator.Next -}} + Next ❯ + {{- end }} +
    + + + {{- end }} +
    +{{ end }} -- cgit v1.2.3