diff options
author | FFRaycoder <nn_201312@163.com> | 2020-05-31 09:41:49 +0300 |
---|---|---|
committer | FFRaycoder <nn_201312@163.com> | 2020-05-31 09:41:49 +0300 |
commit | 64703b7e38116946dfb6bfd362045fc5d7329c02 (patch) | |
tree | c3cdae0f8464b33cde59efe9d1c8870617a23545 | |
parent | 4a083b7b73f5597e874736406dca221a70981ea5 (diff) |
fix: wrong buy link in page: post
-rw-r--r-- | layouts/partials/pages/post.html | 26 | ||||
-rw-r--r-- | layouts/partials/utils/content.html | 4 |
2 files changed, 16 insertions, 14 deletions
diff --git a/layouts/partials/pages/post.html b/layouts/partials/pages/post.html index 0734756..bf542f0 100644 --- a/layouts/partials/pages/post.html +++ b/layouts/partials/pages/post.html @@ -18,22 +18,24 @@ <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>
+ {{ if .Params.buy }}
+ <div>
+ <div class="buy-list-item" style="margin: 60px 10px -35px 10px;">
+ <div class="buy-left-img-noborder">
+ <img src="{{ .Params.buyImage }}" alt="{{ .Params.buyName }}">
</div>
- <div>
- <a href="{{ .Params.buyLink }}">{{ .Params.buyButtonText }}</a>
+ <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>
- </div>
+ {{ end }}
{{- partial "utils/content.html" . -}}
{{ if .Params.Tags }}
{{ partial "components/post/tags.html" . }}
diff --git a/layouts/partials/utils/content.html b/layouts/partials/utils/content.html index 2e33961..e5480d3 100644 --- a/layouts/partials/utils/content.html +++ b/layouts/partials/utils/content.html @@ -6,8 +6,8 @@ {{- $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) -}} + {{- $regexPatternCaption := `(<(img|video).+) title="([^"]+)"( controls)?( class=".+")?( />|>)(</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 -}} |