feat(shortcode): add link shortcode (#179)

* feat(shortcode): add link shortcode

* docs: add docs for link shortcode

* docs: fix 'mailto' in link shortcode docs error
This commit is contained in:
Dillon
2020-03-17 21:16:04 +08:00
committed by GitHub
parent f9dba2e36c
commit 6b03c711ac
30 changed files with 375 additions and 252 deletions

View File

@@ -5,7 +5,7 @@
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE) [![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
[![CircleCI](https://img.shields.io/circleci/build/github/dillonzq/LoveIt/develop?label=CI&style=flat-square&logo=circleci)](https://app.circleci.com/pipelines/github/dillonzq/LoveIt) [![CircleCI](https://img.shields.io/circleci/build/github/dillonzq/LoveIt/develop?label=CI&style=flat-square&logo=circleci)](https://app.circleci.com/pipelines/github/dillonzq/LoveIt)
English README | [中文说明](README.zh-cn.md) English README | [中文说明](https://github.com/dillonzq/LoveIt/blob/master/README.zh-cn.md)
**LoveIt** is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/). **LoveIt** is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/).
@@ -14,7 +14,7 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a
Since the three themes have a similar look, if you have questions about their differences, Since the three themes have a similar look, if you have questions about their differences,
read [Why choose LoveIt](#why-choose-loveit) so that you can choose the one that works best for you. read [Why choose LoveIt](#why-choose-loveit) so that you can choose the one that works best for you.
![Hugo Theme LoveIt](https://github.com/dillonzq/LoveIt/raw/develop/images/Apple-Devices-Preview.png) ![Hugo Theme LoveIt](https://github.com/dillonzq/LoveIt/raw/master/images/Apple-Devices-Preview.png)
## [Demo Site](https://hugoloveit.com/) ## [Demo Site](https://hugoloveit.com/)

View File

@@ -5,7 +5,7 @@
[![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE) [![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE)
[![CircleCI](https://img.shields.io/circleci/build/github/dillonzq/LoveIt/develop?label=CI&style=flat-square&logo=circleci)](https://app.circleci.com/pipelines/github/dillonzq/LoveIt) [![CircleCI](https://img.shields.io/circleci/build/github/dillonzq/LoveIt/develop?label=CI&style=flat-square&logo=circleci)](https://app.circleci.com/pipelines/github/dillonzq/LoveIt)
[English README](README.md) | 中文说明 [English README](https://github.com/dillonzq/LoveIt/blob/master/README.md) | 中文说明
[LoveIt](https://github.com/dillonzq/LoveIt) 是一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。 [LoveIt](https://github.com/dillonzq/LoveIt) 是一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。
@@ -13,7 +13,7 @@
由于三个主题外观的相似性,如果你对于它们的不同之处有疑问,请阅读 [为什么选择 LoveIt](#为什么选择-LoveIt),以便你能选择最适合你的一个。 由于三个主题外观的相似性,如果你对于它们的不同之处有疑问,请阅读 [为什么选择 LoveIt](#为什么选择-LoveIt),以便你能选择最适合你的一个。
![Hugo 主题 LoveIt](https://github.com/dillonzq/LoveIt/raw/develop/images/Apple-Devices-Preview.png) ![Hugo 主题 LoveIt](https://github.com/dillonzq/LoveIt/raw/master/images/Apple-Devices-Preview.png)
## 主题[预览](https://hugoloveit.com/zh-cn/) ## 主题[预览](https://hugoloveit.com/zh-cn/)

View File

@@ -60,20 +60,9 @@ body {
} }
a { a {
color: $global-link-color;
text-decoration: none; text-decoration: none;
&:hover {
color: $global-link-hover-color;
}
.dark-theme & {
color: $global-link-color-dark;
&:hover {
color: $global-link-hover-color-dark;
}
}
} }
@include link(true, true);
@import "../_partial/fixed-button"; @import "../_partial/fixed-button";

View File

@@ -0,0 +1,2 @@
@import "_link";
@import "_summary";

View File

@@ -0,0 +1,18 @@
@mixin link($light, $dark) {
a {
color: if($light, $global-link-color, $single-link-color);
.dark-theme & {
color: if($dark, $global-link-color-dark, $single-link-color-dark);
}
&:active,
&:hover {
color: if($light, $global-link-hover-color, $single-link-hover-color);
.dark-theme & {
color: if($dark, $global-link-hover-color-dark, $single-link-hover-color-dark);
}
}
}
}

View File

@@ -90,21 +90,7 @@
} }
} }
a { @include link(true, true);
color: $global-link-color;
.dark-theme & {
color: $global-link-color-dark;
}
&:hover {
color: $global-link-hover-color;
.dark-theme & {
color: $global-link-hover-color-dark;
}
}
}
b, strong { b, strong {
.dark-theme & { .dark-theme & {
@@ -120,40 +106,12 @@
align-items: center; align-items: center;
font-size: .875rem; font-size: .875rem;
a { @include link(false, false);
color: $single-link-color;
.dark-theme & {
color: $single-link-color-dark;
}
&:hover {
color: $single-link-hover-color;
.dark-theme & {
color: $single-link-hover-color-dark;
}
}
}
.post-tags { .post-tags {
padding: 0; padding: 0;
a { @include link(true, true);
color: $global-link-color;
.dark-theme & {
color: $global-link-color-dark;
}
&:hover {
color: $global-link-hover-color;
.dark-theme & {
color: $global-link-hover-color-dark;
}
}
}
} }
} }
} }

View File

@@ -1,6 +1,4 @@
/** Home **/ /** Home **/
@import "../_partial/_home/summary";
@mixin page-home($profile, $posts) { @mixin page-home($profile, $posts) {
.home { .home {
@if $profile { @if $profile {

View File

@@ -26,21 +26,7 @@
color: $global-font-secondary-color-dark; color: $global-font-secondary-color-dark;
} }
a { @include link(false, true);
color: $single-link-color;
.dark-theme & {
color: $global-link-color-dark;
}
&:hover {
color: $single-link-hover-color;
.dark-theme & {
color: $global-link-hover-color-dark;
}
}
}
.author { .author {
font-size: 1.05rem; font-size: 1.05rem;
@@ -102,22 +88,19 @@
} }
} }
@include link(false, false);
a { a {
word-break: break-all; word-break: break-all;
word-break: break-word; word-break: break-word;
color: $single-link-color;
.dark-theme &, .dark-theme & b, .dark-theme & strong { .dark-theme & b, .dark-theme & strong {
color: $single-link-color-dark; color: $single-link-color-dark;
} }
} }
a:hover { .dark-theme a:hover b, .dark-theme a:hover strong {
color: $single-link-hover-color; color: $single-link-hover-color-dark;
.dark-theme &, .dark-theme & b, .dark-theme & strong {
color: $single-link-hover-color-dark;
}
} }
ul { ul {

View File

@@ -1,6 +1,8 @@
.tag-cloud-tags { .tag-cloud-tags {
margin: 10px 0; margin: 10px 0;
@include link(true, true);
a { a {
display: inline-block; display: inline-block;
position: relative; position: relative;
@@ -14,23 +16,18 @@
&:active, &:active,
&:focus, &:focus,
&:hover { &:hover {
color: $global-link-hover-color;
-webkit-transform: scale(1.2); -webkit-transform: scale(1.2);
-moz-transform: scale(1.2); -moz-transform: scale(1.2);
-ms-transform: scale(1.2); -ms-transform: scale(1.2);
-o-transform: scale(1.2); -o-transform: scale(1.2);
transform: scale(1.2); transform: scale(1.2);
.dark-theme & {
color: $global-link-hover-color-dark;
}
} }
small { small {
color: $global-font-secondary-color; color: $global-font-secondary-color;
.dark-theme & { .dark-theme & {
color: $global-link-hover-color-dark; color: $global-font-secondary-color-dark;
} }
} }
} }

View File

@@ -46,23 +46,12 @@ code, pre, .highlight table, .highlight tr, .highlight td {
} }
} }
.ln {
padding-right: .8rem;
}
.lntd { .lntd {
&:first-child {
width: 1.2rem;
/* LineNumbersTable */
.lnt {
color: $code-info-color;
}
/* LineHighlight */
.hl {
font-weight: bolder;
}
}
&:last-child { &:last-child {
/* LineHighlight */
.hl { .hl {
display: block; display: block;
background-color: darken($code-background-color, 5%); background-color: darken($code-background-color, 5%);
@@ -73,6 +62,14 @@ code, pre, .highlight table, .highlight tr, .highlight td {
} }
} }
} }
.ln, .lnt {
color: $global-font-secondary-color;
.dark-theme & {
color: $global-font-secondary-color-dark;
}
}
} }
.highlight { .highlight {
@@ -103,6 +100,7 @@ code, pre, .highlight table, .highlight tr, .highlight td {
table, tr, td { table, tr, td {
margin: 0; margin: 0;
border: none !important; border: none !important;
white-space: nowrap;
} }
td { td {
@@ -119,21 +117,7 @@ code, pre, .highlight table, .highlight tr, .highlight td {
padding: .4rem .8rem; padding: .4rem .8rem;
background-color: darken($code-background-color, 5%); background-color: darken($code-background-color, 5%);
a { @include link(false, false);
color: $single-link-color;
.dark-theme & {
color: $single-link-color-dark;
}
}
a:hover {
color: $single-link-hover-color;
.dark-theme &:hover {
color: $single-link-hover-color-dark;
}
}
.dark-theme & { .dark-theme & {
background-color: darken($code-background-color-dark, 5%); background-color: darken($code-background-color-dark, 5%);

View File

@@ -21,21 +21,7 @@
color: $global-font-secondary-color-dark; color: $global-font-secondary-color-dark;
} }
a { @include link(false, false);
color: $single-link-color;
.dark-theme & {
color: $single-link-color-dark;
}
&:hover {
color: $single-link-hover-color;
.dark-theme & {
color: $single-link-hover-color-dark;
}
}
}
} }
.post-info-license { .post-info-license {
@@ -51,21 +37,7 @@
font-size: 0.8rem; font-size: 0.8rem;
width: 8rem; width: 8rem;
a { @include link(false, false);
color: $single-link-color;
.dark-theme & {
color: $single-link-color-dark;
}
&:hover {
color: $single-link-hover-color;
.dark-theme & {
color: $single-link-hover-color-dark;
}
}
}
} }
} }
} }

View File

@@ -11,6 +11,8 @@ $header-normal-mode-mobile: {{ if eq .Site.Params.header.mobileMode "normal" }}t
@import "_override"; @import "_override";
{{- end -}} {{- end -}}
@import "_mixin/index";
@import "_core/normalize"; @import "_core/normalize";
@import "_core/base"; @import "_core/base";
@import "_core/layout"; @import "_core/layout";

View File

@@ -835,12 +835,11 @@ enableEmoji = true
[markup.highlight] [markup.highlight]
codeFences = true codeFences = true
guessSyntax = true guessSyntax = true
lineNoStart = 1
lineNos = true lineNos = true
lineNumbersInTable = true lineNumbersInTable = false
# false is a necessary configuration (https://github.com/dillonzq/LoveIt/issues/158)
# false 是必要的设置 (https://github.com/dillonzq/LoveIt/issues/158)
noClasses = false noClasses = false
style = "monokai"
tabWidth = 4
# Goldmark is from Hugo 0.60 the default library used for Markdown # Goldmark is from Hugo 0.60 the default library used for Markdown
# Goldmark 是 Hugo 0.60 以来的默认 Markdown 解析库 # Goldmark 是 Hugo 0.60 以来的默认 Markdown 解析库
[markup.goldmark] [markup.goldmark]

View File

@@ -3,6 +3,6 @@
// 覆盖变量 // 覆盖变量
// ============================== // ==============================
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Nunito:wght@800&display=swap');
$header-title-font-family: 'Baloo 2', $global-font-family; $header-title-font-family: 'Nunito', $global-font-family;

View File

@@ -641,7 +641,7 @@ The rendered output looks like this:
| ext | extension to be used for dest files. | | ext | extension to be used for dest files. |
{{< /admonition >}} {{< /admonition >}}
## 11 Links ## 11 Links {#links}
### Basic Link ### Basic Link

View File

@@ -648,7 +648,7 @@ The rendered output looks like this:
## 11 Links ## 11 Links
### Basic Link ### Basic Link {#links}
```markdown ```markdown
<https://assemble.io> <https://assemble.io>

View File

@@ -643,7 +643,7 @@ grunt.initConfig({
| ext | extension to be used for dest files. | | ext | extension to be used for dest files. |
{{< /admonition >}} {{< /admonition >}}
## 11 链接 ## 11 链接 {#links}
### 基本链接 ### 基本链接

View File

@@ -205,7 +205,7 @@ Note that some of these parameters are explained in details in other sections of
# ICP info only in China (HTML format is allowed) # ICP info only in China (HTML format is allowed)
icp = "" icp = ""
# license info (HTML format is allowed) # license info (HTML format is allowed)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>' license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# Home Page Info # Home Page Info
[params.home] [params.home]
# Home Page Profile # Home Page Profile
@@ -304,7 +304,7 @@ Note that some of these parameters are explained in details in other sections of
lightgallery = true lightgallery = true
# whether to show link to Raw Markdown content of the post # whether to show link to Raw Markdown content of the post
linkToMarkdown = true linkToMarkdown = true
# mathematical formulas (KaTeX https://katex.org/) # {{< link "https://katex.org/" KaTeX >}} mathematical formulas
[params.math] [params.math]
enable = true enable = true
# default block delimiter is $$ ... $$ and \\[ ... \\] # default block delimiter is $$ ... $$ and \\[ ... \\]
@@ -350,13 +350,13 @@ Note that some of these parameters are explained in details in other sections of
# Comment Config # Comment Config
[params.comment] [params.comment]
enable = true enable = true
# Disqus Comment Config (https://disqus.com/) # {{< link "https://disqus.com/" Disqus >}} Comment Config
[params.comment.disqus] [params.comment.disqus]
# {{< version 0.1.1 >}} # {{< version 0.1.1 >}}
enable = false enable = false
# Disqus shortname to use Disqus in posts # Disqus shortname to use Disqus in posts
shortname = "" shortname = ""
# Gitalk Comment Config (https://github.com/gitalk/gitalk) # {{< link "https://github.com/gitalk/gitalk" Gitalk >}} Comment Config
[params.comment.gitalk] [params.comment.gitalk]
# {{< version 0.1.1 >}} # {{< version 0.1.1 >}}
enable = false enable = false
@@ -364,7 +364,7 @@ Note that some of these parameters are explained in details in other sections of
repo = "" repo = ""
clientId = "" clientId = ""
clientSecret = "" clientSecret = ""
# Valine Comment Config (https://github.com/xCss/Valine) # {{< link "https://github.com/xCss/Valine" Valine >}} Comment Config
[params.comment.valine] [params.comment.valine]
enable = false enable = false
appId = "" appId = ""
@@ -378,7 +378,7 @@ Note that some of these parameters are explained in details in other sections of
lang = "en" lang = "en"
visitor = true visitor = true
recordIP = true recordIP = true
# Facebook Comment Config (https://developers.facebook.com/docs/plugins/comments) # {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook Comment" >}} Config
[params.comment.facebook] [params.comment.facebook]
enable = false enable = false
width = "100%" width = "100%"
@@ -412,58 +412,57 @@ Note that some of these parameters are explained in details in other sections of
height = 600 height = 600
# CSS and JS Files CDN # CSS and JS Files CDN
[params.cdn] [params.cdn]
# fontawesome-free@5.12.1 https://fontawesome.com/ # {{< link "https://fontawesome.com/" "fontawesome-free" >}}@5.12.1
fontawesomeFreeCSS = '' fontawesomeFreeCSS = ''
# animate.css@3.7.2 https://github.com/daneden/animate.css # animate.css@3.7.2 https://github.com/daneden/animate.css
animateCSS = '' animateCSS = ''
# smooth-scroll@16.1.2 https://github.com/cferdinandi/smooth-scroll # {{< link "https://github.com/cferdinandi/smooth-scroll" "smooth-scroll" >}}@16.1.2
smoothScrollJS = '' smoothScrollJS = ''
# sharer@0.4.0 https://github.com/ellisonleao/sharer.js # {{< link "https://github.com/ellisonleao/sharer.js" "sharer" >}}@0.4.0
sharerJS = '' sharerJS = ''
# lazysizes@5.2.0 https://github.com/aFarkas/lazysizes # {{< link "https://github.com/aFarkas/lazysizes" "lazysizes" >}}@5.2.0
lazysizesJS = '' lazysizesJS = ''
# lightgallery@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0 https://github.com/sachinchoolur/lightgallery.js # {{< link "https://github.com/sachinchoolur/lightgallery.js" "lightgallery" >}}@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0
lightgalleryCSS = '' lightgalleryCSS = ''
lightgalleryJS = '' lightgalleryJS = ''
lightgalleryThumbnailJS = '' lightgalleryThumbnailJS = ''
lightgalleryZoomJS = '' lightgalleryZoomJS = ''
# typeit@6.5.1 https://github.com/alexmacarthur/typeit # {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1
typeitJS = '' typeitJS = ''
# katex@0.11.1 https://github.com/KaTeX/KaTeX # {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = '' katexCSS = ''
katexJS = '' katexJS = ''
katexAutoRenderJS = '' katexAutoRenderJS = ''
katexCopyTexCSS = '' katexCopyTexCSS = ''
katexCopyTexJS = '' katexCopyTexJS = ''
katexMhchemJS = '' katexMhchemJS = ''
# mermaid@8.4.8 https://github.com/knsv/mermaid # {{< link "https://github.com/knsv/mermaid" "mermaid" >}}@8.4.8
mermaidJS = '' mermaidJS = ''
# aplayer@1.10.1 https://github.com/MoePlayer/APlayer # {{< link "https://github.com/MoePlayer/APlayer" "aplayer" >}}@1.10.1
aplayerCSS = '' aplayerCSS = ''
aplayerJS = '' aplayerJS = ''
# meting@2.0.1 https://github.com/metowolf/MetingJS # {{< link "https://github.com/metowolf/MetingJS" "meting" >}}@2.0.1
metingJS = '' metingJS = ''
# echarts@4.6.0 https://echarts.apache.org/ # {{< link "https://echarts.apache.org/" "echarts" >}}@4.6.0
echartsJS = '' echartsJS = ''
echartsMacaronsJS = '' echartsMacaronsJS = ''
# gitalk@1.6.2 https://github.com/gitalk/gitalk # {{< link "https://github.com/gitalk/gitalk" "gitalk" >}}@1.6.2
gitalkCSS = '' gitalkCSS = ''
gitalkJS = '' gitalkJS = ''
# valine@1.3.10 https://valine.js.org/ # {{< link "https://valine.js.org/" "valine" >}}@1.3.10
valineJS = '' valineJS = ''
# Markup related configuration in Hugo # Markup related configuration in Hugo
[markup] [markup]
# Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting) # {{< link "https://gohugo.io/content-management/syntax-highlighting" "Syntax Highlighting" >}}
[markup.highlight] [markup.highlight]
codeFences = true codeFences = true
guessSyntax = true guessSyntax = true
lineNoStart = 1
lineNos = true lineNos = true
lineNumbersInTable = true lineNumbersInTable = false
# false is a necessary configuration
# ({{< link "https://github.com/dillonzq/LoveIt/issues/158" >}})
noClasses = false noClasses = false
style = "monokai"
tabWidth = 4
# Goldmark is from Hugo 0.60 the default library used for Markdown # Goldmark is from Hugo 0.60 the default library used for Markdown
[markup.goldmark] [markup.goldmark]
[markup.goldmark.extensions] [markup.goldmark.extensions]
@@ -493,12 +492,12 @@ Note that some of these parameters are explained in details in other sections of
filename = "sitemap.xml" filename = "sitemap.xml"
priority = 0.5 priority = 0.5
# Permalinks Info (https://gohugo.io/content-management/urls/#permalinks) # {{< link "https://gohugo.io/content-management/urls/#permalinks" "Permalinks Info" >}}
[Permalinks] [Permalinks]
# posts = ":year/:month/:filename" # posts = ":year/:month/:filename"
posts = ":filename" posts = ":filename"
# Privacy Info (https://gohugo.io/about/hugo-and-gdpr/) # {{< link "https://gohugo.io/about/hugo-and-gdpr/" "Privacy Info" >}}
[privacy] [privacy]
[privacy.googleAnalytics] [privacy.googleAnalytics]
anonymizeIP = true anonymizeIP = true

View File

@@ -31,6 +31,11 @@ Découvrez en quoi consiste le thème Hugo - **LoveIt** et les concepts fondamen
<!--more--> <!--more-->
{{< admonition warning >}}
Sorry, this article has not been completely translated into **French**.
Welcome to take the time to propose a translation by [making a PR](https://github.com/dillonzq/LoveIt/pulls) to the theme!
{{< /admonition >}}
## 1 Requirements ## 1 Requirements
Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only dependency of this theme. Thanks to the simplicity of Hugo, [Hugo](https://gohugo.io/) is the only dependency of this theme.
@@ -205,7 +210,7 @@ Note that some of these parameters are explained in details in other sections of
# ICP info only in China (HTML format is allowed) # ICP info only in China (HTML format is allowed)
icp = "" icp = ""
# license info (HTML format is allowed) # license info (HTML format is allowed)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>' license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# Home Page Info # Home Page Info
[params.home] [params.home]
# Home Page Profile # Home Page Profile
@@ -304,7 +309,7 @@ Note that some of these parameters are explained in details in other sections of
lightgallery = true lightgallery = true
# whether to show link to Raw Markdown content of the post # whether to show link to Raw Markdown content of the post
linkToMarkdown = true linkToMarkdown = true
# mathematical formulas (KaTeX https://katex.org/) # {{< link "https://katex.org/" KaTeX >}} mathematical formulas
[params.math] [params.math]
enable = true enable = true
# default block delimiter is $$ ... $$ and \\[ ... \\] # default block delimiter is $$ ... $$ and \\[ ... \\]
@@ -350,13 +355,13 @@ Note that some of these parameters are explained in details in other sections of
# Comment Config # Comment Config
[params.comment] [params.comment]
enable = true enable = true
# Disqus Comment Config (https://disqus.com/) # {{< link "https://disqus.com/" Disqus >}} Comment Config
[params.comment.disqus] [params.comment.disqus]
# {{< version 0.1.1 >}} # {{< version 0.1.1 >}}
enable = false enable = false
# Disqus shortname to use Disqus in posts # Disqus shortname to use Disqus in posts
shortname = "" shortname = ""
# Gitalk Comment Config (https://github.com/gitalk/gitalk) # {{< link "https://github.com/gitalk/gitalk" Gitalk >}} Comment Config
[params.comment.gitalk] [params.comment.gitalk]
# {{< version 0.1.1 >}} # {{< version 0.1.1 >}}
enable = false enable = false
@@ -364,7 +369,7 @@ Note that some of these parameters are explained in details in other sections of
repo = "" repo = ""
clientId = "" clientId = ""
clientSecret = "" clientSecret = ""
# Valine Comment Config (https://github.com/xCss/Valine) # {{< link "https://github.com/xCss/Valine" Valine >}} Comment Config
[params.comment.valine] [params.comment.valine]
enable = false enable = false
appId = "" appId = ""
@@ -378,7 +383,7 @@ Note that some of these parameters are explained in details in other sections of
lang = "en" lang = "en"
visitor = true visitor = true
recordIP = true recordIP = true
# Facebook Comment Config (https://developers.facebook.com/docs/plugins/comments) # {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook Comment" >}} Config
[params.comment.facebook] [params.comment.facebook]
enable = false enable = false
width = "100%" width = "100%"
@@ -412,58 +417,57 @@ Note that some of these parameters are explained in details in other sections of
height = 600 height = 600
# CSS and JS Files CDN # CSS and JS Files CDN
[params.cdn] [params.cdn]
# fontawesome-free@5.12.1 https://fontawesome.com/ # {{< link "https://fontawesome.com/" "fontawesome-free" >}}@5.12.1
fontawesomeFreeCSS = '' fontawesomeFreeCSS = ''
# animate.css@3.7.2 https://github.com/daneden/animate.css # animate.css@3.7.2 https://github.com/daneden/animate.css
animateCSS = '' animateCSS = ''
# smooth-scroll@16.1.2 https://github.com/cferdinandi/smooth-scroll # {{< link "https://github.com/cferdinandi/smooth-scroll" "smooth-scroll" >}}@16.1.2
smoothScrollJS = '' smoothScrollJS = ''
# sharer@0.4.0 https://github.com/ellisonleao/sharer.js # {{< link "https://github.com/ellisonleao/sharer.js" "sharer" >}}@0.4.0
sharerJS = '' sharerJS = ''
# lazysizes@5.2.0 https://github.com/aFarkas/lazysizes # {{< link "https://github.com/aFarkas/lazysizes" "lazysizes" >}}@5.2.0
lazysizesJS = '' lazysizesJS = ''
# lightgallery@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0 https://github.com/sachinchoolur/lightgallery.js # {{< link "https://github.com/sachinchoolur/lightgallery.js" "lightgallery" >}}@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0
lightgalleryCSS = '' lightgalleryCSS = ''
lightgalleryJS = '' lightgalleryJS = ''
lightgalleryThumbnailJS = '' lightgalleryThumbnailJS = ''
lightgalleryZoomJS = '' lightgalleryZoomJS = ''
# typeit@6.5.1 https://github.com/alexmacarthur/typeit # {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1
typeitJS = '' typeitJS = ''
# katex@0.11.1 https://github.com/KaTeX/KaTeX # {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = '' katexCSS = ''
katexJS = '' katexJS = ''
katexAutoRenderJS = '' katexAutoRenderJS = ''
katexCopyTexCSS = '' katexCopyTexCSS = ''
katexCopyTexJS = '' katexCopyTexJS = ''
katexMhchemJS = '' katexMhchemJS = ''
# mermaid@8.4.8 https://github.com/knsv/mermaid # {{< link "https://github.com/knsv/mermaid" "mermaid" >}}@8.4.8
mermaidJS = '' mermaidJS = ''
# aplayer@1.10.1 https://github.com/MoePlayer/APlayer # {{< link "https://github.com/MoePlayer/APlayer" "aplayer" >}}@1.10.1
aplayerCSS = '' aplayerCSS = ''
aplayerJS = '' aplayerJS = ''
# meting@2.0.1 https://github.com/metowolf/MetingJS # {{< link "https://github.com/metowolf/MetingJS" "meting" >}}@2.0.1
metingJS = '' metingJS = ''
# echarts@4.6.0 https://echarts.apache.org/ # {{< link "https://echarts.apache.org/" "echarts" >}}@4.6.0
echartsJS = '' echartsJS = ''
echartsMacaronsJS = '' echartsMacaronsJS = ''
# gitalk@1.6.2 https://github.com/gitalk/gitalk # {{< link "https://github.com/gitalk/gitalk" "gitalk" >}}@1.6.2
gitalkCSS = '' gitalkCSS = ''
gitalkJS = '' gitalkJS = ''
# valine@1.3.10 https://valine.js.org/ # {{< link "https://valine.js.org/" "valine" >}}@1.3.10
valineJS = '' valineJS = ''
# Markup related configuration in Hugo # Markup related configuration in Hugo
[markup] [markup]
# Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting) # {{< link "https://gohugo.io/content-management/syntax-highlighting" "Syntax Highlighting" >}}
[markup.highlight] [markup.highlight]
codeFences = true codeFences = true
guessSyntax = true guessSyntax = true
lineNoStart = 1
lineNos = true lineNos = true
lineNumbersInTable = true lineNumbersInTable = false
# false is a necessary configuration
# ({{< link "https://github.com/dillonzq/LoveIt/issues/158" >}})
noClasses = false noClasses = false
style = "monokai"
tabWidth = 4
# Goldmark is from Hugo 0.60 the default library used for Markdown # Goldmark is from Hugo 0.60 the default library used for Markdown
[markup.goldmark] [markup.goldmark]
[markup.goldmark.extensions] [markup.goldmark.extensions]
@@ -493,12 +497,12 @@ Note that some of these parameters are explained in details in other sections of
filename = "sitemap.xml" filename = "sitemap.xml"
priority = 0.5 priority = 0.5
# Permalinks Info (https://gohugo.io/content-management/urls/#permalinks) # {{< link "https://gohugo.io/content-management/urls/#permalinks" "Permalinks Info" >}}
[Permalinks] [Permalinks]
# posts = ":year/:month/:filename" # posts = ":year/:month/:filename"
posts = ":filename" posts = ":filename"
# Privacy Info (https://gohugo.io/about/hugo-and-gdpr/) # {{< link "https://gohugo.io/about/hugo-and-gdpr/" "Privacy Info" >}}
[privacy] [privacy]
[privacy.googleAnalytics] [privacy.googleAnalytics]
anonymizeIP = true anonymizeIP = true

View File

@@ -208,7 +208,7 @@ hugo
# ICP 备案信息,仅在中国使用 (允许使用 HTML 格式) # ICP 备案信息,仅在中国使用 (允许使用 HTML 格式)
icp = "" icp = ""
# 许可协议信息 (允许使用 HTML 格式) # 许可协议信息 (允许使用 HTML 格式)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>' license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# 文章页面配置 # 文章页面配置
[params.home] [params.home]
# 主页信息设置 # 主页信息设置
@@ -306,7 +306,7 @@ hugo
lightgallery = true lightgallery = true
# 是否在文章页面显示原始 Markdown 文档链接 # 是否在文章页面显示原始 Markdown 文档链接
linkToMarkdown = true linkToMarkdown = true
# 数学公式 (KaTeX https://katex.org/) # {{< link "https://katex.org/" KaTeX >}} 数学公式
[params.math] [params.math]
enable = true enable = true
# 默认块定界符是 $$ ... $$ 和 \\[ ... \\] # 默认块定界符是 $$ ... $$ 和 \\[ ... \\]
@@ -352,13 +352,13 @@ hugo
# 评论系统设置 # 评论系统设置
[params.comment] [params.comment]
enable = true enable = true
# Disqus 评论系统设置 (https://disqus.com/) # {{< link "https://disqus.com/" Disqus >}} 评论系统设置
[params.comment.disqus] [params.comment.disqus]
# {{< version 0.1.1 >}} # {{< version 0.1.1 >}}
enable = false enable = false
# Disqus 的 shortname用来在文章中启用 Disqus 评论系统 # Disqus 的 shortname用来在文章中启用 Disqus 评论系统
shortname = "" shortname = ""
# Gitalk 评论系统设置 (https://github.com/gitalk/gitalk) # {{< link "https://github.com/gitalk/gitalk" Gitalk >}} 评论系统设置
[params.comment.gitalk] [params.comment.gitalk]
# {{< version 0.1.1 >}} # {{< version 0.1.1 >}}
enable = false enable = false
@@ -366,7 +366,7 @@ hugo
repo = "" repo = ""
clientId = "" clientId = ""
clientSecret = "" clientSecret = ""
# Valine 评论系统设置 (https://github.com/xCss/Valine) # {{< link "https://github.com/xCss/Valine" Valine >}} 评论系统设置
[params.comment.valine] [params.comment.valine]
enable = false enable = false
appId = "" appId = ""
@@ -380,7 +380,7 @@ hugo
lang = "en" lang = "en"
visitor = true visitor = true
recordIP = true recordIP = true
# Facebook 评论系统设置 (https://developers.facebook.com/docs/plugins/comments) # # {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook 评论系统" >}}设置
[params.comment.facebook] [params.comment.facebook]
enable = false enable = false
width = "100%" width = "100%"
@@ -414,58 +414,57 @@ hugo
height = 600 height = 600
# CSS 和 JS 文件的 CDN 设置 # CSS 和 JS 文件的 CDN 设置
[params.cdn] [params.cdn]
# fontawesome-free@5.12.1 https://fontawesome.com/ # {{< link "https://fontawesome.com/" "fontawesome-free" >}}@5.12.1
fontawesomeFreeCSS = '' fontawesomeFreeCSS = ''
# animate.css@3.7.2 https://github.com/daneden/animate.css # animate.css@3.7.2 https://github.com/daneden/animate.css
animateCSS = '' animateCSS = ''
# smooth-scroll@16.1.2 https://github.com/cferdinandi/smooth-scroll # {{< link "https://github.com/cferdinandi/smooth-scroll" "smooth-scroll" >}}@16.1.2
smoothScrollJS = '' smoothScrollJS = ''
# sharer@0.4.0 https://github.com/ellisonleao/sharer.js # {{< link "https://github.com/ellisonleao/sharer.js" "sharer" >}}@0.4.0
sharerJS = '' sharerJS = ''
# lazysizes@5.2.0 https://github.com/aFarkas/lazysizes # {{< link "https://github.com/aFarkas/lazysizes" "lazysizes" >}}@5.2.0
lazysizesJS = '' lazysizesJS = ''
# lightgallery@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0 https://github.com/sachinchoolur/lightgallery.js # {{< link "https://github.com/sachinchoolur/lightgallery.js" "lightgallery" >}}@1.1.3 lg-thumbnail@1.1.0 lg-zoom@1.1.0
lightgalleryCSS = '' lightgalleryCSS = ''
lightgalleryJS = '' lightgalleryJS = ''
lightgalleryThumbnailJS = '' lightgalleryThumbnailJS = ''
lightgalleryZoomJS = '' lightgalleryZoomJS = ''
# typeit@6.5.1 https://github.com/alexmacarthur/typeit # {{< link "https://github.com/alexmacarthur/typeit" "typeit" >}}@6.5.1
typeitJS = '' typeitJS = ''
# katex@0.11.1 https://github.com/KaTeX/KaTeX # {{< link "https://github.com/KaTeX/KaTeX" "katex" >}}@0.11.1
katexCSS = '' katexCSS = ''
katexJS = '' katexJS = ''
katexAutoRenderJS = '' katexAutoRenderJS = ''
katexCopyTexCSS = '' katexCopyTexCSS = ''
katexCopyTexJS = '' katexCopyTexJS = ''
katexMhchemJS = '' katexMhchemJS = ''
# mermaid@8.4.8 https://github.com/knsv/mermaid # {{< link "https://github.com/knsv/mermaid" "mermaid" >}}@8.4.8
mermaidJS = '' mermaidJS = ''
# aplayer@1.10.1 https://github.com/MoePlayer/APlayer # {{< link "https://github.com/MoePlayer/APlayer" "aplayer" >}}@1.10.1
aplayerCSS = '' aplayerCSS = ''
aplayerJS = '' aplayerJS = ''
# meting@2.0.1 https://github.com/metowolf/MetingJS # {{< link "https://github.com/metowolf/MetingJS" "meting" >}}@2.0.1
metingJS = '' metingJS = ''
# echarts@4.6.0 https://echarts.apache.org/ # {{< link "https://echarts.apache.org/" "echarts" >}}@4.6.0
echartsJS = '' echartsJS = ''
echartsMacaronsJS = '' echartsMacaronsJS = ''
# gitalk@1.6.2 https://github.com/gitalk/gitalk # {{< link "https://github.com/gitalk/gitalk" "gitalk" >}}@1.6.2
gitalkCSS = '' gitalkCSS = ''
gitalkJS = '' gitalkJS = ''
# valine@1.3.10 https://valine.js.org/ # {{< link "https://valine.js.org/" "valine" >}}@1.3.10
valineJS = '' valineJS = ''
# Hugo 解析文档的配置 # Hugo 解析文档的配置
[markup] [markup]
# 语法高亮设置 (https://gohugo.io/content-management/syntax-highlighting) # {{< link "https://gohugo.io/content-management/syntax-highlighting" "语法高亮设置" >}}
[markup.highlight] [markup.highlight]
codeFences = true codeFences = true
guessSyntax = true guessSyntax = true
lineNoStart = 1
lineNos = true lineNos = true
lineNumbersInTable = true lineNumbersInTable = false
# false 是必要的设置
# ({{< link "https://github.com/dillonzq/LoveIt/issues/158" >}})
noClasses = false noClasses = false
style = "monokai"
tabWidth = 4
# Goldmark 是 Hugo 0.60 以来的默认 Markdown 解析库 # Goldmark 是 Hugo 0.60 以来的默认 Markdown 解析库
[markup.goldmark] [markup.goldmark]
[markup.goldmark.extensions] [markup.goldmark.extensions]
@@ -495,12 +494,12 @@ hugo
filename = "sitemap.xml" filename = "sitemap.xml"
priority = 0.5 priority = 0.5
# Permalinks 信息 (https://gohugo.io/content-management/urls/#permalinks) # {{< link "https://gohugo.io/content-management/urls/#permalinks" "Permalinks 信息" >}}
[Permalinks] [Permalinks]
# posts = ":year/:month/:filename" # posts = ":year/:month/:filename"
posts = ":filename" posts = ":filename"
# 隐私信息设置 (https://gohugo.io/about/hugo-and-gdpr/) # {{< link "https://gohugo.io/about/hugo-and-gdpr/" "隐私信息设置" >}}
[privacy] [privacy]
[privacy.googleAnalytics] [privacy.googleAnalytics]
anonymizeIP = true anonymizeIP = true

View File

@@ -31,6 +31,11 @@ Découvrez comment créer et organiser votre contenu rapidement et intuitivement
<!--more--> <!--more-->
{{< admonition warning >}}
Sorry, this article has not been completely translated into **French**.
Welcome to take the time to propose a translation by [making a PR](https://github.com/dillonzq/LoveIt/pulls) to the theme!
{{< /admonition >}}
## 1 Contents Organization ## 1 Contents Organization
A few suggestions to help you get a good looking site quickly: A few suggestions to help you get a good looking site quickly:

View File

@@ -217,6 +217,72 @@ The rendered output looks like this:
This is a right-aligned paragraph. This is a right-aligned paragraph.
{{< /style >}} {{< /style >}}
### `link`
{{< admonition >}}
{{< version 1.2.0 >}}
{{< /admonition >}}
`link` shortcode is an alternative to [Markdown link syntax](../basic-markdown-syntax/#links). `link` shortcode can provide some other features and can be used in code blocks.
The `link` shortcode can use the following named parameters:
* **href**
Destination of the link.
* **content**
Content of the link (HTML format is allowed).
* **title**
`title` attribute of the HTML `a` tag, which will be shown when hovering on the link.
* **rel**
Additional `rel` attributes of the HTML `a` tag.
* **class**
`class` attribute of the HTML `a` tag.
#### Basic `link`
Example basic `link` Input:
```markdown
{{</* link "https://assemble.io" */>}}
Or
{{</* link href="https://assemble.io" */>}}
{{</* link "mailto:contact@revolunet.com" */>}}
Or
{{</* link href="mailto:contact@revolunet.com" */>}}
{{</* link "https://assemble.io" Assemble */>}}
Or
{{</* link href="https://assemble.io" content=Assemble */>}}
```
The rendered output looks like this:
* {{< link "https://assemble.io" >}}
* {{< link "mailto:contact@revolunet.com" >}}
* {{< link "https://assemble.io" Assemble >}}
#### Add a Title
```markdown
{{</* link "https://github.com/upstage/" Upstage "Visit Upstage!" */>}}
Or
{{</* link href="https://github.com/upstage/" content=Upstage title="Visit Upstage!" */>}}
```
The rendered output looks like this (hover over the link, there should be a tooltip):
{{< link "https://github.com/upstage/" Upstage "Visit Upstage!" >}}
### `image` ### `image`
`image` shortcode is an alternative to [`figure` shortcode](#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js). `image` shortcode is an alternative to [`figure` shortcode](#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js).

View File

@@ -222,6 +222,72 @@ The rendered output looks like this:
This is a right-aligned paragraph. This is a right-aligned paragraph.
{{< /style >}} {{< /style >}}
### `link`
{{< admonition >}}
{{< version 1.2.0 >}}
{{< /admonition >}}
`link` shortcode is an alternative to [Markdown link syntax](../basic-markdown-syntax/#links). `link` shortcode can provide some other features and can be used in code blocks.
The `link` shortcode can use the following named parameters:
* **href**
Destination of the link.
* **content**
Content of the link (HTML format is allowed).
* **title**
`title` attribute of the HTML `a` tag, which will be shown when hovering on the link.
* **rel**
Additional `rel` attributes of the HTML `a` tag.
* **class**
`class` attribute of the HTML `a` tag.
#### Basic `link`
Example basic `link` Input:
```markdown
{{</* link "https://assemble.io" */>}}
Or
{{</* link href="https://assemble.io" */>}}
{{</* link "mailto:contact@revolunet.com" */>}}
Or
{{</* link href="mailto:contact@revolunet.com" */>}}
{{</* link "https://assemble.io" Assemble */>}}
Or
{{</* link href="https://assemble.io" content=Assemble */>}}
```
The rendered output looks like this:
* {{< link "https://assemble.io" >}}
* {{< link "mailto:contact@revolunet.com" >}}
* {{< link "https://assemble.io" Assemble >}}
#### Add a Title
```markdown
{{</* link "https://github.com/upstage/" Upstage "Visit Upstage!" */>}}
Or
{{</* link href="https://github.com/upstage/" content=Upstage title="Visit Upstage!" */>}}
```
The rendered output looks like this (hover over the link, there should be a tooltip):
{{< link "https://github.com/upstage/" Upstage "Visit Upstage!" >}}
### `image` ### `image`
`image` shortcode is an alternative to [`figure` shortcode](#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js). `image` shortcode is an alternative to [`figure` shortcode](#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js).

View File

@@ -219,6 +219,73 @@ This is a right-aligned paragraph.
This is a right-aligned paragraph. This is a right-aligned paragraph.
{{< /style >}} {{< /style >}}
### `link`
{{< admonition >}}
{{< version 1.2.0 >}}
{{< /admonition >}}
`link` shortcode 是 [Markdown 链接语法](../basic-markdown-syntax/#links) 的替代.
`link` shortcode 可以提供一些其它的功能并且可以在代码块中使用.
`link` shortcode 可以使用以下命名参数:
* **href**
链接的目标.
* **content**
链接的内容 (允许 HTML 格式).
* **title**
HTML `a` 标签 的 `title` 属性, 当悬停在链接上会显示的提示.
* **rel**
HTML `a` 标签 的 `rel` 补充属性.
* **class**
HTML `a` 标签 的 `class` 属性.
#### 基本 `link`
一个基本的 `link` 示例:
```markdown
{{</* link "https://assemble.io" */>}}
或者
{{</* link href="https://assemble.io" */>}}
{{</* link "mailto:contact@revolunet.com" */>}}
或者
{{</* link href="mailto:contact@revolunet.com" */>}}
{{</* link "https://assemble.io" Assemble */>}}
或者
{{</* link href="https://assemble.io" content=Assemble */>}}
```
呈现的输出效果如下:
* {{< link "https://assemble.io" >}}
* {{< link "mailto:contact@revolunet.com" >}}
* {{< link "https://assemble.io" Assemble >}}
#### 添加一个标题
```markdown
{{</* link "https://github.com/upstage/" Upstage "Visit Upstage!" */>}}
或者
{{</* link href="https://github.com/upstage/" content=Upstage title="Visit Upstage!" */>}}
```
呈现的输出效果如下 (将鼠标悬停在链接上,会有一行提示):
{{< link "https://github.com/upstage/" Upstage "Visit Upstage!" >}}
### `image` ### `image`
`image` shortcode 是 [`figure` shortcode](#figure) 的替代. `image` shortcode 可以充分利用 [lazysizes](https://github.com/aFarkas/lazysizes) 和 [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js) 两个依赖库. `image` shortcode 是 [`figure` shortcode](#figure) 的替代. `image` shortcode 可以充分利用 [lazysizes](https://github.com/aFarkas/lazysizes) 和 [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js) 两个依赖库.
@@ -333,7 +400,7 @@ This is a right-aligned paragraph.
{{</* admonition type=tip title="This is a tip" details=true */>}} {{</* admonition type=tip title="This is a tip" details=true */>}}
一个 **技巧** 横幅 一个 **技巧** 横幅
{{</* /admonition */>}} {{</* /admonition */>}}
Or 或者
{{</* admonition tip "This is a tip" true */>}} {{</* admonition tip "This is a tip" true */>}}
一个 **技巧** 横幅 一个 **技巧** 横幅
{{</* /admonition */>}} {{</* /admonition */>}}
@@ -1016,7 +1083,7 @@ data = [
```markdown ```markdown
{{</* music auto="https://music.163.com/#/playlist?id=60198" */>}} {{</* music auto="https://music.163.com/#/playlist?id=60198" */>}}
Or 或者
{{</* music "https://music.163.com/#/playlist?id=60198" */>}} {{</* music "https://music.163.com/#/playlist?id=60198" */>}}
``` ```
@@ -1030,7 +1097,7 @@ Or
```markdown ```markdown
{{</* music server="netease" type="song" id="1868553" */>}} {{</* music server="netease" type="song" id="1868553" */>}}
Or 或者
{{</* music netease song 1868553 */>}} {{</* music netease song 1868553 */>}}
``` ```
@@ -1052,7 +1119,7 @@ https://www.bilibili.com/video/av47027633
```markdown ```markdown
{{</* bilibili 47027633 */>}} {{</* bilibili 47027633 */>}}
Or 或者
{{</* bilibili av=47027633 */>}} {{</* bilibili av=47027633 */>}}
``` ```
@@ -1070,7 +1137,7 @@ https://www.bilibili.com/video/av36570401?p=3
```markdown ```markdown
{{</* bilibili 36570401 3 */>}} {{</* bilibili 36570401 3 */>}}
Or 或者
{{</* bilibili av=36570401 p=3 */>}} {{</* bilibili av=36570401 p=3 */>}}
``` ```

View File

@@ -19,8 +19,8 @@
{{- $author := .Params.author | default .Site.Author.name | default (T "author") -}} {{- $author := .Params.author | default .Site.Author.name | default (T "author") -}}
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}} {{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
<span class="post-author"> <span class="post-author">
{{- $link := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}} {{- $options := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}}
{{- partial "plugin/link.html" $link -}} {{- partial "plugin/link.html" $options -}}
</span> </span>
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}} {{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}

View File

@@ -1,8 +1,9 @@
<a href="{{ .href | safeURL }}"{{ with .title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .href "http" }} target="_blank"{{ end }} rel="noopener noreffer{{ with .rel }} {{ . }}{{ end }}"{{ with .class }} class="{{ . }}"{{ end }}> {{- $rel := "" -}}
<a href="{{ .href | safeURL }}"{{ with .title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .href "http" }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .rel }} {{ . }}{{ end }}"{{ with .class }} class="{{ . }}"{{ end }}>
{{- with .icon -}} {{- with .icon -}}
{{- partial "plugin/icon.html" . -}} {{- partial "plugin/icon.html" . -}}
{{- end -}} {{- end -}}
{{- with .content -}} {{- with .content -}}
{{- . | safeHTML -}} {{- . | safeHTML -}}
{{- end -}} {{- end -}}
</a> </a>

View File

@@ -15,8 +15,8 @@
{{- $author := .Params.author | default .Site.Author.name | default (T "author") -}} {{- $author := .Params.author | default .Site.Author.name | default (T "author") -}}
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}} {{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
<span class="post-author"> <span class="post-author">
{{- $link := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}} {{- $options := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}}
{{- partial "plugin/link.html" $link -}} {{- partial "plugin/link.html" $options -}}
</span> </span>
{{- with .Params.categories -}} {{- with .Params.categories -}}

View File

@@ -0,0 +1,13 @@
{{- $options := dict -}}
{{- if .IsNamedParams -}}
{{- $options = dict "href" (.Get "href") | merge $options -}}
{{- $options = dict "title" (.Get "title") | merge $options -}}
{{- $options = dict "rel" (.Get "rel") | merge $options -}}
{{- $options = dict "class" (.Get "class") | merge $options -}}
{{- $options = dict "content" (.Get "content") | merge $options -}}
{{- else -}}
{{- $options = dict "href" (.Get 0) | merge $options -}}
{{- $options = dict "content" (.Get 1 | default (.Get 0)) | merge $options -}}
{{- $options = dict "title" (.Get 2) | merge $options -}}
{{- end -}}
{{- partial "plugin/link.html" $options -}}

View File

@@ -15,6 +15,7 @@
"scripts": { "scripts": {
"build": "npx babel src --out-file assets/js/theme.min.js --source-maps && hugo -v --source=exampleSite --themesDir=../.. -D --gc", "build": "npx babel src --out-file assets/js/theme.min.js --source-maps && hugo -v --source=exampleSite --themesDir=../.. -D --gc",
"start": "npm run build && hugo server --source=exampleSite --themesDir=../.. --disableFastRender", "start": "npm run build && hugo server --source=exampleSite --themesDir=../.. --disableFastRender",
"check": "htmlproofer exampleSite/public --check-html --allow-hash-href --empty-alt-ignore --disable-external",
"copy": "rm -rf resources && cp -rf exampleSite/resources resources" "copy": "rm -rf resources && cp -rf exampleSite/resources resources"
}, },
"husky": { "husky": {