Skip to content

Commit

Permalink
SeeAlso支持;Disqus支持;修复代码显示不全问题;增加更多的代码高亮语言支持
Browse files Browse the repository at this point in the history
  • Loading branch information
flysnoworg committed Aug 3, 2018
1 parent b072847 commit e53765e
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 95 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ theme = "maupassant"
googleAnalytics = "GA ID"
```

#### Disqus

```toml
disqusShortname = "yourdiscussshortname"
```

## Contributing

All kinds of contributions (enhancements, new features, documentation & code improvements, issues & bugs reporting) are welcome.
Expand Down
17 changes: 16 additions & 1 deletion README_Zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ Maupassant theme, ported to Hugo.
7. 自定义友情链接支持
8. 支持文章按年份日期进行归档
9. 支持GA分析统计
10. 支持关键字SEO优化
10. sitemap站点地图
11. 代码高亮
12. 404错误页
13. 支持关键字SEO优化
14. Google站内搜索
15. See Also 支持
16. Disqus评论支持

## 下载安装

Expand Down Expand Up @@ -121,6 +126,16 @@ type: archives

`content/archives/index.md`表示在`content/archives/`目录下的`index.md`文件

#### Disqus

该支持主持Disqus评论,如果要启用Disqus,可以在`config.toml`里添加如下配置即可.

```toml
disqusShortname = "yourdiscussshortname"
```

替换成你自己的Disqus名字即可。

#### 禁止分类的名称转为小写

我们在写文章的时候,会给文章进行分类,比如Golang,但是默认情况下,Hugo会把这个Golang转为小写,
Expand Down
12 changes: 2 additions & 10 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ <h1 class="post-title">{{ .Title }}</h1>
{{ .Content }}
</div>

{{ partial "related" . }}

<div class="post-meta meta-tags">
{{ if and (isset .Params "tags") .Params.tags }}
<ul class="clearfix">
Expand All @@ -39,16 +41,6 @@ <h1 class="post-title">{{ .Title }}</h1>
没有标签
{{ end }}
</div>
{{ if eq .Type "post" }}
<div class="post-nav">
{{if .NextInSection}}
<a href="{{.NextInSection.Permalink}}" class="pre">{{.NextInSection.Title}}</a>
{{end}}
{{if .PrevInSection}}
<a href="{{.PrevInSection.Permalink}}" class="next">{{.PrevInSection.Title}}</a>
{{end}}
</div>
{{ end }}
</article>
{{ partial "comments" . }}
</div>
Expand Down
1 change: 1 addition & 0 deletions layouts/partials/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ template "_internal/disqus.html" . }}
11 changes: 11 additions & 0 deletions layouts/partials/related.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<div class="post-archive">
<h2>See Also</h2>
<ul class="listing">
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</div>
{{ end }}
44 changes: 1 addition & 43 deletions static/css/prism.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism-coy&languages=markup+css+clike+javascript+c+bash+cpp+coffeescript+ruby+diff+docker+markup-templating+erlang+git+go+groovy+less+haskell+java+json+kotlin+markdown+lua+makefile+nginx+objectivec+php+python+r+swift+yaml+vim&plugins=line-numbers+highlight-keywords */
https://prismjs.com/download.html#themes=prism-coy&languages=markup+css+clike+javascript+c+csharp+bash+basic+cpp+coffeescript+clojure+ruby+diff+docker+markup-templating+erlang+git+go+groovy+less+haskell+java+json+kotlin+markdown+lua+makefile+nginx+objectivec+perl+php+php-extras+sql+python+r+jsx+typescript+rust+scala+plsql+swift+yaml+tsx+vbnet+vim&plugins=highlight-keywords */
/**
* prism.js Coy theme for JavaScript, CoffeeScript, CSS and HTML
* Based on https://github.com/tshedor/workshop-wp-theme (Example: http://workshop.kansan.com/category/sessions/basics or http://workshop.timshedor.com/category/sessions/basics);
Expand Down Expand Up @@ -226,45 +226,3 @@ pre .line-highlight {
margin-top: 0;
}

pre[class*="language-"].line-numbers {
position: relative;
padding-left: 3.8em;
counter-reset: linenumber;
}

pre[class*="language-"].line-numbers > code {
position: relative;
white-space: inherit;
}

.line-numbers .line-numbers-rows {
position: absolute;
pointer-events: none;
top: 0;
font-size: 100%;
left: -3.8em;
width: 3em; /* works for line-numbers below 1000 lines */
letter-spacing: -1px;
border-right: 1px solid #999;

-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;

}

.line-numbers-rows > span {
pointer-events: none;
display: block;
counter-increment: linenumber;
}

.line-numbers-rows > span:before {
content: counter(linenumber);
color: #999;
display: block;
padding-right: 0.8em;
text-align: right;
}

42 changes: 3 additions & 39 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,11 @@ textarea {
.post-content h3,.post-content h2{
margin: 1.4em 0 1.1em;
}
.post-content pre, .comment-content pre {
/* .post-content pre, .comment-content pre {
max-height: 320px;
}
} */
.post-content pre, .comment-content pre {
padding: 1.5em 2em;
padding: 1em 1.5em;
}
.post-content p code, .comment-content p code {
display:inline;
Expand Down Expand Up @@ -897,42 +897,6 @@ img.alignright {
display: block;
}

/* post navigator*/
.post-nav {
overflow: hidden;
margin-top: 15px;
margin-bottom: 20px;
padding: 10px;
white-space: nowrap;
border-top: 1px solid #eee;
}
.post-nav a {
display: inline-block;
line-height: 25px;
font-size: 15px;
color: #555;
border-bottom: none;
float: left;
}
.post-nav a.pre {
float: left;
}
.post-nav a.pre:before {
content: "\ea23";
padding-right: 0.3em;
}
.post-nav a.next {
float: right;
}
.post-nav a.next:after {
content: "\ea24";
padding-left: 0.3em;
}
.post-nav a:hover {
border-bottom: none;
color: #222;
}

/* for archive page starts*/
.post-archive {
font-size: 15px;
Expand Down
Loading

0 comments on commit e53765e

Please sign in to comment.