This commit is contained in:
5
themes/Eclectic/layouts/partials/util/background.html
Normal file
5
themes/Eclectic/layouts/partials/util/background.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{{- $cover := partial "util/backgroundImage.html" . -}}
|
||||
{{/* https://unsplash.com/photos/-WW8jBak7bo https://pxhere.com/en/photo/912411 */}}
|
||||
{{/* Original: https://www.pexels.com/photo/computer-cup-desk-drink-434337/ */}}
|
||||
<img class="background" intrinsicsize="1400x787" width="0" height="0" alt="Page Background" role="presentation" src="{{$cover.RelPermalink}}" />
|
||||
<div class="background" role="presentation"></div>
|
@@ -0,0 +1,7 @@
|
||||
{{ $cover := (resources.Get "image/background.jpg").Fill "1400x787" }}
|
||||
{{- if (fileExists "assets/image/background.svg") -}}
|
||||
{{ $cover = (resources.Get "image/background.svg") }}
|
||||
{{- else if (fileExists "assets/image/background.png") -}}
|
||||
{{ $cover = (resources.Get "image/background.png").Fill "1400x787" }}
|
||||
{{- end -}}
|
||||
{{- return $cover -}}
|
@@ -0,0 +1,7 @@
|
||||
{{ $cover := (resources.Get "image/background-dark.jpg").Fill "1400x787" }}
|
||||
{{- if (fileExists "assets/image/background-dark.svg") -}}
|
||||
{{ $cover = (resources.Get "image/background-dark.svg") }}
|
||||
{{- else if (fileExists "assets/image/background-dark.png") -}}
|
||||
{{ $cover = (resources.Get "image/background-dark.png").Fill "1400x787" }}
|
||||
{{- end -}}
|
||||
{{- return $cover -}}
|
13
themes/Eclectic/layouts/partials/util/cover.html
Normal file
13
themes/Eclectic/layouts/partials/util/cover.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{{- with $.page.Resources.GetMatch "cover.*" -}}
|
||||
<div class="{{$.class}}">
|
||||
{{ $cover := . }}
|
||||
{{ $params := print $.width "x" $.height }}
|
||||
{{ if $.page.Params.coverAnchor }}
|
||||
{{ $params = print $params " " $.page.Params.coverAnchor }}
|
||||
{{ else }}
|
||||
{{ $params = print $params " Center" }}
|
||||
{{end}}
|
||||
{{ $cover = .Fill $params }}
|
||||
<img intrinsicsize="{{print $.width "x" $.height}}" width="{{$.width}}" height="{{$.height}}" alt="{{$.page.Title}}" role="banner" class="banner" src="{{$cover.RelPermalink}}" />
|
||||
</div>
|
||||
{{- end -}}
|
4
themes/Eclectic/layouts/partials/util/custom-icon.html
Normal file
4
themes/Eclectic/layouts/partials/util/custom-icon.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{{ $icon := resources.Get $.path | resources.Minify }}
|
||||
{{ $result := print "<svg class=\"" $.class "\" width=\"" $.size "px\" " }}
|
||||
{{ $icon = replace $icon.Content "<svg " $result }}
|
||||
{{ $icon | safeHTML }}
|
@@ -0,0 +1,2 @@
|
||||
{{/* Adds links to the heading via an anchor tag */}}
|
||||
{{ . | replaceRE "(<h[1-9] id=\"([^\"]+)\".+)(</h[1-9]+>)" "${1} <a class=\"heading-anchor\" href=\"#${2}-anchor\" id=\"${2}-anchor\">#</a> ${3}" | safeHTML }}
|
11
themes/Eclectic/layouts/partials/util/icon.html
Normal file
11
themes/Eclectic/layouts/partials/util/icon.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- if eq (len (findRE "\\.svg$" $.key 1)) 1 -}}
|
||||
{{- partial "util/custom-icon" (dict "path" $.key "size" $.size "class" $.class) -}}
|
||||
{{- else -}}
|
||||
{{- if eq (len (findRE "\\.(png|jpg)$" $.key 1)) 1 -}}
|
||||
{{- $icon := resources.Get $.key }}
|
||||
{{ $image := $icon.Resize (print $.size "x") }}
|
||||
<img src="{{$image.RelPermalink}}" class="{{$.class}}" width="{{$.size}}" alt="{{$.alt}}">
|
||||
{{- else -}}
|
||||
{{partial "util/native-icon" (dict "type" $.key "size" $.size "class" $.class)}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
5
themes/Eclectic/layouts/partials/util/image.html
Normal file
5
themes/Eclectic/layouts/partials/util/image.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{{- $op := .Page.Resources.GetMatch .image -}}
|
||||
{{- if not (.Page.Resources.GetMatch .image) -}}
|
||||
{{- $op = resources.Get .image -}}
|
||||
{{- end -}}
|
||||
{{- return $op -}}
|
7
themes/Eclectic/layouts/partials/util/native-icon.html
Normal file
7
themes/Eclectic/layouts/partials/util/native-icon.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{- $icon := resources.Get (print "image/line-awesome/fa-" $.type ".svg") | resources.Minify -}}
|
||||
{{- $class := "icon" -}}
|
||||
{{- with $.class}}{{$class = .}}{{end -}}
|
||||
{{- $result := print "<svg width=\"" $.size "px\" class=\"" $class "\" " -}}
|
||||
{{- $icon = replace $icon.Content "<svg " $result -}}
|
||||
{{- $icon = replace $icon "<path " "<path fill=\"currentColor\" " }}
|
||||
{{ $icon | safeHTML }}
|
10
themes/Eclectic/layouts/partials/util/newsletter.html
Normal file
10
themes/Eclectic/layouts/partials/util/newsletter.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="newsletter">
|
||||
<form action="{{.action}}" method="post" target="_blank">
|
||||
<label for="newsletter-pot" class="honeypot">Details </label>
|
||||
<input id="newsletter-pot" class="honeypot" type="text" name="{{.honeypot}}" tabindex="-1">
|
||||
<label for="mce-EMAIL" class="sr-only">Email Address </label>
|
||||
<input required class="email" type="email" name="{{.email}}" placeholder="Email Address" id="mce-EMAIL"><button
|
||||
title="Subscribe" type="submit"
|
||||
name="subscribe">{{- partialCached "util/icon" (dict "key" "user-plus" "size" 20) "user-plus-20" -}}</button>
|
||||
</form>
|
||||
</div>
|
32
themes/Eclectic/layouts/partials/util/post.html
Normal file
32
themes/Eclectic/layouts/partials/util/post.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<li class="blog-post item">
|
||||
<a href="{{.RelPermalink}}">
|
||||
{{- partial "util/cover.html" (dict "class" "banner-holder" "page" . "width" 440 "height" 330) -}}
|
||||
{{- with .Title -}}
|
||||
<h3>{{.}}</h3>
|
||||
{{- else -}}
|
||||
{{if eq .Kind "section" }}
|
||||
<h3>{{path.Dir .File.Path | path.Base | humanize}}</h3>
|
||||
{{ else}}
|
||||
<h3>{{.File.ContentBaseName | humanize}}</h3>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
{{- with .Description -}}
|
||||
<p>{{. | markdownify}}</p>
|
||||
{{- else -}}
|
||||
<p>{{.Summary | markdownify}}</p>
|
||||
{{- end -}}
|
||||
<hr/>
|
||||
<div class="blog-post-footer">
|
||||
<a href="{{.RelPermalink}}">Read More</a>
|
||||
<span class="categories">
|
||||
{{with .Params.categories}}
|
||||
{{ $icon := resources.Get "image/line-awesome/fa-caret-square-o-right.svg" | resources.Minify }}
|
||||
{{ replace $icon.Content "<svg " " <svg width=\"20px\"" | safeHTML }}
|
||||
{{ range . }}
|
||||
<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}">{{ . | humanize }}</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
Reference in New Issue
Block a user