From a108901c29e01e690f561c4c13ab44cde796a512 Mon Sep 17 00:00:00 2001 From: kitian616 Date: Sun, 22 Oct 2017 16:07:16 +0800 Subject: [PATCH] chore: review code --- README.md | 10 +- _config.test.yml | 19 +- _includes/blog/article-data.html | 15 +- _includes/blog/footer.html | 4 +- _includes/blog/header.html | 12 +- _includes/blog/license.html | 4 +- _includes/blog/tags.html | 56 +-- _includes/common-head.html | 2 +- _includes/head-icons-rel.html | 3 - _includes/info/follow-me.html | 99 +++-- _includes/utils/comment-disqus.html | 2 +- _layouts/all.html | 83 ++-- _layouts/blog-base.html | 4 +- _layouts/home.html | 110 +++-- _layouts/page.html | 4 +- _layouts/post.html | 37 +- _posts/2015-12-12-images-with-shadow.md | 4 +- _posts/2016-01-01-images.md | 4 +- _posts/2017-01-01-article-with-long-toc.md | 2 +- _posts/2017-01-03-article-with-lots-tags.md | 7 + _posts/2017-03-03-article-with-modify-date.md | 8 + _sass/base/_base.scss | 2 +- _sass/base/_links.scss | 136 ++---- _sass/blog/_layout.default.scss | 12 +- _sass/blog/_layout.page.scss | 7 +- _sass/blog/_layout.post.scss | 23 +- _sass/blog/_page.all.scss | 39 +- _sass/blog/_page.index.scss | 15 +- _sass/components/_article.content.scss | 20 +- _sass/components/_article.data.scss | 35 ++ _sass/components/_article.header.scss | 36 -- _sass/components/_follow-me.scss | 103 ++--- _sass/components/_footer.scss | 24 +- _sass/components/_header.scss | 36 +- _sass/components/_license.scss | 23 +- _sass/components/_pagination.scss | 30 +- _sass/components/_tags.scss | 45 +- _sass/components/_toc.scss | 2 +- _sass/components/_wrapper.scss | 9 + _sass/home/_page.home.scss | 67 --- _sass/mixins/_flex.scss | 394 ++++++++++++++++++ _sass/mixins/_link.scss | 58 ++- _sass/mixins/_transition.scss | 4 + _sass/settings/_base.scss | 2 +- statics/css/blog.scss | 4 +- statics/css/home.scss | 25 -- 46 files changed, 918 insertions(+), 722 deletions(-) create mode 100644 _posts/2017-01-03-article-with-lots-tags.md create mode 100644 _posts/2017-03-03-article-with-modify-date.md create mode 100644 _sass/components/_article.data.scss delete mode 100644 _sass/components/_article.header.scss delete mode 100644 _sass/home/_page.home.scss create mode 100644 _sass/mixins/_flex.scss create mode 100644 _sass/mixins/_transition.scss delete mode 100644 statics/css/home.scss diff --git a/README.md b/README.md index 70c626ceb1f..7cae0e98a31 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,9 @@ TeXt 是针对博客的一款简洁的主题,它虽然简洁但并不简单, ## How To Use -### 下载 +最简单的方法是直接 fork 到你的 GitHub 仓库然后更改其名称为 `.github.io`,稍等一会儿访问 `https://.github.io` 即可看到页面。接下来你可以在线修改 _config.yml 和 md 文件,或者把它 clone 到本地修改后提交。 -你可以在 [Releases 页面](https://github.com/kitian616/jekyll-TeXt-theme/releases)下载最新版本源码,或直接 clone 代码到本地。 - -当然,最简单的方法是直接 fork 到你的 GitHub 仓库然后更改其名称为 `.github.io`,稍等一会儿访问 `https://.github.io` 即可看到页面。接下来你可以在线修改 _config.yml 和 md 文件,或者把它 clone 到本地修改后提交。 +当然,你可以在 [Releases 页面](https://github.com/kitian616/jekyll-TeXt-theme/releases)下载最新版本源码,或直接 clone 代码到本地。 ### 配置 @@ -49,7 +47,7 @@ TeXt 是针对博客的一款简洁的主题,它虽然简洁但并不简单, 可以在头信息里设置文章的一些基本信息,包括标题、发布时间和标签等。当然,如果你不设置标题和发布时间,系统会使用文件名中的标题和发布时间,具体详见 [Jekyll: 头信息](http://jekyllcn.com/docs/frontmatter/)。当然,该主题在原有的基础上增加了一些属性,这在后面会讲到。 -需要注意的是,该主题的文章列表摘要会默认显示文章的所有内容。若只想显示部分内容,只需在想要显示到的地方加上 `` 行,具体详见 [Jekyll: 文章摘要](http://jekyll.com.cn/docs/posts/#_6)。 +需要注意的是,该主题的文章列表摘要会默认最多 200 个单词(汉字)的内容。若想控制摘要内容,需要在文章中想要显示到的地方加上 `` 行,具体详见 [Jekyll: 文章摘要](http://jekyll.com.cn/docs/posts/#_6)。 ### 安装环境(非必须) @@ -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 到其对应的分支上(如果以 `.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 到其对应的分支上(如果以 `.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/))。 当然你也可以部署到到其他地方。 diff --git a/_config.test.yml b/_config.test.yml index 671bdaae4b7..cac805513fb 100644 --- a/_config.test.yml +++ b/_config.test.yml @@ -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 @@ -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 diff --git a/_includes/blog/article-data.html b/_includes/blog/article-data.html index b357efb8a6a..a06d454499c 100644 --- a/_includes/blog/article-data.html +++ b/_includes/blog/article-data.html @@ -15,17 +15,18 @@ {% assign cur_page = page %} {% endif %} {% if cur_page.tags[0] %} -
+
+ {% endif %}
- {% if site.app_id and site.app_key and site.app_class %} -
- 0 - views | + {% if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class %} +
+ 0 views
{% endif %}
diff --git a/_includes/blog/footer.html b/_includes/blog/footer.html index 3a8cc268f3f..9df3fa8bc5c 100644 --- a/_includes/blog/footer.html +++ b/_includes/blog/footer.html @@ -5,7 +5,9 @@
diff --git a/_includes/blog/header.html b/_includes/blog/header.html index 8757babab2a..8aebb3222ff 100644 --- a/_includes/blog/header.html +++ b/_includes/blog/header.html @@ -5,14 +5,18 @@ -
diff --git a/_includes/common-head.html b/_includes/common-head.html index a6d665a446d..c4c0cbc3f9c 100644 --- a/_includes/common-head.html +++ b/_includes/common-head.html @@ -1,7 +1,7 @@ -{% if page.title %}{{ page.title }} - {{ site.title }}{% else %}{{ site.title }}{% endif %} +{% if page.title %}{{ page.title | truncatewords: 15 }} - {{ site.title }}{% else %}{{ site.title }}{% endif %} diff --git a/_includes/head-icons-rel.html b/_includes/head-icons-rel.html index 3caecf3d2ee..ad7656f0a79 100644 --- a/_includes/head-icons-rel.html +++ b/_includes/head-icons-rel.html @@ -2,20 +2,17 @@ for Safari on iOS https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/ --> - - - -
+
{% for post in site.posts %} {% assign currentdate = post.date | date: "%Y" %} {% if currentdate != date %} {% unless forloop.first %}
{% endunless %}
-

{{ currentdate }}

-
    +

    {{ currentdate }}

    +
      {% assign date = currentdate %} {% endif %} -
    • +
    • {{ post.title }}
    • {% if forloop.last %}
{% endif %} {% endfor %}
- +
- {% if site.isdebug == false %} + {% if ga_tracking_id and site.isdebug == false %} {% include utils/google-analytics.html %} {% endif %} diff --git a/_layouts/home.html b/_layouts/home.html index 89f1ade75ee..8ba6dd0d866 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -2,79 +2,75 @@ layout: blog-default title: Blog --- -
-
+
+
- {% for post in paginator.posts %} -
-

- {{ post.title }} -

-
- {{ post.excerpt }} -
- {% include blog/article-data.html %} -
+
+

+ {{ post.title }} +

+
+ {{ post.excerpt | truncatewords: 200 }} +
+ {% include blog/article-data.html %} +
{% endfor %}
- - {% if paginator.total_pages > 1 %} - {% endif %} -
+
- -{% if site.app_id and site.app_key and site.app_class and site.isdebug == false %} +{% if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class and site.isdebug == false %} -{% if page.key != null and site.app_id and site.app_key and site.app_class and site.isdebug == false %} +{% if page.key and site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class and site.isdebug == false %}