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

github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/blog/archive.html35
-rw-r--r--layouts/partials/blog/li.html7
-rw-r--r--layouts/partials/home/blog.html53
3 files changed, 51 insertions, 44 deletions
diff --git a/layouts/partials/blog/archive.html b/layouts/partials/blog/archive.html
index 21e1a4a..a98b97b 100644
--- a/layouts/partials/blog/archive.html
+++ b/layouts/partials/blog/archive.html
@@ -1,24 +1,27 @@
<section>
- {{ $prev := now.Format "2006"}} <!--start from the current year-->
- {{ range first 1 .Pages.ByPublishDate.Reverse }}
- {{if .Date}} <!--also add the header if there are posts during the current year-->
- {{if eq $prev (.Date.Format "2006")}} <h2 class="title is-2 top-pad"> {{ $prev }}</h2> {{end}}
+ {{ $prev := now.Format "2006"}}
+ <!--start from the current year-->
+ {{ range first 1 .Pages.ByPublishDate.Reverse }}
+ {{if .Date}}
+ <!--also add the header if there are posts during the current year-->
+ {{if eq $prev (.Date.Format "2006")}}
+ <h2 class="title is-2 top-pad"> {{ $prev }}</h2> {{end}}
+ {{end}}
{{end}}
- {{end}}
- {{range .Pages.ByPublishDate.Reverse}}
+ {{range .Pages.ByPublishDate.Reverse}}
{{if .Date}}
{{$curr := .Date.Format "2006"}}
- {{if lt $curr $prev }}
- <h2 class="title is-2 top-pad">{{ $curr }}</h2>
- {{end}}
+ {{if lt $curr $prev }}
+ <h2 class="title is-2 top-pad">{{ $curr }}</h2>
+ {{end}}
<li class="post-item">
- {{ if .Params.date }}
- <span>{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}</span> -
- {{ end }}
- <span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span>
+ {{ if .Params.date }}
+ <span>{{ .Date.Format (.Site.Params.dateFormat | default ":date_medium") }}</span> -
+ {{ end }}
+ <span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span>
</li>
- {{ $prev = $curr}}
+ {{ $prev = $curr}}
+ {{end}}
{{end}}
- {{end}}
-</section> \ No newline at end of file
+</section>
diff --git a/layouts/partials/blog/li.html b/layouts/partials/blog/li.html
index e72f1cd..36e7830 100644
--- a/layouts/partials/blog/li.html
+++ b/layouts/partials/blog/li.html
@@ -1,5 +1,6 @@
{{ range .Pages.ByPublishDate.Reverse }}
- <li class="post-item">
- <span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span>{{ if .Params.date }} - <span>{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}</span>{{ end }}
- </li>
+<li class="post-item">
+ <span><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></span>{{ if .Params.date }} -
+ <span>{{ .Date.Format (.Site.Params.dateFormat | default ":date_medium") }}</span>{{ end }}
+</li>
{{ end }}
diff --git a/layouts/partials/home/blog.html b/layouts/partials/home/blog.html
index 9f6cd59..0c6b9fb 100644
--- a/layouts/partials/home/blog.html
+++ b/layouts/partials/home/blog.html
@@ -4,40 +4,43 @@
<div class="container">
{{ if .Site.Params.home.showLatest | default true }}
<h2 class="title is-2 has-text-centered">{{ i18n "index_blog_latestPosts" . }}</h2>
- {{ range first 1 .Pages.ByPublishDate.Reverse }}
- <div class="summary">{{ if .Params.date }}{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}{{ end }}
- <h3 class="title is-3 latest-post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h3>
- <div class="markdown">
- {{ .Summary }}
- {{ if .Truncated }}
- <a href="{{ .Permalink }}">{{ i18n "index_blog_readMore" . }}</a>
- {{ end }}
- </div>
+ {{ range first 1 .Pages.ByPublishDate.Reverse }}
+ <div class="summary">
+ {{ if .Params.date }}{{ .Date.Format (.Site.Params.dateFormat | default ":date_medium") }}{{ end }}
+ <h3 class="title is-3 latest-post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h3>
+ <div class="markdown">
+ {{ .Summary }}
+ {{ if .Truncated }}
+ <a href="{{ .Permalink }}">{{ i18n "index_blog_readMore" . }}</a>
+ {{ end }}
</div>
- {{ end }}
+ </div>
+ {{ end }}
{{ end }}
</div>
</div>
- {{ if .Site.Params.home.showAllPosts }}
- <div class="section" id="all-posts">
- <div class="container">
- <h2 class="title is-2 top-pad">{{ i18n "index_blog_allPosts" . }}</h2>
- {{if .Site.Params.home.allPostsArchiveFormat}}
- {{ partialCached "blog/archive.html" .}}
- {{else}}
- {{ partialCached "blog/li.html" . }}
+{{ if .Site.Params.home.showAllPosts }}
+<div class="section" id="all-posts">
+ <div class="container">
+ <h2 class="title is-2 top-pad">{{ i18n "index_blog_allPosts" . }}</h2>
+ {{if .Site.Params.home.allPostsArchiveFormat}}
+ {{ partialCached "blog/archive.html" .}}
+ {{else}}
+ {{ partialCached "blog/li.html" . }}
{{end}}
- </div>
</div>
- {{ else }}
- <div class="container has-text-centered top-pad">
- <a href="{{ .Permalink }}">{{ i18n "index_blog_allPosts" . }}</a>
- </div>
- {{ end }}
+</div>
+{{ else }}
+<div class="container has-text-centered top-pad">
+ <a href="{{ .Permalink }}">{{ i18n "index_blog_allPosts" . }}</a>
+</div>
+{{ end }}
<!-- End Blog container -->
{{ partial "top-icon.html" . }}
<!-- End Blog section -->
-<div class="container"><hr></div>
+<div class="container">
+ <hr>
+</div>
{{ end }}