aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layouts/index.html8
-rw-r--r--layouts/partials/post_meta.html75
-rw-r--r--layouts/partials/preview.html67
3 files changed, 150 insertions, 0 deletions
diff --git a/layouts/index.html b/layouts/index.html
index 21670a4..7efe597 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -68,6 +68,14 @@
</div>
</section>
{{ end }}
+
+ <div class="posts-list">
+ {{ $pag := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) }}
+ {{ range $pag.Pages }}
+ {{ partial "preview.html" . }}
+ {{ end }}
+ </div>
+
<!-- Contact-->
{{ with site.Data.homepage.contact }}
<section class="contact-section bg-black">
diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html
new file mode 100644
index 0000000..0c0765f
--- /dev/null
+++ b/layouts/partials/post_meta.html
@@ -0,0 +1,75 @@
+<!--
+The MIT License (MIT)
+
+Original work Copyright (c) 2015 Dean Attali
+Modified work Copyright (c) 2017 Michael Romero
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+-->
+
+<span class="post-meta">
+ {{ $lastmodstr := default (i18n "dateFormat") .Site.Params.dateformat | .Lastmod.Format }}
+ {{ $datestr := default (i18n "dateFormat") .Site.Params.dateformat | .Date.Format }}
+ <i class="fas fa-calendar"></i>&nbsp;{{ $datestr | i18n "postedOnDate"}}
+ {{ if ne $datestr $lastmodstr }}
+ &nbsp;{{ $lastmodstr | i18n "lastModified" }}
+ {{ end }}
+ {{ if .Site.Params.readingTime }}
+ &nbsp;|&nbsp;<i class="fas fa-clock"></i>&nbsp;{{ i18n "readingTime"}}{{ .ReadingTime }}&nbsp;{{ i18n "readTime" }}
+ {{ end }}
+ {{ if .Site.Params.wordCount }}
+ &nbsp;|&nbsp;<i class="fas fa-book"></i>&nbsp;{{ .WordCount }}&nbsp;{{ i18n "words" }}
+ {{ end }}
+ {{ if not .Site.Params.hideAuthor }}
+ {{ if .Params.author }}
+ {{ if reflect.IsSlice .Params.author }}
+ {{ range .Params.author }}
+ &nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ . | safeHTML }}
+ {{ end }}
+ {{ else }}
+ &nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Params.author | safeHTML }}
+ {{ end }}
+ {{ else }}
+ &nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Site.Author.name | safeHTML }}
+ {{ end }}
+ {{ end }}
+ {{- if .Site.Params.staticman -}}
+ &nbsp;|&nbsp;<i class="fas fa-comment"></i>&nbsp;
+ {{ $slug := replace .RelPermalink "/" "" }}
+ {{ if .Site.Data.comments }}
+ {{ $comments := index $.Site.Data.comments $slug }}
+ {{ if $comments }}
+ {{ if gt (len $comments) 1 }}
+ {{ len $comments }} {{ i18n "moreComment" }}
+ {{ else }}
+ {{ len $comments }} {{ i18n "oneComment" }}
+ {{ end }}
+ {{ else }}
+ 0 {{ i18n "oneComment" }}
+ {{ end }}
+ {{ end }}
+ {{ end }}
+ {{ if .IsTranslated -}}
+ {{- $sortedTranslations := sort .Translations "Site.Language.Weight" -}}
+ {{- $links := apply $sortedTranslations "partial" "translation_link.html" "." -}}
+ {{- $cleanLinks := apply $links "chomp" "." -}}
+ {{- $linksOutput := delimit $cleanLinks (i18n "translationsSeparator") -}}
+ &nbsp;&bull;&nbsp;{{ i18n "translationsLabel" }}{{ $linksOutput | safeHTML }}
+ {{- end }}
+</span>
diff --git a/layouts/partials/preview.html b/layouts/partials/preview.html
new file mode 100644
index 0000000..acaabaf
--- /dev/null
+++ b/layouts/partials/preview.html
@@ -0,0 +1,67 @@
+<!--
+The MIT License (MIT)
+
+Original work Copyright (c) 2015 Dean Attali
+Modified work Copyright (c) 2017 Michael Romero
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+-->
+<article class="post-preview">
+ <a href="{{ .Permalink }}">
+ <h2 class="post-title">{{ .Title }}</h2>
+ {{ if .Params.subtitle }}
+ <h3 class="post-subtitle">
+ {{ .Params.subtitle }}
+ </h3>
+ {{ end }}
+ {{ if .Params.image }}
+ <img src="{{ .Params.image }}" alt="{{ .Title }}" class="img-title" />
+ {{ end }}
+ {{ if .Params.video }}
+ <video loop autoplay muted playsinline class="img-title">
+ <source src="{{ .Params.video }}">
+ </video>
+ {{ end }}
+ </a>
+
+ <p class="post-meta">
+ {{ partial "post_meta.html" . }}
+ </p>
+ <div class="post-entry">
+ {{ if or (.Truncated) (.Params.summary) }}
+ {{ .Summary }}
+ <a href="{{ .Permalink }}" class="post-read-more">[{{ i18n "readMore" }}]</a>
+ {{ else }}
+ {{ .Content }}
+ {{ end }}
+ </div>
+
+ {{ if .Params.tags }}
+ <div class="blog-tags">
+ {{ range .Params.tags }}
+ <!-- Fix for "https://github.com/halogenica/beautifulhugo/issues/349".
+ From "https://github.com/dovidio/personalwebsite/commit/34762e94c29fd2c26c16c45f8ae2de21bdf9b46d".
+ <a href="{{ $.Site.LanguagePrefix | absURL }}/tags/{{ . | urlize }}/">{{ . }}</a>&nbsp;
+ -->
+ <a href="{{"tags" | absLangURL}}/{{ . | urlize }}/">{{ . }}</a>&nbsp;
+ {{ end }}
+ </div>
+ {{ end }}
+
+</article>