Perf: merge cardlink shortcode (deprecated v0.2.13) into link shortcode and add 'download' param (#42)

This commit is contained in:
Cell
2022-01-14 16:16:18 +08:00
parent 1d4e434bfc
commit b0413227db
6 changed files with 59 additions and 34 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
<!-- See https://github.com/Lruihao/FixIt/releases -->
## v0.2.12 [2022-1-13]
## v0.2.12 [2022-1-14]
- :tada: Feat: add PWA support
- :tada: Feat: add Watermark support ([#16](https://github.com/Lruihao/FixIt/issues/16))
@@ -8,6 +8,7 @@
- :sparkles: Feat: add pangu.js support ([#20](https://github.com/Lruihao/FixIt/issues/20))
- :sparkles: Feat: add public network security config (only in China) ([#15](https://github.com/Lruihao/FixIt/issues/15))
- :sparkles: Feat: add CustomJS option ([#24](https://github.com/Lruihao/FixIt/issues/24))
- :zap: Perf: merge cardlink shortcode (deprecated v0.2.13) into link shortcode and add 'download' param ([#42](https://github.com/Lruihao/FixIt/issues/42))
- :zap: Perf: optimize JS loading ([#25](https://github.com/Lruihao/FixIt/issues/25))
- :art: Perf: optimize footer code
- :recycle: Refactor: header title DOM and add subtitle option ([#26](https://github.com/Lruihao/FixIt/issues/26))
@@ -27,7 +28,7 @@
> :tada: The beginning of FixIt to fix the theme LoveIt.
- :sparkles: Feat: add cardlink shoretcode ([Lruihao/hugo-blog@`df9eca2`](https://github.com/Lruihao/hugo-blog/commit/df9eca26af43287748fd8d4654014357a8269b0b))
- :sparkles: Feat: add cardlink shortcode ([Lruihao/hugo-blog@`df9eca2`](https://github.com/Lruihao/hugo-blog/commit/df9eca26af43287748fd8d4654014357a8269b0b))
- :tada: Feat: add friends layout template
- :wrench: Chore(i18n): add translations for Traditional Chinese ([Lruihao/hugo-blog@`df9eca2`](https://github.com/Lruihao/hugo-blog/commit/b86157d8b84830bda415ab2488580afd843acac2))
- :bug: Fix: mobile style ([Lruihao/hugo-blog#19](https://github.com/Lruihao/hugo-blog/issues/19))
+1 -1
View File
@@ -84,7 +84,7 @@
align-items: center;
}
.card-link-imageCell {
.card-link-image-cell {
margin-left: 8px;
border-radius: 6px
}
-24
View File
@@ -1,24 +0,0 @@
{{- $rel := "" -}}
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .Destination).Host | or .Newtab }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"{{ with .Class }} class="{{ . }} card-link"{{ end }} class="card-link">
<span class="card-link-backdrop"></span>
<span class="card-link-content">
<span class="card-link-text">
<span class="card-link-title">
{{- with .Content -}}
{{- . | safeHTML -}}
{{- end -}}
</span>
<span class="card-link-meta">
<span class="card-link-url">
<svg class="Zi Zi--InsertLink" fill="currentColor" viewbox="0 0 24 24" width="17" height="17">
<path d="M6.77 17.23c-.905-.904-.94-2.333-.08-3.193l3.059-3.06-1.192-1.19-3.059 3.058c-1.489 1.489-1.427 3.954.138 5.519s4.03 1.627 5.519.138l3.059-3.059-1.192-1.192-3.059 3.06c-.86.86-2.289.824-3.193-.08zm3.016-8.673l1.192 1.192 3.059-3.06c.86-.86 2.289-.824 3.193.08.905.905.94 2.334.08 3.194l-3.059 3.06 1.192 1.19 3.059-3.058c1.489-1.489 1.427-3.954-.138-5.519s-4.03-1.627-5.519-.138L9.786 8.557zm-1.023 6.68c.33.33.863.343 1.177.029l5.34-5.34c.314-.314.3-.846-.03-1.176-.33-.33-.862-.344-1.176-.03l-5.34 5.34c-.314.314-.3.846.03 1.177z" fill-rule="evenodd"></path>
</svg>
</span>
{{ .Destination | safeURL }}
</span>
</span>
<span class="card-link-imageCell">
<img class="card-link-image" alt="card-link icon" src="/lib/img/linkicon.png" />
</span>
</span>
</a>
+49 -6
View File
@@ -1,9 +1,52 @@
{{- $rel := "" -}}
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .Destination).Host | or .Newtab }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"{{ with .Class }} class="{{ . }}"{{ end }}>
{{- with .Icon -}}
{{- partial "plugin/icon.html" . -}}
{{- end -}}
{{- with .Content -}}
{{- . | safeHTML -}}
{{- $class := "" -}}
<a
href="{{ .Destination | safeURL }}"
{{ with .Title }}
title="{{ . }}"
{{ end }}
{{ if (urls.Parse .Destination).Host | or .Newtab }}
{{ $rel = "noopener noreffer" }}
target="_blank"
{{ end }}
{{ if $rel | or .Rel }}
rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"
{{ end }}
{{ if eq .Card true }}
{{ $class = "card-link" }}
{{ end }}
{{ if $class | or .Class }}
class="{{ $class }}{{ with .Class }} {{ . }}{{ end }}"
{{ end }}
{{ with .Download }}
download="{{ . }}"
{{ end }}
>
{{- if ne .Card true -}}
{{- with .Content -}}
{{- . | safeHTML -}}
{{- end -}}
{{- else -}}
<span class="card-link-backdrop"></span>
<span class="card-link-content">
<span class="card-link-text">
<span class="card-link-title">
{{- with .Content -}}
{{- . | safeHTML -}}
{{- end -}}
</span>
<span class="card-link-meta">
<span class="card-link-url">
<svg class="Zi Zi--InsertLink" fill="currentColor" viewbox="0 0 24 24" width="17" height="17">
<path d="M6.77 17.23c-.905-.904-.94-2.333-.08-3.193l3.059-3.06-1.192-1.19-3.059 3.058c-1.489 1.489-1.427 3.954.138 5.519s4.03 1.627 5.519.138l3.059-3.059-1.192-1.192-3.059 3.06c-.86.86-2.289.824-3.193-.08zm3.016-8.673l1.192 1.192 3.059-3.06c.86-.86 2.289-.824 3.193.08.905.905.94 2.334.08 3.194l-3.059 3.06 1.192 1.19 3.059-3.058c1.489-1.489 1.427-3.954-.138-5.519s-4.03-1.627-5.519-.138L9.786 8.557zm-1.023 6.68c.33.33.863.343 1.177.029l5.34-5.34c.314-.314.3-.846-.03-1.176-.33-.33-.862-.344-1.176-.03l-5.34 5.34c-.314.314-.3.846.03 1.177z" fill-rule="evenodd"></path>
</svg>
</span>
{{ .Destination | safeURL }}
</span>
</span>
<span class="card-link-image-cell">
<img class="card-link-image" alt="card-link icon" src="/lib/img/linkicon.png" />
</span>
</span>
{{- end -}}
</a>
+4 -1
View File
@@ -1,3 +1,4 @@
{{- /* Deprecated v0.2.13 */ -}}
{{- $destination := cond .IsNamedParams (.Get "href") (.Get 0) -}}
{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}}
{{- $destination = .RelPermalink -}}
@@ -8,8 +9,10 @@
{{- $options = dict "Title" (.Get "title") | merge $options -}}
{{- $options = dict "Class" (.Get "class") | merge $options -}}
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
{{- $options = dict "Download" (.Get "download") | merge $options -}}
{{- $options = dict "Card" true | merge $options -}}
{{- else -}}
{{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}}
{{- $options = dict "Title" (.Get 2) | merge $options -}}
{{- end -}}
{{- partial "plugin/cardlink.html" $options -}}
{{- partial "plugin/link.html" $options -}}
+2
View File
@@ -8,6 +8,8 @@
{{- $options = dict "Title" (.Get "title") | merge $options -}}
{{- $options = dict "Class" (.Get "class") | merge $options -}}
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
{{- $options = dict "Download" (.Get "download") | merge $options -}}
{{- $options = dict "Card" (.Get "card") | merge $options -}}
{{- else -}}
{{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}}
{{- $options = dict "Title" (.Get 2) | merge $options -}}