diff options
author | uPagge <git@upagge.ru> | 2021-05-14 18:02:54 +0300 |
---|---|---|
committer | uPagge <git@upagge.ru> | 2021-05-14 18:02:54 +0300 |
commit | 75157d53b1c708b4953acc548ee509dda7e17b97 (patch) | |
tree | adc382e941b0db7fe285404805d282653c7cc8c5 /layouts | |
parent | a34e5c2763b54e95ab283aa1729bbe7b1a90bcc0 (diff) |
new block user and see-also
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/block/author.html | 17 | ||||
-rw-r--r-- | layouts/partials/block/see-also.html | 15 | ||||
-rw-r--r-- | layouts/partials/single/footer.html | 25 | ||||
-rw-r--r-- | layouts/posts/single.html | 9 | ||||
-rw-r--r-- | layouts/shortcodes/see-also.html | 4 |
5 files changed, 49 insertions, 21 deletions
diff --git a/layouts/partials/block/author.html b/layouts/partials/block/author.html new file mode 100644 index 0000000..2dd7d10 --- /dev/null +++ b/layouts/partials/block/author.html @@ -0,0 +1,17 @@ +{{ $authorName := . }} +{{ $author := "" }} +{{- $authorPath := print "data/authors/" $authorName ".json" -}} +{{ if (fileExists $authorPath) -}} +{{ $author = index site.Data.authors $authorName }} +{{ end }} +{{- if ne $authorName " " -}} +{{- with $author -}} +<div class="block-author"> + <div class="author-avatar"><a href="{{ with .link }} {{- . | safeHTML -}}{{ end }}" target="_blank"><img alt="{{ .about }}" src="{{ with .avatar }} {{- . | safeHTML -}}{{ end }}"></a></div> + <div class="author-info"> + <div class="name"><a href="{{ with .link }} {{- . | safeHTML -}}{{ end }}" target="_blank">{{ .full_name }}</a></div> + <div class="number-posts">{{ .about }}</span></div> + </div> +</div> +{{- end -}} +{{- end -}}
\ No newline at end of file diff --git a/layouts/partials/block/see-also.html b/layouts/partials/block/see-also.html new file mode 100644 index 0000000..2c7f716 --- /dev/null +++ b/layouts/partials/block/see-also.html @@ -0,0 +1,15 @@ +{{ $posts := where site.RegularPages "Section" "blog"}} +{{ $related := site.RegularPages.RelatedIndices . "tags" | first 3 }} +{{ if eq (len $related) 0 }} +{{ $related = $posts.ByDate | first 3 }} +{{ end }} +{{ with $related }} +<aside class="see-also" style="margin:0"> + <span class="see-title">{{ T `seeAlso` }}</span> + <ul> + {{ range . }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} + </ul> + {{ end }} +</aside>
\ No newline at end of file diff --git a/layouts/partials/single/footer.html b/layouts/partials/single/footer.html index e54f1aa..0635830 100644 --- a/layouts/partials/single/footer.html +++ b/layouts/partials/single/footer.html @@ -12,25 +12,16 @@ {{- partial "plugin/share.html" . -}} </div> +{{ $authorFooter := and (eq ($params.Page.hiddenAuthor | default .Site.Params.Page.hiddenAuthor | default false) false) (eq ($params.Page.authorFooter | default .Site.Params.Page.authorFooter | default true) true)}} +{{ if $authorFooter }} {{- $authorName := $params.author | default .Site.Author.name | default " " -}} -{{ $author := "" }} -{{- $authorPath := print "data/authors/" $authorName ".json" -}} -{{ if (fileExists $authorPath) -}} -{{ $author = index .Site.Data.authors $authorName }} +{{- partial "block/author.html" $authorName -}} +{{ end }} + +{{ $seeAlsoFooter := ($params.Page.seeAlsoFooter | default .Site.Params.Page.seeAlsoFooter | default false) }} +{{ if and (eq $authorFooter false) $seeAlsoFooter }} +{{- partial "block/see-also.html" . -}} {{ end }} -{{ if eq ($params.authorHidden | default false) false }} -{{- if ne $authorName " " -}} -{{- with $author -}} -<div class="footer-post-author"> - <div class="author-avatar"><a href="{{ with .link }} {{- . | safeHTML -}}{{ end }}" target="_blank"><img alt="{{ .about }}" src="{{ with .avatar }} {{- . | safeHTML -}}{{ end }}"></a></div> - <div class="author-info"> - <div class="name"><a href="{{ with .link }} {{- . | safeHTML -}}{{ end }}" target="_blank">{{ .full_name }}</a></div> - <div class="number-posts">{{ .about }}</span></div> - </div> -</div> -{{- end -}} -{{- end -}} -{{- end -}} {{- with .Params.tags -}} <div class="post-tags"> diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 8abe5d4..e6470ed 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -236,6 +236,11 @@ {{- end -}} {{- end -}} + {{ if and (eq ($params.Page.hiddenAuthor | default .Site.Params.Page.hiddenAuthor | default false) false) (eq ($params.Page.authorFooter | default .Site.Params.Page.authorFooter | default true) false) (ne $pageTheme "hero") }} + {{- $authorName := $params.author | default .Site.Author.name | default " " -}} + {{- partial "block/author.html" $authorName -}} + {{ end }} + {{- /* Static TOC */ -}} {{- if ne $toc.enable false -}} <div class="details toc" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ end }}"> @@ -271,7 +276,7 @@ </div> - {{- if not $params.hiddenFooter -}} + {{- if not $params.Page.hiddenFooter -}} <footer> <div class="post"> {{- /* Footer Post */ -}} @@ -288,7 +293,7 @@ </article> {{ end }} - {{- if not $params.hiddenUnderPost -}} + {{- if not $params.Page.hiddenUnderPost -}} {{- partial "under-post.html" . -}} {{- end -}} diff --git a/layouts/shortcodes/see-also.html b/layouts/shortcodes/see-also.html index eca58d1..13406b3 100644 --- a/layouts/shortcodes/see-also.html +++ b/layouts/shortcodes/see-also.html @@ -4,7 +4,7 @@ {{ $related = $posts.ByDate | first 3 }} {{ end }} {{ with $related }} -<div class="see-also"> +<aside class="see-also"> <span class="see-title">{{ T `seeAlso` }}</span> <ul> {{ range . }} @@ -12,4 +12,4 @@ {{ end }} </ul> {{ end }} -</div>
\ No newline at end of file +</aside>
\ No newline at end of file |