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

github.com/onweru/compose.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweru <fromweru@gmail.com>2022-06-13 18:27:30 +0300
committerweru <fromweru@gmail.com>2022-06-13 18:27:30 +0300
commit804f0119e0b0d416578572a06fca13c3ee67a711 (patch)
tree9c228dbf40bc5cf88196f44ac8e82c56fe485ed3
parent45ae8307f144d7227579fb78cf17ca8ec761a1b2 (diff)
add blog templates #24
Signed-off-by: weru <fromweru@gmail.com>
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/blog/list.html41
-rw-r--r--layouts/blog/single.html34
-rw-r--r--layouts/partials/share.html7
4 files changed, 86 insertions, 0 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 7a01207..7446454 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -7,6 +7,9 @@
<header class="nav_header">
{{- partial "nav" . }}
</header>
+ {{ if or (eq .Section site.Params.blogDir) (eq .Type "search" ) }}
+ {{- block "main" . }}{{ end }}
+ {{ else }}
<div class="main wrap pt-4">
{{ $docSections := site.Params.docSections }}
{{- with $docSections }}{{- else }}
@@ -28,6 +31,7 @@
</div>
{{- end -}}
</div>
+ {{ end }}
{{- partialCached "footer" . -}}
{{- partialCached "sprites" . -}}
{{- partialCached "scripts/bundle" . -}}
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
new file mode 100644
index 0000000..ae37779
--- /dev/null
+++ b/layouts/blog/list.html
@@ -0,0 +1,41 @@
+{{ define "main" }}
+{{- $pages := where site.RegularPages "Section" site.Params.blogDir }}
+<div class = 'wrap pt-2 mt-2'>
+ {{- $paginator := .Paginate $pages -}}
+ {{- $size := $paginator.PageSize }}
+ {{- $scratch := newScratch }}
+ {{- range $index, $value := $paginator.Pages }}
+ {{ if isset .Params "image" }}
+ {{ $scratch.Set "image" .Params.image }}
+ {{ else }}
+ {{ $scratch.Set "image" "thumbnail.svg" }}
+ {{ end }}
+ {{ $image := $scratch.Get "image" }}
+ {{ $bg := (absURL (printf "images/%s" $image)) }}
+ {{- if in $image "https://" }}
+ {{- $bg = $image }}
+ {{- end }}
+ <article class = 'article mb-2'>
+ <a href = '{{ $value.Permalink }}' {{ if eq $index 0 }} class = 'grid-reverse' {{ end }}>
+ <div class = 'article_thumb' style='background-image: url({{ $bg }})'></div>
+ <div class = 'article_meta {{ if eq $index 0 }} center_y {{ end }}'>
+ <time class = 'post_date'>{{ dateFormat "January 02, 2006" $value.Date }}</time>
+ <h3 class = 'article_title'>{{ $value.Title }}</h3>
+ <div class = 'article_excerpt {{ if eq $index 0 }} visible {{ end }}'>
+ <p>{{ $value.Summary | truncate 100 }}</p>
+ </div>
+ </div>
+ </a>
+ </article>
+ {{- if and (eq $index 0) (gt $size 1) }}<div class = 'grid-2 article_showcase'>{{ end }}
+ {{- if and (eq $index (add $size -1)) (gt $size 1) }}</div>{{ end }}
+ {{- end }}
+</div>
+<!-- <a href = '{{ absURL (printf "post/%s" "") }}' class = 'post_nav'>
+ <span class = 'post_next'>View Archive
+ <svg class="icon icon_scale">
+ <use xlink:href="#double-arrow"></use>
+ </svg>
+ </span>
+</a> -->
+{{ end }}
diff --git a/layouts/blog/single.html b/layouts/blog/single.html
new file mode 100644
index 0000000..55df0ae
--- /dev/null
+++ b/layouts/blog/single.html
@@ -0,0 +1,34 @@
+{{ define "main" }}
+ <div class="wrap mt post">
+ <div>
+ {{- $date := (dateFormat "02. January 2006" .Date) -}}
+ <p class="post_date">{{ $date }}</p>
+ <h1 class="post_title">{{ .Title }}</h1>
+ <div class="post_body">
+ <div class="post_inner">
+ {{ with .Params.image }}
+ {{- $image := absURL (printf "images/%s" .) }}
+ {{ if in . "https://" }}
+ {{- $image = . }}
+ {{ end }}
+ <img src="{{ $image }}" alt="{{ . }}" class="post_thumbnail">
+ {{ end }}
+ {{ .Content }}
+ </div>
+ <div class="post_extra mb-2">
+ {{ partialCached "share" . }}
+ </div>
+ <div>
+ {{ template "_internal/disqus.html" . }}
+ </div>
+ </div>
+ </div>
+ <!-- <a href="{{ $.Site.BaseURL }}" class="post_nav">
+ <span class="post_next">The Latest
+ <svg class="icon icon_scale">
+ <use xlink:href="#double-arrow"></use>
+ </svg>
+ </span>
+ </a> -->
+ </div>
+{{ end }}
diff --git a/layouts/partials/share.html b/layouts/partials/share.html
new file mode 100644
index 0000000..dbdf60f
--- /dev/null
+++ b/layouts/partials/share.html
@@ -0,0 +1,7 @@
+{{- $s := T "share_story" }}
+{{- $lc := T "link_copied" }}
+<div class="copy" data-before="{{ $s }}" data-after="{{ $lc }}">
+ <svg class="icon">
+ <use xlink:href="#copy"></use>
+ </svg>
+</div> \ No newline at end of file