This commit is contained in:
51
themes/Eclectic/layouts/partials/post/comments.html
Normal file
51
themes/Eclectic/layouts/partials/post/comments.html
Normal file
@@ -0,0 +1,51 @@
|
||||
{{ $ID := .File.UniqueID }}
|
||||
{{ with $.Site.Params.comment }}
|
||||
<section class="comments">
|
||||
<h2>Comments</h2>
|
||||
{{ $comments := getCSV "," ( printf "https://docs.google.com/feeds/download/spreadsheets/Export?key=%s&exportFormat=csv" .sheet ) }}
|
||||
<ul>
|
||||
{{ $hasComment := false }}
|
||||
{{ range $r := $comments }}
|
||||
{{ if eq (index $r 3) $ID}}
|
||||
{{ $hasComment := true }}
|
||||
<li class="comment">
|
||||
{{ $time := index $r 0}}
|
||||
<img intrinsicsize="100x100" width="100px" height="100px" src="https://www.gravatar.com/avatar/{{ md5 (index $r 1) }}?s=100&d=identicon" alt="{{ index $r 2 }}">
|
||||
<span class="commenter-name">{{ index $r 2 }}</span>
|
||||
{{ $icon := resources.Get "image/line-awesome/fa-calendar.svg" | resources.Minify }}
|
||||
{{ replace $icon.Content "<svg " "<svg width=\"30px\" " | safeHTML }}
|
||||
<time datetime="{{$time}}">{{(time $time).Format "Monday, Jan 2, 2006."}}</time>
|
||||
<div class="commenter-comment">{{ index $r 4 | emojify }}</div>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if ne $hasComment true }}
|
||||
<li>
|
||||
No comments yet. Be the first to post.
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<h3>Post a new comment</h3>
|
||||
<p>We get avatars from
|
||||
<a target="_blank" rel="noopener" href="https://www.gravatar.com">Gravatar</a>. You can use emojis as per the <a target="_blank" href="https://www.webfx.com/tools/emoji-cheat-sheet/" rel="noopener">Emoji cheat sheet.</a></p>
|
||||
<form action="https://docs.google.com/forms/d/e/{{.form}}/formResponse">
|
||||
{{- with .name -}}
|
||||
<label for="comment-name" class="sr-only">Name</label>
|
||||
<input id="comment-name" class="comment-name" required type="name" autocomplete="given-name" placeholder="Name" name="{{.}}">
|
||||
{{- end -}}
|
||||
{{- with .email -}}
|
||||
<label for="comment-email" class="sr-only">Email</label>
|
||||
<input id="comment-email" class="comment-email" required type="email" autocomplete="email" placeholder="Email address"
|
||||
name={{.}}>
|
||||
{{- end -}}
|
||||
{{- with .post -}}
|
||||
<input class="comment-id" name="{{.}}" type="hidden" value="{{$ID}}">
|
||||
{{- end -}}
|
||||
{{- with .comment -}}
|
||||
<label for="comment" class="sr-only">Comment</label>
|
||||
<textarea id="comment" rows="10" class="comment-text" name="{{.}}" placeholder="Your comment" required></textarea>
|
||||
{{- end -}}
|
||||
<button type="submit">Post Comment</button>
|
||||
</form>
|
||||
</section>
|
||||
{{- end -}}
|
63
themes/Eclectic/layouts/partials/post/info.html
Normal file
63
themes/Eclectic/layouts/partials/post/info.html
Normal file
@@ -0,0 +1,63 @@
|
||||
<section class="info">
|
||||
<h2>Info</h2>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p>{{.Description}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="published" title="Published">
|
||||
{{- partialCached "util/icon" (dict "key" "calendar" "size" 20) "calendar-20" -}}
|
||||
<span>Published</span>
|
||||
</th>
|
||||
<td>
|
||||
{{- $date := .PublishDate -}}
|
||||
{{- if not $date -}}
|
||||
{{- $date = .Lastmod -}}
|
||||
{{- end -}}
|
||||
<time datetime="{{ $date.Format " 2006-01-02T15:04:05Z07:00 " }}">{{ $date.Format "Monday, Jan 2, 2006."}}</time>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="wordCount" title="Word Count">
|
||||
{{- partialCached "util/icon" (dict "key" "bullseye" "size" 20) "bullseye-20" -}}
|
||||
<span>Word Count</span>
|
||||
</th>
|
||||
<td>
|
||||
{{ .WordCount }} words
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="readingTime" title="Reading Time">
|
||||
{{- partialCached "util/icon" (dict "key" "hourglass-1" "size" 20) "hourglass-1-20" -}}
|
||||
<span>Reading Time</span>
|
||||
</th>
|
||||
<td>
|
||||
{{ .ReadingTime }} minutes
|
||||
</td>
|
||||
</tr>
|
||||
{{with .Params.categories}}
|
||||
<tr>
|
||||
<th title="Category">
|
||||
{{- partialCached "util/icon" (dict "key" "caret-square-o-right" "size" 20) "caret-square-o-right-20" -}}
|
||||
<span>Category</span></th>
|
||||
<td>{{ range . }}
|
||||
<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}">{{ . | humanize }}</a>
|
||||
{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
<tr>
|
||||
<td class="tags" title="Tags" colspan="2">
|
||||
{{- partialCached "util/icon" (dict "key" "tags" "size" 20) "tags-20" -}}
|
||||
<span>Tags<br></span>
|
||||
{{- range .Params.tags -}}
|
||||
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . | humanize }} </a>
|
||||
{{- end -}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
6
themes/Eclectic/layouts/partials/post/newsletter.html
Normal file
6
themes/Eclectic/layouts/partials/post/newsletter.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{{- with .Site.Params.newsletter -}}
|
||||
<section class="sidebar">
|
||||
<h2>Join the Newsletter</h2>
|
||||
{{- partialCached "util/newsletter" . -}}
|
||||
</section>
|
||||
{{- end -}}
|
13
themes/Eclectic/layouts/partials/post/sidebar.html
Normal file
13
themes/Eclectic/layouts/partials/post/sidebar.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<aside>
|
||||
{{- partial "post/info" . -}}
|
||||
{{range .Params.sidebar}}
|
||||
<section class="sidebar">
|
||||
{{with .title}}<h2>{{ . | humanize }}</h2>{{end}}
|
||||
{{with .content}}<p>{{ . | markdownify }}</p>{{end}}
|
||||
</section>
|
||||
{{ end }}
|
||||
{{- partialCached "post/tag-cloud" . -}}
|
||||
{{- partialCached "post/site-sidebar" . -}}
|
||||
{{- partialCached "post/newsletter" . -}}
|
||||
{{- partial "post/social" . -}}
|
||||
</aside>
|
68
themes/Eclectic/layouts/partials/post/similar.html
Normal file
68
themes/Eclectic/layouts/partials/post/similar.html
Normal file
@@ -0,0 +1,68 @@
|
||||
{{- $currentPage := . -}}
|
||||
{{- if .Params.series -}}
|
||||
{{- $seriesName := index .Params.series 0 -}}
|
||||
{{- $current := 1 -}}
|
||||
{{- $total := 0 -}}
|
||||
{{- $scratch := newScratch -}}
|
||||
{{- range .Site.RegularPages.ByDate -}}
|
||||
{{- if in .Params.series $seriesName -}}
|
||||
{{- $total = add $total 1 -}}
|
||||
{{- if gt $.Date.Unix .Date.Unix -}}
|
||||
{{ $scratch.Add "before" (slice .) }}
|
||||
{{- $current = add $current 1 -}}
|
||||
{{- else if ne . $currentPage -}}
|
||||
{{ $scratch.Add "after" (slice .) }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{$before := $scratch.Get "before" | default slice}}
|
||||
{{$after := $scratch.Get "after" | default slice}}
|
||||
{{/*
|
||||
* If we have none from before show three after
|
||||
* If we do not have something after show three from before.
|
||||
* If we have one after show two from before and one from after.
|
||||
* Otherwise show one from before and two from after
|
||||
*/}}
|
||||
{{- if eq (len $before) 0 -}}
|
||||
{{ .Scratch.Set "Related" ($after | first 3) }}
|
||||
{{- else if eq (len $after) 0 -}}
|
||||
{{ .Scratch.Set "Related" ($before | last 3) }}
|
||||
{{- else if eq (len $after) 1 -}}
|
||||
{{ .Scratch.Set "Related" ($before | last 2) }}
|
||||
{{ .Scratch.Add "Related" $after }}
|
||||
{{- else -}}
|
||||
{{ .Scratch.Set "Related" ($before | last 1) }}
|
||||
{{ .Scratch.Add "Related" ($after | first 2) }}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{ .Scratch.Set "Related" (.Site.RegularPages.Related . | first 3) }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- $related := .Scratch.Get "Related" -}}
|
||||
{{- .Scratch.Delete "Related" -}}
|
||||
{{- with $related -}}
|
||||
<section class="more">
|
||||
{{- if $currentPage.Params.series -}}
|
||||
{{- $seriesName := index $currentPage.Params.series 0 -}}
|
||||
<h2>More in {{$seriesName}}</h2>
|
||||
{{- else -}}
|
||||
<h2>You may also enjoy</h2>
|
||||
{{- end -}}
|
||||
<ul class="items-{{len $related}}">
|
||||
{{- range . -}}
|
||||
<li>
|
||||
<a href="{{.RelPermalink}}">
|
||||
{{- partial "util/cover.html" (dict "class" "img-container" "page" . "width" 400 "height" 300) -}}
|
||||
</a>
|
||||
<a class="description" href="{{ .RelPermalink }}">{{ .Title }}<br>
|
||||
<small>
|
||||
{{- partialCached "util/icon" (dict "key" "hourglass-1" "size" 16) "hourglass-1-16" -}}
|
||||
{{.ReadingTime}} minutes
|
||||
</small>
|
||||
</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
||||
{{- end -}}
|
6
themes/Eclectic/layouts/partials/post/site-sidebar.html
Normal file
6
themes/Eclectic/layouts/partials/post/site-sidebar.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{{range $.Site.Params.sidebar}}
|
||||
<section class="sidebar">
|
||||
{{with .title}}<h2>{{ . | humanize }}</h2>{{end}}
|
||||
{{with .content}}<p>{{ . | markdownify }}</p>{{end}}
|
||||
</section>
|
||||
{{ end }}
|
22
themes/Eclectic/layouts/partials/post/social.html
Normal file
22
themes/Eclectic/layouts/partials/post/social.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{/* Social Links https://www.mrcooper.com/blog/2018/05/14/5-outdoor-space-ideas-youll-love/ */}}
|
||||
<section class="sidebar">
|
||||
<h2>Share this Post</h2>
|
||||
<a target="_blank" href="https://www.facebook.com/sharer.php?u={{ .Permalink }}" rel="noopener">
|
||||
{{ $icon := resources.Get "image/line-awesome/fa-facebook.svg" | resources.Minify }}
|
||||
{{ replace $icon.Content "<svg " "<svg width=\"30px\" " | safeHTML }}
|
||||
</a>
|
||||
<a target="_blank" href="https://twitter.com/intent/tweet?url={{ .Permalink }}" rel="noopener">
|
||||
{{ $icon := resources.Get "image/line-awesome/fa-twitter.svg" | resources.Minify }}
|
||||
{{ replace $icon.Content "<svg " "<svg width=\"30px\" " | safeHTML }}
|
||||
</a>
|
||||
<a target="_blank" href="https://www.linkedin.com/shareArticle?url={{ .Permalink }}" rel="noopener">
|
||||
{{ $icon := resources.Get "image/line-awesome/fa-linkedin.svg" | resources.Minify }}
|
||||
{{ replace $icon.Content "<svg " "<svg width=\"30px\" " | safeHTML }}
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://pinterest.com/pin/create/bookmarklet/?url={{ .Permalink }}"
|
||||
rel="noopener">
|
||||
{{ $icon := resources.Get "image/line-awesome/fa-pinterest.svg" | resources.Minify }}
|
||||
{{ replace $icon.Content "<svg " "<svg width=\"30px\" " | safeHTML }}
|
||||
</a>
|
||||
</section>
|
21
themes/Eclectic/layouts/partials/post/tag-cloud.html
Normal file
21
themes/Eclectic/layouts/partials/post/tag-cloud.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<section class="sidebar tag-cloud">
|
||||
{{/* https://www.sidorenko.io/post/2017/07/nice-tagcloud-with-hugo/ */}}
|
||||
<h2>Tag Cloud
|
||||
<small class="info">
|
||||
<a href="{{ "/tags/" | relLangURL }}">See full list</a>
|
||||
</small>
|
||||
</h2>
|
||||
{{ if not (eq (len $.Site.Taxonomies.tags) 0) }}
|
||||
{{ $fontUnit := "rem" }}
|
||||
{{ $largestFontSize := 2.0 }}
|
||||
{{ $smallestFontSize := 1.0 }}
|
||||
{{ $max := len (index $.Site.Taxonomies.tags.ByCount 0).Pages }}
|
||||
{{ $min := len (index $.Site.Taxonomies.tags.ByCount.Reverse 0).Pages }}
|
||||
{{ range $name, $taxonomy := $.Site.Taxonomies.tags }}
|
||||
{{ $count := len $taxonomy.Pages }}
|
||||
{{ $weight := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }} {{ $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weight) ) }}
|
||||
<a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}" style="font-size:{{$currentFontSize}}{{$fontUnit}}">{{ $name }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
</section>
|
4
themes/Eclectic/layouts/partials/post/youtube.html
Normal file
4
themes/Eclectic/layouts/partials/post/youtube.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="yt">
|
||||
<iframe title="{{.title}} | {{$.Site.Author.name}} | Youtube" src="https://www.youtube-nocookie.com/embed/{{ .id }}?showinfo=0&modestbranding=1&iv_load_policy=3&rel=0"
|
||||
allowfullscreen></iframe>
|
||||
</div>
|
Reference in New Issue
Block a user