From 869c954f900975924af19b988d0d667a862cab7b Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Sun, 20 Mar 2022 12:44:26 +0800 Subject: [PATCH 1/3] minor modify readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15a59a8..5f928eb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
-Moments是一款专门为短博文设计的Hugo主题(插入链接)。开发初衷是在微信朋友圈之外做一个纯粹写给自己的,独立的短文/动态空间,去记录生活点滴,个人思绪,发现与想法。后面发现Moments的使用对象不仅仅可以是自己,还可以是一群人,你可以为是朋友、团队,亦或情侣搭建一个专有的Moments空间。 +Moments是一款专门为短博文设计的[Hugo](https://gohugo.io/)主题。开发初衷是在微信朋友圈之外做一个纯粹写给自己的,独立的短文/动态空间,去记录生活点滴,个人思绪,发现与想法。后面发现Moments的使用对象不仅仅可以是自己,还可以是一群人,你可以为是朋友、团队,亦或情侣搭建一个专有的Moments空间。 Moments is a hugo theme designed for micro-blogging. The original intention is to create a personal space for sharing daily life, thoughts, discoveries & ideas, outside Wechat. Later on, it came to my mind that Moments can be a sharing space not only for a single individual, but also for friends, teams or even couples. From 07d45aa32242e20af77d2cdb1f68d05266d62e29 Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Sun, 20 Mar 2022 12:58:34 +0800 Subject: [PATCH 2/3] NEW: add pangu.js support --- layouts/partials/after-content-js.html | 11 +++++++++++ layouts/partials/head.html | 9 +++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/layouts/partials/after-content-js.html b/layouts/partials/after-content-js.html index 85fba90..ff0c549 100644 --- a/layouts/partials/after-content-js.html +++ b/layouts/partials/after-content-js.html @@ -13,3 +13,14 @@ + + + \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 4a0b838..19f0004 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -7,7 +7,7 @@ - + @@ -41,5 +41,10 @@ + + + + -{{ .Site.Params.title }} \ No newline at end of file +{{ .Site.Params.title }} + From f6ca73459cbef379e44e76a04d45ce1e85584529 Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Fri, 25 Mar 2022 00:32:54 +0800 Subject: [PATCH 3/3] IMPROVEMENT make pangu optional & make hugo comments --- layouts/partials/after-content-js.html | 5 ++++- layouts/partials/head.html | 6 ++++-- layouts/partials/link-block.html | 28 +++++++++++++++++++------- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/layouts/partials/after-content-js.html b/layouts/partials/after-content-js.html index ff0c549..1ee3f17 100644 --- a/layouts/partials/after-content-js.html +++ b/layouts/partials/after-content-js.html @@ -14,6 +14,8 @@ +{{/* a pangu support */}} +{{ if .Site.Params.features.pangu }} \ No newline at end of file + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 19f0004..aaa271b 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -41,9 +41,11 @@ - - +{{/* pangu support: js in the end before the body closing tag */}} +{{ if .Site.Params.features.pangu }} + +{{ end }} {{ .Site.Params.title }} diff --git a/layouts/partials/link-block.html b/layouts/partials/link-block.html index 60d2bb1..3d4a9b9 100644 --- a/layouts/partials/link-block.html +++ b/layouts/partials/link-block.html @@ -1,39 +1,45 @@ +{{/* BEGIN parse the input parameter */}} +{{/* PART 1 default link */}} {{ $resource_type := "link" }} + {{ $logo_file := "default_link_logo.png" }} +{{/* 1.1 Wechat articles */}} {{ if eq 1 (len (findRE `(https?://)?mp\.weixin\.qq\.com([-a-zA-Z0-9()@:%\+.~#?&/=_]*)` .a)) }} {{ $logo_file = "wechat.png"}} {{ end }} +{{/* 1.2 Bilibili webpage */}} {{ if eq 1 (len (findRE `(https?://)?(www\.)?bilibili\.com/video/([-a-zA-Z0-9()@:%\+.~#?&/=_]*)` .a)) }} {{ $logo_file = "bilibili.png"}} {{ end }} +{{/* 1.3 github repo */}} {{ if eq 1 (len (findRE `(https?://)?(www\.)?github\.com([-a-zA-Z0-9()@:%\+.~#?&/=_]*)` .a)) }} {{ $logo_file = "github.png"}} {{ end }} +{{/* 1.4.1 zhihu answers */}} {{ if eq 1 (len (findRE `(https?://)?(www\.)?zhihu\.com/question/([0-9]*)/answer/[0-9]*` .a)) }} {{ $logo_file = "zhihu.svg"}} {{ end }} +{{/* 1.4.2 zhihu articles */}} {{ if eq 1 (len (findRE `(https?://)?zhuanlan\.zhihu\.com/p/([0-9]*)` .a)) }} {{ $logo_file = "zhihu.svg"}} {{ end }} +{{/* PART 2 other link type */}} +{{/* 2.1 netease music */}} {{ $netease_music_song_id := "0" }} {{ if eq 1 (len (findRE `(https?://)?music\.163\.com/song\?id=([0-9]*)([-a-zA-Z0-9()@:%\+.~#?&/=_]*)` .a)) }} {{ $resource_type = "netease_music" }} {{ $netease_music_song_id = replaceRE `(https?://)?music\.163\.com/song\?id=([0-9]*)([-a-zA-Z0-9()@:%\+.~#?&/=_]*)` "$2" .a }} {{ end }} -{{ if eq "netease_music" $resource_type}} - -{{ end }} +{{/* BEGIN generate output */}} +{{/* PART 1 default link */}} {{ if eq "link" $resource_type }} -{{ end }} \ No newline at end of file +{{ end }} + +{{/* PART 2 other link type */}} +{{ if eq "netease_music" $resource_type}} + +{{ end }}