mirror of
https://github.com/flysnow-org/maupassant-hugo.git
synced 2026-08-24 07:18:55 +00:00
增加waline评论系统;支持从首页隐藏某些文章 (#149)
* Update README * 增加从首页隐藏选项 * 可根据设置隐藏文章 * 增加Waline评论系统
This commit is contained in:
@@ -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
|
||||
+++
|
||||
|
||||
```
|
||||
|
||||
## 贡献
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,4 +5,5 @@ categories=[]
|
||||
date="{{ .Date }}"
|
||||
toc=true
|
||||
draft=true
|
||||
hiddenFromHomePage= false
|
||||
+++
|
||||
|
||||
@@ -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 国际许可协议"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div class="res-cons">
|
||||
{{- $paginator := .Paginate (where .Site.RegularPages "Type" "in" (slice "post" "posts")) }}
|
||||
{{ range $index,$data := $paginator.Pages }}
|
||||
{{if not .Params.hiddenFromHomePage }}
|
||||
<article class="post">
|
||||
<header>
|
||||
<h1 class="post-title">
|
||||
@@ -25,6 +26,7 @@
|
||||
<p class="readmore"><a href="{{ .Permalink }}">阅读全文</a></p>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ partial "paginator" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -13,4 +13,16 @@
|
||||
</script>
|
||||
</div>
|
||||
{{ end }}
|
||||
<!--waline-->
|
||||
{{ if .Site.Params.waline.enable }}
|
||||
<div id="waline"></div>
|
||||
<script src="//cdn.jsdelivr.net/npm/@waline/client"></script>
|
||||
<script>
|
||||
Waline({
|
||||
el: '#waline',
|
||||
serverURL: '{{ .Site.Params.waline.serverURL }}',
|
||||
placeholder: '{{ .Site.Params.waline.placeholder }}',
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user