Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jesselau76/hugo-w3-simple.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjesselau76 <jesselau76@gmail.com>2019-03-19 02:01:07 +0300
committerjesselau76 <jesselau76@gmail.com>2019-03-19 02:01:07 +0300
commitc8ace733fc119a9e07bcd63147b25ebbeff970f5 (patch)
tree9c06cf529e6f68ef00d5b3828b3468601253578b
parentc7f9de35346042cc15ef010f7d8d14480ed4f8ec (diff)
parentadf4e045d219591202bc5cb351eec98f91a1bbc6 (diff)
alllist style
-rw-r--r--README-zh.md3
-rw-r--r--README.md3
-rw-r--r--exampleSite/config.toml2
-rw-r--r--layouts/_default/baseof.html7
-rw-r--r--layouts/_default/list.html207
5 files changed, 143 insertions, 79 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 @@
<div class="w3-content">
<div>
+ {{ if and .IsHome .Site.Params.welcomemessage }}
+ <div class="w3-card-4 w3-container" >
+ {{ .Content | markdownify }}
+ </div>
+ {{ end }}
<div id="content" >
{{ block "main" . }}{{ end }}
</div>
@@ -189,6 +194,7 @@ window.onscroll = function() {scrollFunction()};
function scrollFunction() {
<!-- TOC -->
+ {{ 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 }}
<!-- cookie bar -->
{{ 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 0669cb2..7194573 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -5,55 +5,92 @@
{{ end }}
{{ $paginator := .Paginate (where .Data.Pages "Section" "!=" "") }}
-{{ if .Site.Params.gridstyle }}
-<!-- grid list style -->
+{{ if .Site.Params.allliststyle }}
+ <script src="{{ "/js/w3.js" | relURL }}"></script>
+ <p>
+ <input oninput="w3.filterHTML('#id01', '.item', this.value)" class="w3-input" placeholder="{{ T "postssearch"}}">
+ </p>
+ <div style="overflow-x:auto;">
+ <table id="id01" class="w3-table-all w3-hoverable">
+ <tr class="w3-green" style="white-space:nowrap;">
+ <th onclick="w3.sortHTML('#id01', '.item', 'td:nth-child(1)')" style="cursor:pointer">{{ T "poststitle"}} <i class="fa fa-sort" style="font-size:13px;"></i></th>
+ <th onclick="w3.sortHTML('#id01', '.item', 'td:nth-child(2)')" style="cursor:pointer">{{ T "postsdate"}} <i class="fa fa-sort" style="font-size:13px;"></i>&nbsp;&nbsp;</th>
+ <th onclick="w3.sortHTMLbyNumber('#id01', '.item', 'td:nth-child(3)')" style="cursor:pointer">{{ T "postsword"}} <i class="fa fa-sort" style="font-size:13px;"></i>&nbsp;&nbsp;&nbsp;&nbsp;</th>
+ </tr>
+ {{ if .IsHome }}
+ {{range where .Site.RegularPages "Section" "posts"}}
+ <tr class="item ">
+ <td><a href="{{.Permalink}}">{{.Title}}</a></td>
+ <td>{{ .Date.Format "2006/01/02" }}</td>
+ <td>{{.WordCount}}</td>
+ </tr>
+ {{end}}
+
+ {{ else }}
+ {{range .Pages }}
+ <tr class="item ">
+ <td><a href="{{.Permalink}}">{{.Title}}</a></td>
+ <td>{{ .Date.Format "2006/01/02" }}</td>
+ <td>{{.WordCount}}</td>
+ </tr>
+ {{end}}
+ {{ end }}
+
+ </table>
+ </div>
+{{ else }}
-{{ range $i, $e:= $paginator.Pages }}
- {{ if modBool $i 3 }}
- <div class="w3-row w3-section">
- {{ end }}
- {{ if .Site.Params.lazyload | and (gt $i 1) }}
- {{ $.Scratch.Set "novisual" 1 }}
- {{ end }}
- <div class="w3-col w3-container w3-section m12 l4 ">
- <div class="w3-card-2 w3-hover-shadow " >
+ {{ if .Site.Params.gridstyle }}
+ <!-- grid list style -->
- {{ with .Params.thumbnail }}
- <div class="w3-hover-opacity thumb">
- {{ if eq ( $.Scratch.Get "novisual") 1 }}
-
- <img src="{{ "/placeholder.svg" | relURL }}" data-src="{{ relURL . }}" alt="Thumbnail" />
- {{ else }}
-
- <img src="{{ relURL . }}" alt="Thumbnail" />
- {{ end }}
- </div>
- {{ else }}
- {{ if .Site.Params.firstpic}}
+
+ {{ range $i, $e:= $paginator.Pages }}
+ {{ if modBool $i 3 }}
+ <div class="w3-row w3-section">
+ {{ end }}
+ {{ if .Site.Params.lazyload | and (gt $i 1) }}
+ {{ $.Scratch.Set "novisual" 1 }}
+ {{ end }}
+ <div class="w3-col w3-container w3-section m12 l4 ">
+ <div class="w3-card-2 w3-hover-shadow " >
+
+ {{ with .Params.thumbnail }}
+ <div class="w3-hover-opacity thumb">
+ {{ if eq ( $.Scratch.Get "novisual") 1 }}
- {{ $img := findRE "(?i)<img .*?src\\s*=\\s*\"([^\"]*(png|jpg|jpeg|gif|bmp|svg))\".*?>" .Content 1 }}
- {{ range $img }}
-
- <div class="w3-hover-opacity thumb ">
- {{ if eq ( $.Scratch.Get "novisual") 1 }}
-
- <img src="{{ "/placeholder.svg" | relURL }}" data-src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail"/></div>
-
- {{ else }}
- <img src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail" /></div>
- {{ end }}
-
+ <img src="{{ "/placeholder.svg" | relURL }}" data-src="{{ relURL . }}" alt="Thumbnail" />
+ {{ else }}
+
+ <img src="{{ relURL . }}" alt="Thumbnail" />
+ {{ end }}
+ </div>
+ {{ else }}
+ {{ if .Site.Params.firstpic}}
+
+ {{ $img := findRE "(?i)<img .*?src\\s*=\\s*\"([^\"]*(png|jpg|jpeg|gif|bmp|svg))\".*?>" .Content 1 }}
+ {{ range $img }}
+
+ <div class="w3-hover-opacity thumb ">
+ {{ if eq ( $.Scratch.Get "novisual") 1 }}
+
+ <img src="{{ "/placeholder.svg" | relURL }}" data-src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail"/></div>
+
+ {{ else }}
+ <img src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail" /></div>
+ {{ end }}
+
+ {{ end }}
{{ end }}
{{ end }}
- {{ end }}
-
- <header class="w3-container wraptext w3-text-indigo">
- <h4><a href="{{ .URL }}">{{ .Title | markdownify }}</a></h4>
-
-
- </header>
+
+ <header class="w3-container wraptext w3-text-indigo">
+ <h4><a href="{{ .URL }}">{{ .Title | markdownify }}</a></h4>
+
+
+ </header>
+<<<<<<< HEAD
<div class="w3-container wraptext w3-white">
<code> {{ .Date.Format "2006/01/02" }} </code>
@@ -67,51 +104,67 @@
</p>
</div>
+=======
+ <div class="w3-container wraptext w3-white">
+ <code> {{ .Date.Format "2006/01/02" }} </code>
+
+
+ {{ if gt (len .Summary) 200 }}
+
+
+ <p>{{substr .Summary 0 200 }}...</p>
+
+
+ {{ end }}
+
+ </div>
+>>>>>>> dev
- <footer >
- <a href="{{ .URL }}"><button class="w3-button w3-blue w3-block w3-hover-green">{{ T "readMore" }}</button></a>
- </footer>
- </div>
- </div>
- {{ if or (modBool (add $i 1) 3) (ge (add $i 1) $paginator.Pages) }}
+ <footer >
+ <a href="{{ .URL }}"><button class="w3-button w3-blue w3-block w3-hover-green">{{ T "readMore" }}</button></a>
+ </footer>
</div>
- {{ end }}
-
-{{ end }}
+ </div>
+ {{ if or (modBool (add $i 1) 3) (ge (add $i 1) $paginator.Pages) }}
+ </div>
+ {{ end }}
-{{ else }}
+ {{ end }}
-<!-- simple list style -->
+ {{ else }}
-<ul class="w3-ul w3-hoverable">
+ <!-- simple list style -->
+ <ul class="w3-ul w3-hoverable">
-{{ range $paginator.Pages }}
- <li>
- <span class="date">{{ .Date.Format "2006/01/02" }}</span> &nbsp;
- <a href="{{ .URL }}">{{ .Title | markdownify }}</a>
- </li>
-{{ end }}
-{{ end }}
-</ul>
-</div>
+ {{ range $paginator.Pages }}
+ <li>
+ <span class="date">{{ .Date.Format "2006/01/02" }}</span> &nbsp;
+ <a href="{{ .URL }}">{{ .Title | markdownify }}</a>
+ </li>
+ {{ end }}
+ {{ end }}
+ </ul>
-<br>
-<div class="w3-content" >
- <div class="w3-bar w3-section w3-hide-large w3-hide-medium">
-
- {{ with $paginator.Prev -}}
- <a href="{{ .URL }}" class="w3-btn w3-text-indigo w3-hover-green">&#10094; Previous</a>
- {{- end }}
- {{ with $paginator.Next -}}
- <a href="{{ .URL }}" class="w3-btn w3-right w3-text-indigo w3-hover-green">Next &#10095;</a>
- {{- end }}
-</div>
-<nav class="w3-center w3-hide-small">{{ template "_internal/pagination.html" . }}</nav>
-</div>
+ </div>
-{{- end }}
+ <br>
+ <div class="w3-content" >
+ <div class="w3-bar w3-section w3-hide-large w3-hide-medium">
+
+ {{ with $paginator.Prev -}}
+ <a href="{{ .URL }}" class="w3-btn w3-text-indigo w3-hover-green">&#10094; Previous</a>
+ {{- end }}
+ {{ with $paginator.Next -}}
+ <a href="{{ .URL }}" class="w3-btn w3-right w3-text-indigo w3-hover-green">Next &#10095;</a>
+ {{- end }}
+ </div>
+ <nav class="w3-center w3-hide-small">{{ template "_internal/pagination.html" . }}</nav>
+
+ {{- end }}
+</div>
+{{ end }}