Skip to content

Commit

Permalink
chore: review code
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Oct 22, 2017
1 parent c689338 commit a108901
Show file tree
Hide file tree
Showing 46 changed files with 918 additions and 722 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ TeXt 是针对博客的一款简洁的主题,它虽然简洁但并不简单,

## How To Use

### 下载
最简单的方法是直接 fork 到你的 GitHub 仓库然后更改其名称为 `<username>.github.io`,稍等一会儿访问 `https://<username>.github.io` 即可看到页面。接下来你可以在线修改 _config.yml 和 md 文件,或者把它 clone 到本地修改后提交。

你可以在 [Releases 页面](https://github.com/kitian616/jekyll-TeXt-theme/releases)下载最新版本源码,或直接 clone 代码到本地。

当然,最简单的方法是直接 fork 到你的 GitHub 仓库然后更改其名称为 `<username>.github.io`,稍等一会儿访问 `https://<username>.github.io` 即可看到页面。接下来你可以在线修改 _config.yml 和 md 文件,或者把它 clone 到本地修改后提交。
当然,你可以在 [Releases 页面](https://github.com/kitian616/jekyll-TeXt-theme/releases)下载最新版本源码,或直接 clone 代码到本地。

### 配置

Expand All @@ -49,7 +47,7 @@ TeXt 是针对博客的一款简洁的主题,它虽然简洁但并不简单,

可以在头信息里设置文章的一些基本信息,包括标题、发布时间和标签等。当然,如果你不设置标题和发布时间,系统会使用文件名中的标题和发布时间,具体详见 [Jekyll: 头信息](http://jekyllcn.com/docs/frontmatter/)。当然,该主题在原有的基础上增加了一些属性,这在后面会讲到。

需要注意的是,该主题的文章列表摘要会默认显示文章的所有内容。若只想显示部分内容,只需在想要显示到的地方加上 `<!--more-->` 行,具体详见 [Jekyll: 文章摘要](http://jekyll.com.cn/docs/posts/#_6)
需要注意的是,该主题的文章列表摘要会默认最多 200 个单词(汉字)的内容。若想控制摘要内容,需要在文章中想要显示到的地方加上 `<!--more-->` 行,具体详见 [Jekyll: 文章摘要](http://jekyll.com.cn/docs/posts/#_6)

### 安装环境(非必须)

Expand Down Expand Up @@ -83,7 +81,7 @@ bundle exec jekyll serve -H 0.0.0.0

推荐部署到 GitHub Pages 上,简单而免费,详见 [Jekyll: GitHub Pages](http://jekyllcn.com/docs/github-pages/)

如果你是下载或者 clone 的源码,那么你需要在 GitHub 上建立一个 Repository,然后把项目代码 push 到其对应的分支上(如果以 `<username>.github.io` 命名则对应分支为 `master` ,其他的为 `gh-pages`,详见 [Github Pages: Configuring a publishing source for GitHub Pages](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/)
如果你是下载或者 clone 的源码,那么你需要在 GitHub 上建立一个 Repository,然后把项目代码 push 到其对应的分支上(如果以 `<username>.github.io` 命名则对应分支为 `master` ,其他的为 `gh-pages`,详见 [Github Pages: Configuring a publishing source for GitHub Pages](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/)

当然你也可以部署到到其他地方。

Expand Down
19 changes: 10 additions & 9 deletions _config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ timezone: Asia/Shanghai
author: Someone
email: someone@mail.com #your Email address e.g. someone@site.com
facebook_username: someone #your Facebook username
# twitter_username: someone #your Twitter username
# github_username: someone #your GitHub username
# googleplus_username: someone #your Google+ username
# weibo_username: someone #your Weibo username
# douban_username: someone #your Douban username
# linkedin_username: someone #your Linkedin username
twitter_username: someone #your Twitter username
github_username: someone #your GitHub username
googleplus_username: someone #your Google+ username
weibo_username: someone #your Weibo username
douban_username: someone #your Douban username
linkedin_username: someone #your Linkedin username

## Comment system (Disqus) ##
# disqus_shortname: #the Disqus shortname for the site
Expand All @@ -42,9 +42,10 @@ facebook_username: someone #your Facebook username
# ga_tracking_id: #Google analytics id for the site

## Reading quantity (LeanCloud) ##
# app_id: #LeanCloud App id
# app_key: #LeanCloud App key
# app_class: #LeanCloud App class
leancloud:
app_id: '1110' #LeanCloud App id
app_key: 'qw12e' #LeanCloud App key
app_class: 'qqqq' #LeanCloud App class

## Paginate ##
paginate: 5
Expand Down
15 changes: 8 additions & 7 deletions _includes/blog/article-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
{% assign cur_page = page %}
{% endif %}
{% if cur_page.tags[0] %}
<div class="tag-wrapper">
<ul class="inline-list tag-wrapper">
{% for tag in cur_page.tags %}
<a class="article-tag round-rect-button" href="{{ "/all.html?tag=" |prepend: site.baseurl | append: tag | replace: '//', '/' }}"> {{ tag }} </a>
<li><a class="round-rect-button"
href="{{ "/all.html?tag=" |prepend: site.baseurl | append: tag | replace: '//', '/' }}">{{ tag }}
</a></li>
{% endfor %}
</div>
</ul>
{% endif %}
<div class="other-wrapper">
{% if site.app_id and site.app_key and site.app_class %}
<div class="view-wrapper clearfix">
<span class="article-view" id="post-key-{{ cur_page.key }}">0</span>
views |
{% if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class %}
<div class="view-wrapper">
<span class="article-view" id="post-key-{{ cur_page.key }}">0</span> views
</div>
{% endif %}
<div class="date-wrapper">
Expand Down
4 changes: 3 additions & 1 deletion _includes/blog/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
</aside>
<footer class="site-info">
<p>© {{ site.title }} 2015 - 2017</p>
<p>Powered by <a href="http://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/kitian616/jekyll-TeXt-theme">TeXt Theme</a>.</p>
<p>Powered by <a
title="Jekyll is a simple, blog-aware, static site generator." href="http://jekyllrb.com/">Jekyll</a> & <a
title="TeXt is a succinct theme for blogging." href="https://github.com/kitian616/jekyll-TeXt-theme">TeXt Theme</a>.
</p>
</footer>
</div>
Expand Down
12 changes: 8 additions & 4 deletions _includes/blog/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
<div class="site-logo">
{% include logo/logo.svg %}
</div>
<nav class="site-nav">
<ul class="clearfix">
<nav>
<ul class="inline-list">
<li><a href="{{ "/" | prepend: site.baseurl | replace: '//', '/' }}">Home</a></li>
<li><a href="{{ "/all.html" | prepend: site.blog.baseurl | prepend: site.baseurl | append: "?tag=" | replace: '//', '/'}}">All</a></li>
<li><a
href="{{ "/all.html" | prepend: site.blog.baseurl | prepend: site.baseurl | append: "?tag=" | replace: '//', '/'}}">All
</a></li>
{% for list in site.nav_lists %}
<li><a href="{{ list.url }}"> {{ list.title }} </a></li>
{% endfor %}
<li><a type="application/rss+xml" href="{{ "/feed.xml" | prepend: site.baseurl | replace: '//', '/'}}">RSS</a></li>
<li><a type="application/rss+xml"
href="{{ "/feed.xml" | prepend: site.baseurl | replace: '//', '/'}}">RSS
</a></li>
</ul>
</nav>
</header>
4 changes: 3 additions & 1 deletion _includes/blog/license.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
<p><a href="https://github.com/{{ site.github_username }}/{{ site.repository }}/tree/{{ site.repository_tree }}/{{ page.path }}">View this POST on Github</a>.</P>
{% endif %}
<p>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">CC-BY-NC-4.0</a> license.</p>
<a class="cc-license" rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons License"src="{{ "/statics/images/license-cc4.png" | prepend: site.baseurl | replace: '//', '/'}}" /></a>
<a class="license" rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">
<img alt="Creative Commons License" src="{{ '/statics/images/license-cc4.png' | prepend: site.baseurl | replace: '//', '/'}}" />
</a>
<p>欢迎转载,转载需注明出处:<a class="url" href="{% include snippets/page-url.html %}">
{% include snippets/page-url.html %}
</a>,且禁止用于商业目的。</p>
Expand Down
56 changes: 29 additions & 27 deletions _includes/blog/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,34 @@
{% assign gap_size = 1 %}
{% endif %}
<div class="m-tags">
<button type="button" class="article-tag tag-show-all round-rect-button" onclick="tagSelect('')">
Show All<div class="tag-count"> {{ site.posts | size }} </div>
</button>
{% for tag in site.tags %}
{% assign cur_size = tag[1].size %}
{% assign m1 = min_size %}
{% assign n1 = m1 | plus: gap_size %}
{% assign m2 = n1 %}
{% assign n2 = m2 | plus: gap_size %}
{% assign m3 = n2 %}
{% assign n3 = m3 | plus: gap_size %}
{% assign m4 = n3 %}
{% assign n4 = m4 | plus: gap_size %}
{% if cur_size >= m1 and cur_size < n1 %}
{% assign c_index = 1 %}
{% elsif cur_size >= m2 and cur_size < n2 %}
{% assign c_index = 2 %}
{% elsif cur_size >= m3 and cur_size < n3 %}
{% assign c_index = 3 %}
{% elsif cur_size >= m4 and cur_size < n4 %}
{% assign c_index = 4 %}
{% else %}
{% assign c_index = 4 %}
{% endif %}
<button type="button" class="article-tag tag-{{ tag[0] }} tag-{{ c_index }} tag-other round-rect-button" onclick="tagSelect('{{ tag[0] }}')">
<ul class="inline-list">
<li><button type="button" class="js-article-tag js-tag-show-all all round-rect-button" onclick="tagSelect('')">
Show All<div class="tag-count"> {{ site.posts | size }} </div>
</button></li>
{% for tag in site.tags %}
{% assign cur_size = tag[1].size %}
{% assign m1 = min_size %}
{% assign n1 = m1 | plus: gap_size %}
{% assign m2 = n1 %}
{% assign n2 = m2 | plus: gap_size %}
{% assign m3 = n2 %}
{% assign n3 = m3 | plus: gap_size %}
{% assign m4 = n3 %}
{% assign n4 = m4 | plus: gap_size %}
{% if cur_size >= m1 and cur_size < n1 %}
{% assign c_index = 1 %}
{% elsif cur_size >= m2 and cur_size < n2 %}
{% assign c_index = 2 %}
{% elsif cur_size >= m3 and cur_size < n3 %}
{% assign c_index = 3 %}
{% elsif cur_size >= m4 and cur_size < n4 %}
{% assign c_index = 4 %}
{% else %}
{% assign c_index = 4 %}
{% endif %}
<li><button type="button" class="js-article-tag tag-{{ tag[0] }} tag-{{ c_index }} round-rect-button" onclick="tagSelect('{{ tag[0] }}')">
{{ tag[0] | rstrip }}<div class="tag-count">{{ tag[1].size }}</div>
</button>
{% endfor %}
</button></li>
{% endfor %}
</ul>
</div>
2 changes: 1 addition & 1 deletion _includes/common-head.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>{% if page.title %}{{ page.title }} - {{ site.title }}{% else %}{{ site.title }}{% endif %}</title>
<title>{% if page.title %}{{ page.title | truncatewords: 15 }} - {{ site.title }}{% else %}{{ site.title }}{% endif %}</title>
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
<link rel="canonical" href="{% include snippets/page-url.html %}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{% include snippets/rss-url.html %}">
3 changes: 0 additions & 3 deletions _includes/head-icons-rel.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@
for Safari on iOS
https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/
-->

<link rel="apple-touch-icon" sizes="180x180" href="/statics/images/logo/icon-180x180.png">
<link rel="apple-touch-icon" sizes="167x167" href="/statics/images/logo/icon-167x167.png">
<link rel="apple-touch-icon" sizes="152x152" href="/statics/images/logo/icon-152x152.png">
<link rel="apple-touch-icon" sizes="120x120" href="/statics/images/logo/icon-120x120.png">
<link rel="shortcut icon" href="/statics/images/logo/icon-120x120.png">

<!--
for Chrome on Android
https://developer.chrome.com/multidevice/android/installtohomescreen
-->
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="192x192" href="/statics/images/logo/icon-192x192.png">

<!--
for Edge on Windows 10
https://msdn.microsoft.com/en-us/library/dn255024(v=vs.85).aspx
Expand Down
99 changes: 53 additions & 46 deletions _includes/info/follow-me.html
Original file line number Diff line number Diff line change
@@ -1,67 +1,74 @@
<div class="follow-me">
<ul class="clearfix" itemscope itemtype="http://schema.org/Person">
<ul class="inline-list" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="{{ site.author }}">
<link itemprop="url" href="{{ '/' | prepend: site.url }}">
{% if site.email %}
<li class="round-button mail" title="Send me e-mail.">
<a itemprop="sameAs" href="mailto:://{{ site.email }}" target="_blank">
<div class="icon">{% include icon/mail.svg %}</div>
</a>
</li>
{% endif %}
{% if site.weibo_username %}
<li class="round-button weibo" title="Follow me on Weibo.">
<a itemprop="sameAs" href="https://weibo.com/{{ site.weibo_username }}" target="_blank">
<div class="icon">{% include icon/social/weibo.svg %}</div>
</a>
</li>
<li title="Follow me on Weibo.">
<div class="round-button weibo">
<a itemprop="sameAs" href="https://weibo.com/{{ site.weibo_username }}" target="_blank">
<div class="icon">{% include icon/social/weibo.svg %}</div>
</a>
</div>
</li>
{% endif %}
{% if site.facebook_username %}
<li class="round-button facebook" title="Follow me on Facebook.">
<a itemprop="sameAs" href="https://www.facebook.com/{{ site.facebook_username }}" target="_blank">
<div class="icon">{% include icon/social/facebook.svg %}</div>
</a>
</li>
<li title="Follow me on Facebook.">
<div class="round-button facebook">
<a itemprop="sameAs" href="https://www.facebook.com/{{ site.facebook_username }}" target="_blank">
<div class="icon">{% include icon/social/facebook.svg %}</div>
</a>
</div>
</li>
{% endif %}
{% if site.twitter_username %}
<li class="round-button twitter" title="Follow me on Twitter.">
<a itemprop="sameAs" href="https://twitter.com/{{ site.twitter_username }}" target="_blank">
<div class="icon">{% include icon/social/twitter.svg %}</div>
</a>
</li>
<li title="Follow me on Twitter.">
<div class="round-button twitter">
<a itemprop="sameAs" href="https://twitter.com/{{ site.twitter_username }}" target="_blank">
<div class="icon">{% include icon/social/twitter.svg %}</div>
</a>
</div>
</li>
{% endif %}
{% if site.googleplus_username %}
<li class="round-button googlepluse" title="Follow me on Google+.">
<a itemprop="sameAs" href="https://plus.google.com/u/0/{{ site.googleplus_username }}" target="_blank">
<div class="icon">{% include icon/social/googleplus.svg %}</div>
</a>
</li>
<li title="Follow me on Google+.">
<div class="round-button googlepluse">
<a itemprop="sameAs" href="https://plus.google.com/u/0/{{ site.googleplus_username }}" target="_blank">
<div class="icon">{% include icon/social/googleplus.svg %}</div>
</a>
</div>
</li>
{% endif %}
{% if site.github_username %}
<li class="round-button github" title="Follow me on Github.">
<a itemprop="sameAs" href="https://github.com/{{ site.github_username }}" target="_blank">
<div class="icon">{% include icon/social/github.svg %}</div>
</a>
</li>
<li title="Follow me on Github.">
<div class="round-button github">
<a itemprop="sameAs" href="https://github.com/{{ site.github_username }}" target="_blank">
<div class="icon">{% include icon/social/github.svg %}</div>
</a>
</div>
</li>
{% endif %}
{% if site.linkedin_username %}
<li class="round-button linkedin" title="Follow me on Linkedin.">
<a itemprop="sameAs" href="https://www.linkedin.com/in/{{ site.linkedin_username }}" target="_blank">
<div class="icon">{% include icon/social/linkedin.svg %}</div>
</a>
</li>
<li title="Follow me on Linkedin.">
<div class="round-button linkedin">
<a itemprop="sameAs" href="https://www.linkedin.com/in/{{ site.linkedin_username }}" target="_blank">
<div class="icon">{% include icon/social/linkedin.svg %}</div>
</a>
</div>
</li>
{% endif %}
{% if site.douban_username %}
<li class="round-button douban" title="Follow me on Douban.">
<a itemprop="sameAs" href="https://www.douban.com/people/{{ site.douban_username }}" target="_blank">
<div class="icon">{% include icon/social/douban.svg %}</div>
</a>
</li>
<li title="Follow me on Douban.">
<div class="round-button douban">
<a itemprop="sameAs" href="https://www.douban.com/people/{{ site.douban_username }}" target="_blank">
<div class="icon">{% include icon/social/douban.svg %}</div>
</a>
</div>
</li>
{% endif %}
</ul>
{% if site.email %}
<p class="email">
<a title="Send me e-mail." href="mailto:{{ site.email }}" target="_self"> {{ site.email }} </a>
</p>
<p class="email">
<a title="Send me Email." href="mailto:{{ site.email }}" target="_self"> {{ site.email }} </a>
</p>
{% endif %}
</div>
2 changes: 1 addition & 1 deletion _includes/utils/comment-disqus.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if site.disqus_shortname and page.key != null %}
{% if site.disqus_shortname and page.key %}
<div id="disqus_thread"></div>
<script>

Expand Down
Loading

0 comments on commit a108901

Please sign in to comment.