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

github.com/xiaoheiAh/hugo-theme-pure.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotis <xiaohei.zyx@gmail.com>2019-11-21 10:21:33 +0300
committerZhao XiaoHei <xiaohei.zyx@gmail.com>2019-11-21 10:23:10 +0300
commit72cc5d173b03d5f6964bd425e2850cbeabacec9e (patch)
treeb47abcaeeac81e5ed111b57ec18c5fc136cdfdcb
parent0edbbd764f3edb835f81727763d61bcf26987993 (diff)
refactor item post
-rw-r--r--layouts/_default/category.html5
-rw-r--r--layouts/_default/list.html10
-rw-r--r--layouts/_default/tag.html3
-rw-r--r--layouts/_default/tag.terms.html3
-rw-r--r--layouts/partials/item-post.html33
5 files changed, 10 insertions, 44 deletions
diff --git a/layouts/_default/category.html b/layouts/_default/category.html
index 9f21938..fb5ae98 100644
--- a/layouts/_default/category.html
+++ b/layouts/_default/category.html
@@ -30,9 +30,8 @@
aria-labelledby="heading{{ .Name | md5}}">
<div class="panel-body">
<div class="collection">
- {{- range .Pages }}
- {{- .Page.Scratch.Set "type" "link"}}
- {{- partial "item-post.html" . }}
+ {{- range .Pages }}
+ {{- partial "item-post.html" . }}
{{- end }}
</div>
</div>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 9e1e55a..9ea1261 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -8,11 +8,8 @@
<div class="article-body">
{{ range $idx,$page := .Pages }}
{{ $thisYear := $page.Date.Format ("2006") }}
- {{- $lastElement := $idx | add -1 | index $.Pages }}
+ {{- $lastElement := $idx | add -1 | index $.RegularPages }}
{{- if or (eq $idx 0) ( ne ($lastElement.Date.Format "2006") $thisYear ) }}
- {{- if ne $idx 0 }}
- </div></div></div></section>
- {{- end }}
<section class="panel panel-default b-no">
<div class="panel-heading" role="tab">
<h3 class="panel-title">
@@ -26,9 +23,12 @@
aria-labelledby="heading{{- $thisYear }}">
<div class="panel-body">
<div class="collection">
+ {{- if ne $idx 0 }}
+ </div></div></div></section>
+ {{- end }}
{{- end }}
- {{- .Page.Scratch.Set "type" "link"}}
+ {{- .Scratch.Set "type" "link"}}
{{- partial "item-post.html" . }}
{{- end }}
diff --git a/layouts/_default/tag.html b/layouts/_default/tag.html
index 1909530..4368a7e 100644
--- a/layouts/_default/tag.html
+++ b/layouts/_default/tag.html
@@ -18,8 +18,7 @@
<div class="article-body">
{{- range .Pages }}
<div class="col-md-6">
- {{- .Page.Scratch.Set "type" "card"}}
- {{- partial "item-post.html" . }}
+ {{- partial "card-post.html" . }}
</div>
{{- end }}
</div>
diff --git a/layouts/_default/tag.terms.html b/layouts/_default/tag.terms.html
index ed5feed..31030f1 100644
--- a/layouts/_default/tag.terms.html
+++ b/layouts/_default/tag.terms.html
@@ -24,8 +24,7 @@
<div class="row">
{{- range $taxonomy }}
<div class="col-md-6">
- {{ .Page.Scratch.Set "type" "card"}}
- {{- partial "item-post.html" . }}
+ {{- partial "card-post.html" . }}
</div>
{{- end }}
</div>
diff --git a/layouts/partials/item-post.html b/layouts/partials/item-post.html
index 52686d1..d7a58a3 100644
--- a/layouts/partials/item-post.html
+++ b/layouts/partials/item-post.html
@@ -1,36 +1,5 @@
-{{- $type := .Page.Scratch.Get "type" }}
-{{- if eq $type "link" }}
<a href="{{- .Permalink }}" class="collection-item" itemprop="url" target="_blank" >
<time datetime="{{ .Date }}"
itemprop="datePublished">{{- .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</time>
<span>&nbsp;&nbsp;&nbsp;</span> {{- .Title }}
-</a>
-{{- else if eq $type "card" }}
-<article class="panel panel-default hover-shadow hover-grow" itemscope itemtype="http://schema.org/BlogPosting">
- <div class="panel-body">
- <div class="article-meta">
- <time datetime="{{ .Date }}"
- itemprop="datePublished">{{- .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</time>
- </div>
- <h3 class="article-title" itemprop="name">
- <a class="article-link" href="{{- .Permalink }}">{{- .Title }}</a>
- </h3>
- </div>
- {{- with .Params.tags }}
- <div class="panel-footer">
- {{- range first 3 . }}
- <a href="{{ "tags/" | absURL }}{{ . | urlize }}" class="label label-default mb">{{ . }}</a>
- {{- end }}
- {{- if gt (len .) 3 }}
- <span class="label label-default mb">ยทยทยท</span>
- {{- end }}
- </div>
- {{- end }}
-</article>
-{{- else }}
-<a href="{{- .RelPermalink }}" class="collection-item" target="_blank" itemprop="url">
- <time datetime="{{ .Date }}"
- itemprop="datePublished">{{- .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</time>
- <span>&nbsp;&nbsp;&nbsp;</span> {{- .Title }}
-</a>
-{{- end }} \ No newline at end of file
+</a> \ No newline at end of file