本文为了防止在代码块中的短代码被 Hugo 转译,在代码块中添加了 \
,请在使用时去除
Notice
感谢:martignoni & 荷戟独彷徨
配置
- 在
/layouts/shortcodes
创建notice.html
并填入以下代码:
{{- $noticeType := .Get 0 -}}
{{- $raw := (markdownify .Inner | chomp) -}}
{{- $block := findRE "(?is)^<(?:address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h(?:1|2|3|4|5|6)|header|hgroup|hr|li|main|nav|noscript|ol|output|p|pre|section|table|tfoot|ul|video)\\b" $raw 1 -}}
{{ $icon := (replace (index $.Site.Data.SVG $noticeType) "icon" "icon notice-icon") }}
<div class="notice {{ $noticeType }}" {{ if len .Params | eq 2 }} id="{{ .Get 1 }}" {{ end }}>
<div class="notice-title">{{ $icon | safeHTML }}</div>
{{- if or $block (not $raw) }}{{ $raw }}{{ else }}<p>{{ $raw }}</p>{{ end -}}
</div>
- 在
/assets/scss/custom.scss
中添加自定义 CSS 样式:
// notice 短代码
.notice {
position:relative;
padding: 1em 1em 1em 2.5em;
margin-bottom: 1em;
border-radius: 4px;
p:last-child {
margin-bottom: 0;
}
.notice-title {
position: absolute;
left: 0.8em;
.notice-icon {
width: 1.2em;
height: 1.2em;
}
}
&.notice-warning {
background: hsla(0, 65%, 65%, 0.15);
border-left: 5px solid hsl(0, 65%, 65%);
.notice-title {
color: hsl(0, 65%, 65%);
}
}
&.notice-info {
background: hsla(30, 80%, 70%, 0.15);
border-left: 5px solid hsl(30, 80%, 70%);
.notice-title {
color: hsl(30, 80%, 70%);
}
}
&.notice-note {
background: hsla(200, 65%, 65%, 0.15);
border-left: 5px solid hsl(200, 65%, 65%);
.notice-title {
color: hsl(200, 65%, 65%);
}
}
&.notice-tip {
background: hsla(140, 65%, 65%, 0.15);
border-left: 5px solid hsl(140, 65%, 65%);
.notice-title {
color: hsl(140, 65%, 65%);
}
}
}
[data-theme="dark"] .notice {
&.notice-warning {
background: hsla(0, 25%, 35%, 0.15);
border-left: 5px solid hsl(0, 25%, 35%);
.notice-title {
color: hsl(0, 25%, 35%);
}
}
&.notice-info {
background: hsla(30, 25%, 35%, 0.15);
border-left: 5px solid hsl(30, 25%, 35%);
.notice-title {
color: hsl(30, 25%, 35%);
}
}
&.notice-note {
background: hsla(200, 25%, 35%, 0.15);
border-left: 5px solid hsl(200, 25%, 35%);
.notice-title {
color: hsl(200, 25%, 35%);
}
}
&.notice-tip {
background: hsla(140, 25%, 35%, 0.15);
border-left: 5px solid hsl(140, 25%, 35%);
.notice-title {
color: hsl(140, 25%, 35%);
}
}
}
- 在
~/data/SVG.toml
中插入图标:
# Notice Icon
notice-warning = '<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 576 512" fill="#704343"><path d="M570 440c18 32-5 72-42 72H48c-37 0-60-40-42-72L246 24c19-32 65-32 84 0l240 416zm-282-86a46 46 0 100 92 46 46 0 000-92zm-44-165l8 136c0 6 5 11 12 11h48c7 0 12-5 12-11l8-136c0-7-5-13-12-13h-64c-7 0-12 6-12 13z"/></svg>'
notice-info = '<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" fill="#705943"><path d="M256 8a248 248 0 100 496 248 248 0 000-496zm0 110a42 42 0 110 84 42 42 0 010-84zm56 254c0 7-5 12-12 12h-88c-7 0-12-5-12-12v-24c0-7 5-12 12-12h12v-64h-12c-7 0-12-5-12-12v-24c0-7 5-12 12-12h64c7 0 12 5 12 12v100h12c7 0 12 5 12 12v24z"/></svg>'
notice-note = '<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" fill="#436170"><path d="M504 256a248 248 0 11-496 0 248 248 0 01496 0zm-248 50a46 46 0 100 92 46 46 0 000-92zm-44-165l8 136c0 6 5 11 12 11h48c7 0 12-5 12-11l8-136c0-7-5-13-12-13h-64c-7 0-12 6-12 13z"/></svg>'
notice-tip = '<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" fill="#437052"><path d="M504 256a248 248 0 11-496 0 248 248 0 01496 0zM227 387l184-184c7-6 7-16 0-22l-22-23c-7-6-17-6-23 0L216 308l-70-70c-6-6-16-6-23 0l-22 23c-7 6-7 16 0 22l104 104c6 7 16 7 22 0z"/></svg>'
若为 ~/data/SVG.yaml
则填入:
# Notice Icon
notice-warning : '<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 576 512" fill="#704343"><path d="M570 440c18 32-5 72-42 72H48c-37 0-60-40-42-72L246 24c19-32 65-32 84 0l240 416zm-282-86a46 46 0 100 92 46 46 0 000-92zm-44-165l8 136c0 6 5 11 12 11h48c7 0 12-5 12-11l8-136c0-7-5-13-12-13h-64c-7 0-12 6-12 13z"/></svg>'
notice-info : '<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" fill="#705943"><path d="M256 8a248 248 0 100 496 248 248 0 000-496zm0 110a42 42 0 110 84 42 42 0 010-84zm56 254c0 7-5 12-12 12h-88c-7 0-12-5-12-12v-24c0-7 5-12 12-12h12v-64h-12c-7 0-12-5-12-12v-24c0-7 5-12 12-12h64c7 0 12 5 12 12v100h12c7 0 12 5 12 12v24z"/></svg>'
notice-note : '<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" fill="#436170"><path d="M504 256a248 248 0 11-496 0 248 248 0 01496 0zm-248 50a46 46 0 100 92 46 46 0 000-92zm-44-165l8 136c0 6 5 11 12 11h48c7 0 12-5 12-11l8-136c0-7-5-13-12-13h-64c-7 0-12 6-12 13z"/></svg>'
notice-tip : '<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" fill="#437052"><path d="M504 256a248 248 0 11-496 0 248 248 0 01496 0zM227 387l184-184c7-6 7-16 0-22l-22-23c-7-6-17-6-23 0L216 308l-70-70c-6-6-16-6-23 0l-22 23c-7 6-7 16 0 22l104 104c6 7 16 7 22 0z"/></svg>'
使用
{\{< notice notice-warning >}}
你好。
{\{< /notice >}}
{\{< notice notice-info >}}
你好。
{\{< /notice >}}
{\{< notice notice-note >}}
你好。
{\{< /notice >}}
{\{< notice notice-tip >}}
你好。
{\{< /notice >}}
你好。
你好。
你好。
你好。
Details
配置
在 /layouts/shortcodes
创建 detail.html
并填入以下代码:
<details>
<summary>{{ (.Get 0) | markdownify }}</summary>
{{ .Inner | markdownify }}
</details>
使用
{\{< detail "点这里看隐藏内容!" >}}
这里是隐藏内容!🥰
{\{< /detail >}}
点这里看隐藏内容!
这里是隐藏内容!🥰聊天气泡
感谢:Yelle🦋
配置
在 /layouts/shortcodes
创建 chat.html
并填入以下代码:
{{ if eq (.Get "position") "left" }}
<div class="chat --other">
<div class="chat__inner">
<div class="chat__meta">{{ .Get "name" }} {{ .Get "timestamp" }}</div>
<div class="chat__text">
{{ .Inner }}
</div>
</div>
</div>
{{ else if eq (.Get "position") "right" }}
<div class="chat --self">
<div class="chat__inner">
<div class="chat__meta" style="text-align: right;">{{ .Get "timestamp" }} {{ .Get "name" }}</div>
<div class="chat__text">
{{ .Inner }}
</div>
</div>
</div>
{{ end }}
<style>
.chat {
margin: 10px;
padding: 10px;
position: relative;
/* 添加相对定位,以便定位尖角箭头 */
transition: transform 0.2s;
/* 添加过渡效果,使放大平滑 */
max-width: 80%;
min-width: 15%;
}
.chat:hover {
transform: scale(1.05);
}
.chat.--self {
text-align: left;
background-color: #ecf5ff;
color: #000000;
border-radius: 15px;
width: fit-content;
margin-left: auto;
}
/* 尖角箭头 */
.chat.--self::before {
content: "";
position: absolute;
right: -18px;
/* 调整箭头位置 */
bottom: 5px;
transform: translateY(-50%);
border-width: 15px 0 0 20px;
border-style: solid;
border-color: transparent transparent transparent #ecf5ff;
/* 箭头颜色与对话框背景颜色一致 */
}
/* 左边对话框样式 */
.chat.--other {
text-align: left;
background-color: #ffecec;
color: #333;
border-radius: 15px;
position: relative;
width: fit-content;
}
/* 左边对话框的尖角箭头 */
.chat.--other::before {
content: "";
position: absolute;
left: -18px;
bottom: 5px;
transform: translateY(-50%);
border-width: 15px 20px 0 0;
border-style: solid;
border-color: transparent #ffecec transparent transparent;
}
/* 消息元数据样式(名称和时间戳) */
.chat__meta {
font-weight: bold;
font-size: 0.67em;
color: #707070;
margin-bottom: 5px;
}
/* 消息文本样式 */
.chat__text {
font-size: 0.9em;
margin-left: 10px;
word-break: break-all;
}
[data-scheme="dark"] {
.chat.--self {
color: #fefefe;
background-color: #253958;
}
.chat.--self::before {
border-color: transparent transparent transparent #253958;
}
.chat.--other {
color: #fefefe;
background-color: #1a1a1a;
}
.chat.--other::before {
border-color: transparent #1a1a1a transparent transparent;
}
.chat__meta {
color: #b1b1b1;
}
}
</style>
使用
{\{< chat position="left" name="John Doe" timestamp="2023-09-12 14:30">}\}
这是左边的消息内容。
{\{< /chat >}\}
{\{< chat position="right" name="Alice" timestamp="2023-09-12 14:45" >}\}
这是右边的消息内容,测试长长长长长长长长长长长长长长长长长长长长长长长长度。
{\{< /chat >}\}
时间轴
感谢:Yelle🦋
配置
在 /layouts/shortcodes
创建 timeline.html
并填入以下代码:
{{- $date := .Get "date" -}} {{- $title := .Get "title" -}} {{- $description := .Get "description" -}} {{- $tags := .Get "tags" -}}{{- $url := .Get "url" -}}
<div class="timeline__row">
<div class="timeline__time">
<div class="timeline__time">{{ $date }}</div>
<div class="timeline__split-line"></div>
</div>
<div class="timeline__content">
<div class="timeline__tags">
{{- with split $tags ", " -}} {{- range . }}{{- if eq . "样式" }}
<span class="timeline__tag timeline__tag-style">{{ . }}</span> {{- else if eq . "文章" }}
<span class="timeline__tag timeline__tag-article">{{ . }}</span> {{- else if eq . "页面" }}
<span class="timeline__tag timeline__tag-page">{{ . }}</span> {{- else }}
<span class="timeline__tag">{{ . }}</span> {{- end }} {{- end }} {{- end }}
</div>
<a href="{{ $url }}">
<div class="timeline__title">{{ $title }}</div>
</a>
<!-- title 可点击,默认就是跳转时间轴所在页 -->
<div class="timeline__description">
{{ $description }}
</div>
</div>
</div>
<style>
.timeline {
display: flex;
flex-direction: column;
}
.timeline__row {
display: flex;
padding-left: 4%;
height: 90px;
}
.timeline__time {
flex: 0 0 110px;
color: #5d5d5d;
font-size: 17px;
text-transform: uppercase;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
padding: 0.5rem 0;
}
.timeline__time-text {
margin: 0;
}
.timeline__split-line {
position: absolute;
top: 0.5rem;
right: -20px;
height: 100%;
width: 2px;
background-color: #84c4e240;
z-index: 0;
}
.timeline__split-line:before {
content: "";
position: absolute;
top: 24%;
right: -4px;
transform: translateY(-50%);
width: 10px;
height: 10px;
background-color: #c9e5f2;
box-shadow: 0 0 0 4px var(--theme);
border-radius: 50%;
border: 0px solid #84c4e2;
z-index: -1;
}
.timeline__content {
flex: 1;
margin-left: 4.5rem;
padding: 0.5rem 0 1.2rem 0;
}
.timeline__title {
margin: 0;
margin-bottom: 2px;
padding-top: 3px;
margin-left: 0.5rem;
color: var(--content);
font-family: var(--font-family-teshu);
font-size: 19px;
font-weight: 600;
width: fit-content;
display: inline-block;
vertical-align: middle;
/* 垂直居中对齐 */
}
.timeline__tags {
display: inline-block;
padding: 0;
margin-left: 0.3rem;
align-items: center;
gap: 0.3rem;
}
.timeline__tag {
display: inline-block;
color: var(--secondary);
background-color: #84c4e230;
border: 1.5px solid #84c4e230;
border-radius: 999px;
padding: 0rem 0.5rem;
font-size: 12px;
white-space: nowrap;
line-height: 1.4rem;
opacity: 0.8;
vertical-align: middle;
/* 垂直居中对齐 */
}
.timeline__description {
font-size: 15px;
line-height: 1.6;
color: #5d5d5d;
overflow: hidden;
text-overflow: ellipsis;
margin: 0.5rem 0 0.4rem 1.5rem;
/* 添加 1.5rem 的左侧内边距 */
}
/* 为类名为 "timeline__tag-style" 的标签定义颜色 */
.timeline__tag-style {
background-color: #c581da;
/* 替换为你希望的颜色 */
border-color: #c581da;
/* 与背景色相同或不同,根据需要自定义 */
color: #FFFFFF;
/* 根据需要选择文本颜色 */
}
/* 为类名为 "timeline__tag-article" 的标签定义颜色 */
.timeline__tag-article {
background-color: #92d392;
/* 替换为你希望的颜色 */
border-color: #92d392;
/* 与背景色相同或不同,根据需要自定义 */
color: #000000;
/* 根据需要选择文本颜色 */
}
/* 为类名为 "timeline__tag-page" 的标签定义颜色 */
.timeline__tag-page {
background-color: #707070;
/* 替换为你希望的颜色 */
border-color: #707070;
/* 与背景色相同或不同,根据需要自定义 */
color: #FFFFFF;
/* 根据需要选择文本颜色 */
}
@media screen and (max-width: 768px) {
.timeline__time {
font-size: 14px;
/* 在小屏幕上使用较小的字体大小 */
}
.timeline__title {
font-size: 16px;
/* 在小屏幕上使用较小的字体大小 */
}
.timeline__description {
font-size: 14px;
/* 在小屏幕上使用较小的字体大小 */
}
}
</style>
使用
{\{< timeline date="2023-10-01" title="国庆节" description="祖国生日快乐" tags="节日" url="" >}\}
NeoDB
感谢:木木木木木
配置
在 /layouts/shortcodes
创建 neodb.html
并填入以下代码:
{{ $dbUrl := .Get 0 }}
{{ $dbApiUrl := "https://neodb.social/api/" }}
{{ $dbType := "" }}
{{ if ( findRE `^.*neodb\.social\/.*` $dbUrl ) }}
{{ $dbType = replaceRE `.*neodb.social\/(.*\/.*)` "$1" $dbUrl }}
{{ else }}
{{ $dbType = $dbUrl }}
{{ $dbApiUrl = "https://neodb.social/api/catalog/fetch?url=" }}
{{ end }}
{{ $dbFetch := getJSON $dbApiUrl $dbType }}
{{ if $dbFetch }}
{{ $itemRating := 0 }}{{ with $dbFetch.rating }}{{ $itemRating = . }}{{ end }}
<div class="db-card">
<div class="db-card-subject">
<div class="db-card-post"><img loading="lazy" decoding="async" referrerpolicy="no-referrer" src="{{ $dbFetch.cover_image_url }}"></div>
<div class="db-card-content">
<div class="db-card-title"><a href="{{ $dbUrl }}" class="cute" target="_blank" rel="noreferrer">{{ $dbFetch.title }}</a></div>
<div class="rating"><span class="allstardark"><span class="allstarlight" style="width:{{mul 10 $itemRating }}%"></span></span><span class="rating_nums">{{ $itemRating }}</span></div>
<div class="db-card-abstract">{{ $dbFetch.brief }}</div>
</div>
<div class="db-card-cate">{{ $dbFetch.category }}</div>
</div>
</div>
{{else}}
<p style="text-align: center;"><small>远程获取内容失败,请检查 API 有效性。</small></p>
{{end}}
在 /assets/scss/custom.scss
中填入以下代码:
/*neodb*/
.db-card {
margin: 2rem 3rem;
background: #33669930;
border-radius: 8px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.25);
}
.db-card-subject {
display: flex;
align-items: flex-start;
line-height: 1.6;
padding: 12px;
position: relative
}
.dark-mode .db-card {
background: #252627
}
.db-card-content {
flex: 1 1 auto
}
.db-card-post {
width: 96px;
margin-right: 15px;
display: flex;
flex: 0 0 auto
}
.db-card-title {
margin-bottom: 5px;
font-size: 18px
}
.db-card-title a {
text-decoration: none!important
}
.db-card-abstract,
.db-card-comment {
font-size: 14px;
overflow: hidden;
max-height: 3rem
}
.db-card-cate {
position: absolute;
top: 0;
right: 0;
background: #f99b0170;
padding: 1px 8px;
font-size: small;
font-style: italic;
border-radius: 0 8px 0 8px;
text-transform: capitalize
}
.db-card-post img {
width: 96px!important;
height: 96px!important;
border-radius: 4px;
-o-object-fit: cover;
object-fit: cover
}
.rating {
margin: 0 0 5px;
font-size: 13px;
line-height: 1;
display: flex;
align-items: center
}
.rating .allstardark {
position: relative;
color: #f99b01;
height: 16px;
width: 80px;
background-size: auto 100%;
margin-right: 8px;
background-repeat: repeat;
background-image: url(data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiPjxwYXRoIGQ9Ik05MDguMSAzNTMuMWwtMjUzLjktMzYuOUw1NDAuNyA4Ni4xYy0zLjEtNi4zLTguMi0xMS40LTE0LjUtMTQuNS0xNS44LTcuOC0zNS0xLjMtNDIuOSAxNC41TDM2OS44IDMxNi4ybC0yNTMuOSAzNi45Yy03IDEtMTMuNCA0LjMtMTguMyA5LjMtMTIuMyAxMi43LTEyLjEgMzIuOS42IDQ1LjNsMTgzLjcgMTc5LjEtNDMuNCAyNTIuOWMtMS4yIDYuOS0uMSAxNC4xIDMuMiAyMC4zIDguMiAxNS42IDI3LjYgMjEuNyA0My4yIDEzLjRMNTEyIDc1NGwyMjcuMSAxMTkuNGM2LjIgMy4zIDEzLjQgNC40IDIwLjMgMy4yIDE3LjQtMyAyOS4xLTE5LjUgMjYuMS0zNi45bC00My40LTI1Mi45IDE4My43LTE3OS4xYzUtNC45IDguMy0xMS4zIDkuMy0xOC4zIDIuNy0xNy41LTkuNS0zMy43LTI3LTM2LjN6TTY2NC44IDU2MS42bDM2LjEgMjEwLjNMNTEyIDY3Mi43IDMyMy4xIDc3MmwzNi4xLTIxMC4zLTE1Mi44LTE0OUw0MTcuNiAzODIgNTEyIDE5MC43IDYwNi40IDM4MmwyMTEuMiAzMC43LTE1Mi44IDE0OC45eiIgZmlsbD0iI2Y5OWIwMSIvPjwvc3ZnPg==)
}
.rating .allstarlight {
position: absolute;
left: 0;
color: #f99b01;
height: 16px;
overflow: hidden;
background-size: auto 100%;
background-repeat: repeat;
background-image: url(data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiPjxwYXRoIGQ9Ik05MDguMSAzNTMuMWwtMjUzLjktMzYuOUw1NDAuNyA4Ni4xYy0zLjEtNi4zLTguMi0xMS40LTE0LjUtMTQuNS0xNS44LTcuOC0zNS0xLjMtNDIuOSAxNC41TDM2OS44IDMxNi4ybC0yNTMuOSAzNi45Yy03IDEtMTMuNCA0LjMtMTguMyA5LjMtMTIuMyAxMi43LTEyLjEgMzIuOS42IDQ1LjNsMTgzLjcgMTc5LjEtNDMuNCAyNTIuOWMtMS4yIDYuOS0uMSAxNC4xIDMuMiAyMC4zIDguMiAxNS42IDI3LjYgMjEuNyA0My4yIDEzLjRMNTEyIDc1NGwyMjcuMSAxMTkuNGM2LjIgMy4zIDEzLjQgNC40IDIwLjMgMy4yIDE3LjQtMyAyOS4xLTE5LjUgMjYuMS0zNi45bC00My40LTI1Mi45IDE4My43LTE3OS4xYzUtNC45IDguMy0xMS4zIDkuMy0xOC4zIDIuNy0xNy41LTkuNS0zMy43LTI3LTM2LjN6IiBmaWxsPSIjZjk5YjAxIi8+PC9zdmc+)
}
@media(max-width: 550px) {
.db-card {
margin: .8rem 1rem
}
.db-card-comment {
display: none
}
}
使用
{\{< neodb "NeoDB 网址/豆瓣网址" >}\}
友链
配置
在 /layouts/shortcodes
创建 friend.html
并填入以下代码:
{{- $name := .Get "name" | default (.Get 0) -}}
{{- $url := .Get "url" | default (.Get 1) -}}
{{- $avatar := .Get "avatar" | default (.Get 2) -}}
{{- $bio := .Get "bio" | default (.Get 3) -}}
<a href="{{- $url -}}" title="{{- $name -}}" class="friend-link" target="_blank" rel="friend">
<div class="friend-link-div">
<div class="friend-link-avatar">
<img src={{ .Get "avatar" }} class="friend-avatar" loading="lazy" alt="Avatar">
</div>
<div class="friend-link-info">
<i class="fa fa-link" aria-hidden="true"></i>
<i class="friend-name">{{ $name }}</i>
<p class="friend-bio">{{ $bio }}</p>
</div>
</div>
</a>
在 /assets/scss/custom.scss
中用 @import "partials/layout/links.scss";
引入 scss
在 /assets/scss
创建 links.scss
并填入以下代码:
// 头像边框颜色
$avatar-border-color: #566a82;
$avatar-border-color-dark: #C0C0C0;
// style-card 背景色
$friend-link-background-color: #51a8ca10;
$friend-link-background-color-dark: #69697141;
// 友链 name 原始色
$friend-link-color: #11a1a2;
$friend-link-color-dark: #ffffff;
// 友链 name 气泡响应对比色
$friend-link-hover-color: #ea4e2f;
$friend-link-hover-color-dark: rgb(241, 213, 159);
// bio 简介上下文
$context-color: #404040;
$context-color-dark: #c0c0c0;
// 友链头像及头像边框的样式
.friend-avatar {
width: 56px;
height: 56px;
padding: 2px;
margin-top: 14px;
margin-left: 14px;
border-radius: 15px;
border: 3.6px inset $avatar-border-color;
[data-scheme=dark] & {
border: 3.6px inset $avatar-border-color-dark;
}
}
.friend-link-div {
// 实现卡片双栏排列效果
height: auto;
margin-top: auto;
margin-inline-start: 4.5%;
width: 43%;
display: inline-block !important;
// 控制上下连续排列的卡片之间的行距
margin-bottom: 11px;
// 卡片圆角
border-radius: 7px 7px 7px 7px;
// 卡片阴影
-webkit-box-shadow: 0px 14px 32px 0px rgba(231, 224, 224, 0.15);
-moz-box-shadow: 0px 14px 32px 0px rgba(0, 0, 0, 0.15);
box-shadow: 0.7px 1px 6px 0px rgba(0, 0, 0, 0.16);
// 卡片背景色
background: $friend-link-background-color;
[data-scheme=dark] & {
background: $friend-link-background-color-dark;
}
// 卡牌气泡响应动画
-webkit-transition: transform 0.4s ease;
-moz-transition: transform 0.4s ease;
-o-transition: transform 0.4s ease;
transition: transform 0.15s ease;
&:hover {
transform: scale(1.03);
}
}
.friend-link-avatar {
width: 92px;
float: left;
margin-right: 2px;
}
// name 特效样式, hover 气泡效果,友链 name 变色
.friend-link-info {
margin-top: 13px;
margin-right: 18px;
color: $friend-link-color;
[data-scheme=dark] & {
color: $friend-link-color-dark;
}
&:hover {
color: $friend-link-hover-color;
[data-scheme=dark] & {
color: $friend-link-hover-color-dark;
}
}
}
// name 文字样式
.friend-name {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-style: normal;
font-family: 'Comic Sans MS', cursive;
font-size: 16px;
}
// bio 文字样式
.friend-bio {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
margin-top: auto;
// font: 12px/1 Tahoma,Helvetica,Arial,"\5b8b\4f53",sans-serif;
font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;
font-size: 14px;
color: $context-color;
[data-scheme=dark] & {
color: $context-color-dark;
}
}
// 响应式页面,允许根据不同的尺寸调整样式
@media screen and (max-width: 720px) {
.friend-link-div {
width: 92%;
margin-right: auto;
}
.friend-bio {
margin: auto;
align-content: center;
justify-content: left;
}
.friend-link-avatar {
width: 84px;
margin: auto;
}
// .friend-link-info {
// height: 100%;
// margin: auto;
// display: flex;
// align-items: center;
// justify-content: left;
// }
.friend-name {
font-size: 14px;
font-style: normal;
font-family: 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;
}
}
使用
{\{< friend name="名称" url="网址" avatar="头像" bio="简介" >}}
块引用
感谢:Jimmy
配置
在 /layouts/shortcodes
创建 quote.html
并填入以下代码:
<blockquote>
<p>{{ .Inner | markdownify }}</p>
{{- if or (.Get "author") (.Get "source") -}}
<span class="cite"><span>― </span>
{{- if .Get "author" -}}
<span>
{{- .Get "author" -}}{{- if .Get "source" -}}, {{ end -}}
</span>
{{- end -}}
{{- with .Get "url" -}}<a href="{{ . }}">{{- end -}}
<cite>{{ .Get "source" }}</cite>
{{- if .Get "url" -}}</a>{{- end -}}
</span>
{{- end -}}
</blockquote>
使用
{\{< quote author="作者/说话的人" source="书名/来源" url="链接(可选)" >}}
内容
{\{< /quote >}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
― A famous person, The book he wrote
哔哩哔哩
配置
在 /layouts/shortcodes
创建 bilibili.html
并填入以下代码:
{{ $vid := (.Get 0) }}
{{ $videopage := default 1 (.Get 1) }}
{{ $basicQuery := querify "page" $videopage "high_quality" 1 "as_wide" 1 }}
{{ $videoQuery := "" }}
{{ if strings.HasPrefix (lower $vid) "av" }}
{{ $videoQuery = querify "aid" (strings.TrimPrefix "av" (lower $vid)) }}
{{ else if strings.HasPrefix (lower $vid) "bv" }}
{{ $videoQuery = querify "bvid" $vid }}
{{ else }}
<p>Bilibili 视频av号或BV号错误!请检查视频av号或BV号是否正确</p>
<p>当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}</p>
{{ end }}
<div class="video-wrapper">
<iframe src="https://player.bilibili.com/player.html?{{ $basicQuery | safeURL }}&{{ $videoQuery | safeURL }}"
scrolling="no"
frameborder="no"
framespacing="0"
allowfullscreen="true"
>
</iframe>
</div>
使用
{\{< bilibili VIDEO_ID PART_NUMBER >}\}
Video_ID
:AV
或BV
PART_NUMBER
(可选):指定要播放的视频序号
腾讯视频
感谢:Jimmy
配置
在 /layouts/shortcodes
创建 tencent.html
并填入以下代码:
{{ $vid := .Get 0 }}
<div class="video-wrapper">
<iframe src="https://v.qq.com/txp/iframe/player.html?vid={{ $vid }}&auto=0"
scrolling="no"
frameborder="no"
framespacing="0"
allowfullscreen="true"
>
</iframe>
</div>
使用
{\{< tencent VIDEO_ID >}\}