diff options
author | FFRaycoder <nn_201312@163.com> | 2020-05-24 15:39:19 +0300 |
---|---|---|
committer | FFRaycoder <nn_201312@163.com> | 2020-05-24 15:39:19 +0300 |
commit | 09a383967365aff3ab85e64b091f48d5c7efa087 (patch) | |
tree | ad079a7f3e3f834b36589d1835dd9f9ddf963ad1 | |
parent | d4697d4d809aec58d3675ab82ea5cfce3beba2a1 (diff) |
buyLink inside post
-rw-r--r-- | layouts/partials/components/home/eachpost.html | 2 | ||||
-rw-r--r-- | layouts/partials/custom/content.html | 0 | ||||
-rw-r--r-- | layouts/partials/pages/post.html | 18 | ||||
-rw-r--r-- | layouts/partials/utils/content.html | 20 |
4 files changed, 39 insertions, 1 deletions
diff --git a/layouts/partials/components/home/eachpost.html b/layouts/partials/components/home/eachpost.html index 1993b3a..a695693 100644 --- a/layouts/partials/components/home/eachpost.html +++ b/layouts/partials/components/home/eachpost.html @@ -14,7 +14,7 @@ </a>
<p>
{{ .Params.buyInfo }}
- </p>
+ </p>
</div>
<div>
<a href="{{ .Params.buyLink }}" target="_blank">
diff --git a/layouts/partials/custom/content.html b/layouts/partials/custom/content.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/custom/content.html diff --git a/layouts/partials/pages/post.html b/layouts/partials/pages/post.html index 9b3af65..da6e1b6 100644 --- a/layouts/partials/pages/post.html +++ b/layouts/partials/pages/post.html @@ -17,7 +17,25 @@ </div>
<div class="article-content">
{{ .Content }}
+
</div>
+ <div>
+ <div class="buy-list-item" style="margin: 60px 10px -35px 10px;">
+ <div class="buy-left-img-noborder">
+ <img src="{{ .Params.buyImage }}" alt="KeyChron K2">
+ </div>
+ <div class="buy-right-info">
+ <div>
+ <h3>{{ .Params.buyName }}</h3>
+ <p>{{ .Params.buyInfo }}</p>
+ </div>
+ <div>
+ <a href="{{ .Params.buyLink }}">{{ .Params.buyButtonText }}</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ {{- partial "utils/content.html" . -}}
{{ if .Params.Tags }}
{{ partial "components/post/tags.html" . }}
{{ end }}
diff --git a/layouts/partials/utils/content.html b/layouts/partials/utils/content.html new file mode 100644 index 0000000..2e33961 --- /dev/null +++ b/layouts/partials/utils/content.html @@ -0,0 +1,20 @@ +{{- $Deliver := . -}} +{{- $raw := .Content -}} +{{- partial "utils/markdownify.html" (dict "Deliver" . "raw" $raw "isContent" true) -}} + +<!-- Image & Video Caption --> +{{- $Content := .Scratch.Get "Content" -}} +{{- if .Site.Params.enableCaption -}} + {{- $captionPrefix := .Site.Params.captionPrefix -}} + {{- $regexPatternCaption := `(<(img|video).+) title="([^"]+)"( controls)?( />|>)(</video>)?` -}} + {{- $regexReplacementCaption := (printf `$1$4$5$6<p><span style="color: #808080;"> %s$3</span></p>` $captionPrefix) -}} + {{- $Content := $Content | replaceRE $regexPatternCaption $regexReplacementCaption | safeHTML -}} + {{- .Scratch.Set "Content" $Content -}} +{{- end -}} + +<!-- Custom --> +{{- partial "custom/content.html" . -}} + +<!-- Final Content --> +{{- $Content := .Scratch.Get "Content" -}} +{{- .Scratch.Set "Content" $Content -}} |