summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-05-08 18:47:25 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-05-08 18:47:25 +0200
commitb29419c9c72bbc2d605addabf0dfd84a7f41b88b (patch)
tree4199578140684b30d7fb93e5c28b86db39442c83 /layouts
parent40288d1362e1074c6e2c0d0d9de5a2d59bc86fb5 (diff)
downloadgohugo-theme-ed-b29419c9c72bbc2d605addabf0dfd84a7f41b88b.tar.gz
Provide ability to list posts on main page
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html2
-rw-r--r--layouts/_default/teaser.html20
-rw-r--r--layouts/index.html44
-rw-r--r--layouts/partials/post-meta.html9
-rw-r--r--layouts/partials/post-meta/date.html11
-rw-r--r--layouts/partials/post-thumbnail.html0
6 files changed, 66 insertions, 20 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 98a05bf..149d500 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -13,7 +13,7 @@
</div>
</header>
- <main class="container content" aria-role="main" id="main">
+ <main class="container content" role="main" id="main">
{{- block "main" . }}{{- end }}
</main>
</div>
diff --git a/layouts/_default/teaser.html b/layouts/_default/teaser.html
new file mode 100644
index 0000000..8e161c1
--- /dev/null
+++ b/layouts/_default/teaser.html
@@ -0,0 +1,20 @@
+<article class="blog-post">
+ {{/* TODO: partial "post-thumbnail.html" (dict "class" "list" "page" .) */}}
+ <header>
+ <h2 class="blog-post-title">
+ <a href="{{ .Permalink }}" rel="bookmark">{{ .Title }}</a>
+ </h2>
+ {{- partial "post-meta.html" . -}}
+ </header>
+ <p class="blog-post-content">
+ {{ .Summary }}
+ </p>
+ {{- if site.Params.readmore }}
+ {{- if .Truncated }}
+ <footer>
+ {{/* TODO: Translate me */}}
+ <a href="{{ .RelPermalink }}" class="read-more">Read more...</a>
+ </footer>
+ {{- end }}
+ {{- end }}
+</article>
diff --git a/layouts/index.html b/layouts/index.html
index e051c4d..2209872 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,20 +1,26 @@
-{{ define "main" -}}
-
-<div class="introduction">
- {{ .Content }}
-</div>
-
-<hr>
-
-<div class="toc">
- <h2>Latest Publications</h2>
- <ul class="texts">
- {{ range first 10 (where site.RegularPages "Section" "!=" "" ) }}
- <li class="text-title">
- <a href="{{ .Permalink }}">{{ .Title }}</a>
- </li>
- {{ end }}
- </ul>
-</div>
-
+{{ define "main" }}
+{{- with .Content }}
+ <div class="introduction">
+ {{ . }}
+ </div>
+ <hr>
+ <div class="toc">
+ {{/* TODO: Translate me */}}
+ <h2>Latest Publications</h2>
+ <ul class="texts">
+ {{ range first 10 (where site.RegularPages "Section" "!=" "") }}
+ <li class="text-title">
+ <a href="{{ .Permalink }}">{{ .Title }}</a>
+ </li>
+ {{ end }}
+ </ul>
+ </div>
+{{- else }}
+ {{ $paginator := .Paginate (where site.RegularPages "Type" "in" site.Params.main_sections) }}
+ <div class="articles">
+ {{- range $paginator.Pages }}
+ {{- .Render "teaser" }}
+ {{- end }}
+ </div>
+{{- end }}
{{- end }}
diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html
new file mode 100644
index 0000000..a539c54
--- /dev/null
+++ b/layouts/partials/post-meta.html
@@ -0,0 +1,9 @@
+<div class="post-meta">
+ {{- $root := . -}}
+ {{- with .Param "post_meta" -}}
+ {{- range $field := . -}}
+ {{- $p := printf "post-meta/%s.html" $field -}}
+ {{- partial $p $root -}}
+ {{- end -}}
+ {{- end -}}
+</div>
diff --git a/layouts/partials/post-meta/date.html b/layouts/partials/post-meta/date.html
new file mode 100644
index 0000000..6afce4c
--- /dev/null
+++ b/layouts/partials/post-meta/date.html
@@ -0,0 +1,11 @@
+{{- if not .Date.IsZero }}
+<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
+ {{- .Date.Format (site.Params.dateformat | default "January 02, 2006") -}}
+</time>
+{{- if ne .Date .Lastmod }}
+<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
+ {{- /* TODO: Translate me */}}
+ Updated: {{- .Lastmod.Format (site.Params.dateformat | default "January 02, 2006") -}}
+</time>
+{{- end -}}
+{{- end }}
diff --git a/layouts/partials/post-thumbnail.html b/layouts/partials/post-thumbnail.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/layouts/partials/post-thumbnail.html