From b0413227dbadc0a36be5dc04eef40b858aaffa95 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Fri, 14 Jan 2022 16:16:18 +0800 Subject: [PATCH] :zap: Perf: merge cardlink shortcode (deprecated v0.2.13) into link shortcode and add 'download' param (#42) --- CHANGELOG.md | 5 +- assets/css/_partial/_single/_cardlink.scss | 2 +- layouts/partials/plugin/cardlink.html | 24 ---------- layouts/partials/plugin/link.html | 55 +++++++++++++++++++--- layouts/shortcodes/cardlink.html | 5 +- layouts/shortcodes/link.html | 2 + 6 files changed, 59 insertions(+), 34 deletions(-) delete mode 100644 layouts/partials/plugin/cardlink.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cba4f5c..9fcc6e64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ -## 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)) diff --git a/assets/css/_partial/_single/_cardlink.scss b/assets/css/_partial/_single/_cardlink.scss index d516a8e1..2a4378dd 100644 --- a/assets/css/_partial/_single/_cardlink.scss +++ b/assets/css/_partial/_single/_cardlink.scss @@ -84,7 +84,7 @@ align-items: center; } -.card-link-imageCell { +.card-link-image-cell { margin-left: 8px; border-radius: 6px } diff --git a/layouts/partials/plugin/cardlink.html b/layouts/partials/plugin/cardlink.html deleted file mode 100644 index 464d7ee3..00000000 --- a/layouts/partials/plugin/cardlink.html +++ /dev/null @@ -1,24 +0,0 @@ -{{- $rel := "" -}} - - - - - - {{- with .Content -}} - {{- . | safeHTML -}} - {{- end -}} - - - - - - - - {{ .Destination | safeURL }} - - - - card-link icon - - - \ No newline at end of file diff --git a/layouts/partials/plugin/link.html b/layouts/partials/plugin/link.html index 8fb7ff4e..0fb2d7dd 100644 --- a/layouts/partials/plugin/link.html +++ b/layouts/partials/plugin/link.html @@ -1,9 +1,52 @@ {{- $rel := "" -}} - - {{- with .Icon -}} - {{- partial "plugin/icon.html" . -}} - {{- end -}} - {{- with .Content -}} - {{- . | safeHTML -}} +{{- $class := "" -}} + + {{- if ne .Card true -}} + {{- with .Content -}} + {{- . | safeHTML -}} + {{- end -}} + {{- else -}} + + + + + {{- with .Content -}} + {{- . | safeHTML -}} + {{- end -}} + + + + + + + + {{ .Destination | safeURL }} + + + + card-link icon + + {{- end -}} \ No newline at end of file diff --git a/layouts/shortcodes/cardlink.html b/layouts/shortcodes/cardlink.html index bfd35186..dbaed97a 100644 --- a/layouts/shortcodes/cardlink.html +++ b/layouts/shortcodes/cardlink.html @@ -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 -}} diff --git a/layouts/shortcodes/link.html b/layouts/shortcodes/link.html index 5b201f2c..22e2fc68 100644 --- a/layouts/shortcodes/link.html +++ b/layouts/shortcodes/link.html @@ -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 -}}