From 1d4222ed2f8c7a2e71be14522c7e90037b149f28 Mon Sep 17 00:00:00 2001 From: Qutue <61310881+Qutue@users.noreply.github.com> Date: Sun, 17 Apr 2022 21:03:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0waline=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=EF=BC=9B=E6=94=AF=E6=8C=81=E4=BB=8E=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E9=9A=90=E8=97=8F=E6=9F=90=E4=BA=9B=E6=96=87=E7=AB=A0?= =?UTF-8?q?=20(#149)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update README * 增加从首页隐藏选项 * 可根据设置隐藏文章 * 增加Waline评论系统 --- README.md | 32 +++++++++++++++++++++++++++++++- README_EN.md | 26 ++++++++++++++++++++++++++ archetypes/default.md | 1 + exampleSite/config.toml | 6 +++++- layouts/index.html | 4 +++- layouts/partials/comments.html | 14 +++++++++++++- 6 files changed, 79 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 60404f8..fe4be63 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Maupassant theme, ported to Hugo. 15. See Also 支持 16. Disqus评论支持 18. 自定义css、js -19. utteranc评论 +19. utteranc和[waline](https://waline.js.org)评论 20. 部分自定义的shortcode 21. 文章自定义摘要 22. 自定义广告支持 @@ -295,6 +295,18 @@ summaryLength = 140 3. `title` 按页面title标题的方式。 其他还有几个不常用,这里就不再赘述了。 +#### Waline 评论系统 +Waline一款从 Valine 衍生的带后端评论系统。快速、安全、免费部署、支持评论通知。详见[https://waline.js.org/](https://waline.js.org/) + +将```enable```值改为```true```即可启用 + +```serverURL```可根据官网部署教程获取 +```toml +[params.waline] + enable = false + placeholder = "说点什么吧..." + serverURL = "Your waline serverURL" #换成你的serverURL +``` #### 不蒜子页面计数器支持 @@ -445,6 +457,24 @@ disablePathToLower = true } ​``` ``` +#### 支持在首页上隐藏某篇文章 + +将 front matter 中的```hiddenFromHomePage```设置为```true``` 即可 + + *默认为```false```* + +```toml ++++ +title = '{{ replace .Name "-" " " | title }}' +tags = [] +categories = [] +date = "{{ .Date }}" +toc = true +draft = true +hiddenFromHomePage = false ++++ + +``` ## 贡献 diff --git a/README_EN.md b/README_EN.md index 14debfd..b61ae77 100644 --- a/README_EN.md +++ b/README_EN.md @@ -138,6 +138,32 @@ summaryLength = 140 ```toml disqusShortname = "yourdiscussshortname" +``` +#### Waline comment system +See [https://waline.js.org/](https://waline.js.org/) + +```toml +[params.waline] + enable = false + placeholder = "说点什么吧..." + serverURL = "Your waline serverURL" +``` + +#### Hide some articles on the homepage + +Change the value of ```hiddenFromHomePage``` to ```true``` to enable + +```toml ++++ +title = '{{ replace .Name "-" " " | title }}' +tags = [] +categories = [] +date = "{{ .Date }}" +toc = true +draft = true +hiddenFromHomePage = false ++++ + ``` #### Page View Support diff --git a/archetypes/default.md b/archetypes/default.md index 5117679..ea415ed 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -5,4 +5,5 @@ categories=[] date="{{ .Date }}" toc=true draft=true +hiddenFromHomePage= false +++ diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 0a27042..5f5a731 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -67,7 +67,11 @@ disqusShortname = "yourdiscussshortname" ## 是否开启disqus评论,不要 repo = "your github repo" ##换成自己得 issueTerm = "pathname" theme = "github-light" - +## 配置 waline 评论系统,教程参考 https://waline.js.org/ +[params.waline] + enable = false + placeholder = "说点什么吧..." + serverURL = "Your waline serverURL" #换成你的serverURL ## 开启版权声明,协议名字和链接都可以换 [params.cc] name = "知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议" diff --git a/layouts/index.html b/layouts/index.html index 9793057..468b9ea 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,6 +2,7 @@
{{- $paginator := .Paginate (where .Site.RegularPages "Type" "in" (slice "post" "posts")) }} {{ range $index,$data := $paginator.Pages }} + {{if not .Params.hiddenFromHomePage }}

@@ -25,6 +26,7 @@

阅读全文

{{ end }} + {{ end }} {{ partial "paginator" . }}
-{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 7cfb1bd..9fe0e49 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -13,4 +13,16 @@ {{ end }} -{{- end }} \ No newline at end of file + + {{ if .Site.Params.waline.enable }} +
+ + + {{ end }} +{{- end }}