From 9f47e608ef2f30dde3f6669ef875968dc996b6fa Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Tue, 12 Apr 2022 12:42:32 +0800 Subject: [PATCH] :sparkles: Feat: link shortcode add `external-icon` option (#96) --- CHANGELOG.md | 1 + .../posts/theme-documentation-extended-shortcodes/index.en.md | 4 ++++ .../theme-documentation-extended-shortcodes/index.zh-cn.md | 4 ++++ layouts/shortcodes/link.html | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aa6f298..5171b27b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. - :sparkles: Feat: enhance link render ([#96](https://github.com/Lruihao/FixIt/issues/96)) - Add external icon for external links automatically - Add download icon for downloadable links +- :sparkles: Feat: link shortcode add `external-icon` option ([#96](https://github.com/Lruihao/FixIt/issues/96)) - :bug: Fix: invalid front matter `comment: true` ([#108](https://github.com/Lruihao/FixIt/issues/108)) - :sparkles: Style: add some common CSS styles Class ([#101](https://github.com/Lruihao/FixIt/issues/101)) - :memo: Docs: revised theme documentation diff --git a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.en.md b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.en.md index db0ff3f4..68830711 100644 --- a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.en.md +++ b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.en.md @@ -101,6 +101,10 @@ The `link` shortcode has the following named parameters: Additional `rel` attributes of the HTML `a` tag. +* **external-icon** *[optional]* {{< version 0.2.14 >}} + + whether to add external Icon for external links automatically + Example `link` input: ```go-html-template diff --git a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.zh-cn.md index 6d4f6494..de423251 100644 --- a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.zh-cn.md @@ -103,6 +103,10 @@ This is a **right-aligned** paragraph. HTML `a` 标签 的 `rel` 补充属性。 +* **external-icon** *[可选]* {{< version 0.2.14 >}} + + 是否自动显示外链图标 + 一个 `link` 示例: ```go-html-template diff --git a/layouts/shortcodes/link.html b/layouts/shortcodes/link.html index 6fc9dac4..6dc23e40 100644 --- a/layouts/shortcodes/link.html +++ b/layouts/shortcodes/link.html @@ -15,5 +15,5 @@ {{- $options = dict "Title" (.Get 2) | merge $options -}} {{- $options = dict "Card" (.Get 3) | merge $options -}} {{- end -}} -{{- $options = dict "ExternalIcon" .Site.Params.externalIcon | merge $options -}} +{{- $options = dict "ExternalIcon" (.Get "external-icon" | default .Site.Params.externalIcon ) | merge $options -}} {{- partial "plugin/link.html" $options -}}