mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 02:46:16 +01:00
feat(partial): add hook and image partial
This commit is contained in:
parent
b91ca3d61a
commit
8aba226290
12 changed files with 52 additions and 92 deletions
|
@ -36,6 +36,7 @@
|
|||
.home-description {
|
||||
font-size: 1rem;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
padding: .4rem;
|
||||
}
|
||||
|
||||
|
@ -43,7 +44,12 @@
|
|||
padding-top: .6rem;
|
||||
|
||||
i {
|
||||
font-size: 1.4rem;
|
||||
font-size: 1.45rem;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
<figure>
|
||||
<img
|
||||
{{ $res := resources.Get "svg/loading.svg" | minify -}}
|
||||
src="{{ $res.RelPermalink }}"
|
||||
data-sizes="auto"
|
||||
data-src="{{ .Destination | safeURL }}"
|
||||
alt="{{ .Text }}"
|
||||
{{ with .Title -}}
|
||||
title="{{ . }}"
|
||||
{{ end -}}
|
||||
class="lazyload"
|
||||
>
|
||||
{{- $loading := resources.Get "svg/loading.svg" | minify -}}
|
||||
<img src="{{ $loading.RelPermalink }}" data-sizes="auto" data-src="{{ .Destination | safeURL }}" alt="{{ .Text }}"{{ with .Title }} title="{{ . }}"{{ end }} class="lazyload">
|
||||
<figcaption class="image-caption">
|
||||
{{- if .Title -}}
|
||||
{{- .Title -}}
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
<a href="{{ .Destination | safeURL }}"
|
||||
{{ with .Title -}}
|
||||
title="{{ . }}"
|
||||
{{ end -}}
|
||||
{{ if strings.HasPrefix .Destination "http" -}}
|
||||
target="_blank"
|
||||
{{ end -}}
|
||||
>
|
||||
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>
|
||||
{{- .Text | safeHTML -}}
|
||||
</a>
|
|
@ -6,33 +6,7 @@
|
|||
{{- .Title -}}
|
||||
</h1>
|
||||
<div class="post-content">
|
||||
{{- $content := .Content -}}
|
||||
|
||||
{{- $REin := `:\(([\w- ]+?)\):` -}}
|
||||
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
|
||||
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<sup>\[return\]</sup>` -}}
|
||||
{{- $REout = `↩︎` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<(h[23456]) (id=".+?")>` -}}
|
||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<(.+) (id="fnref:.+?")>` -}}
|
||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
|
||||
{{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $content | safeHTML -}}
|
||||
{{- partial "hook/content.html" .Content | safeHTML -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
<!--featured_image-->
|
||||
{{- with .Params.featured_image -}}
|
||||
{{- $image := $.Params.featured_image_preview | default . -}}
|
||||
<div class="post-featured-image-preview">
|
||||
{{- $res := resources.Get "svg/loading.svg" | minify -}}
|
||||
<img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ $image }}" alt="featured image" class="lazyload">
|
||||
{{- $image := $.Params.featured_image_preview | default . -}}
|
||||
{{- partial "image" $image -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
<!-- end featured_image-->
|
||||
|
||||
<h1 class="post-title post-list-title" itemprop="name headline">
|
||||
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
</h1>
|
||||
|
@ -40,17 +40,7 @@
|
|||
{{- .Params.description -}}
|
||||
</p>
|
||||
{{- else -}}
|
||||
{{- $summary := .Summary -}}
|
||||
|
||||
{{- $REin := `:\(([\w- ]+?)\):` -}}
|
||||
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
|
||||
{{- $summary = replaceRE $REin $REout $summary -}}
|
||||
|
||||
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
|
||||
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
||||
{{- $summary = replaceRE $REin $REout $summary -}}
|
||||
|
||||
{{- $summary | safeHTML -}}
|
||||
{{- partial "hook/content.html" .Summary | safeHTML -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
<div class="post-footer">
|
||||
|
|
|
@ -282,4 +282,7 @@
|
|||
<a href="mailto:{{ . }}" rel="me noopener noreffer">
|
||||
<i class="far fa-envelope fa-fw" target="_blank" title="Email"></i>
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.Social.Custom}}
|
||||
{{- . | safeHTML -}}
|
||||
{{- end -}}
|
24
layouts/partials/hook/content.html
Normal file
24
layouts/partials/hook/content.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
{{- $REin := `:\(([\w- ]+?)\):` -}}
|
||||
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
|
||||
{{- $content := replaceRE $REin $REout . -}}
|
||||
|
||||
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
|
||||
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<sup>\[return\]</sup>` -}}
|
||||
{{- $REout = `↩︎` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<(h[23456]) (id=".+?")>` -}}
|
||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<(.+) (id="fnref:.+?")>` -}}
|
||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
|
||||
{{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
|
||||
|
||||
{{- return replaceRE $REin $REout $content -}}
|
2
layouts/partials/image.html
Normal file
2
layouts/partials/image.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{- $res := resources.Get "svg/loading.svg" | minify -}}
|
||||
<img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ . }}" alt="featured image" class="lazyload">
|
|
@ -39,8 +39,7 @@
|
|||
|
||||
{{- with .Params.featured_image -}}
|
||||
<div class="post-featured-image">
|
||||
{{- $res := resources.Get "svg/loading.svg" | minify -}}
|
||||
<img src="{{ $res.RelPermalink }}" data-sizes="auto" data-src="{{ . }}" alt="featured image" class="lazyload">
|
||||
{{- partial "image" . -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
|
@ -70,33 +69,7 @@
|
|||
{{- end -}}
|
||||
|
||||
<div class="post-content">
|
||||
{{- $content := .Content -}}
|
||||
|
||||
{{- $REin := `:\(([\w- ]+?)\):` -}}
|
||||
{{- $REout := `<i class="$1 fa-fw"></i>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `\[(.+?)\]\^\((.+?)\)` -}}
|
||||
{{- $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<sup>\[return\]</sup>` -}}
|
||||
{{- $REout = `↩︎` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<(h[23456]) (id=".+?")>` -}}
|
||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<(.+?) (id="fnref:.+?")>` -}}
|
||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $REin = `<li (id="fn:.+?")(.*?)>\s?<p>` -}}
|
||||
{{- $REout = `<li $2><p><a class="post-dummy-target" $1></a>` -}}
|
||||
{{- $content = replaceRE $REin $REout $content -}}
|
||||
|
||||
{{- $content | safeHTML -}}
|
||||
{{- partial "hook/content.html" .Content | safeHTML -}}
|
||||
</div>
|
||||
|
||||
{{- partial "post/footer.html" . -}}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
{"Target":"css/style.min.css","MediaType":"text/css","Data":{}}
|
Loading…
Reference in a new issue