Skip to content

Commit

Permalink
feat: update style, edit_on_github config
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Jun 23, 2018
1 parent 565ce72 commit 0c3c5e1
Show file tree
Hide file tree
Showing 92 changed files with 477 additions and 440 deletions.
2 changes: 0 additions & 2 deletions 404.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---
layout: 404
title: 404
show_title: false
---
10 changes: 4 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
source 'https://rubygems.org/'
source "https://rubygems.org"

gemspec
gem "github-pages", group: :jekyll_plugins

# For dev under windows, I know that yikes....

# gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
# gem 'wdm', '>= 0.1.0' if Gem.win_platform?
gem "tzinfo-data"
gem "wdm", "~> 0.1.0" if Gem.win_platform?
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TeXt is a Jekyll theme for personal site, blog, project, documentation and so on
- Search
- Page views ([LeanCloud](https://leancloud.cn/))
- Emoji ([Jemoji](https://github.com/jekyll/jemoji))
- Comment ([Disqus](https://disqus.com/))
- Comments ([Disqus](https://disqus.com/))
- Google Analytics
- Contact information (Email, Facebook, Twitter, Linkedin, Weibo, Zhihu, etc)
- Semantic HTML
Expand Down
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ defaults:
path: ""
type: posts
values:
layout: article
license: true
aside:
toc: true
show_edit_on_github: true
pageview: true


Expand Down
14 changes: 4 additions & 10 deletions _data/locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,11 @@ LICENSE_ANNOUNCE:
zh-Hans: "本文遵守 [LICENSE] 许可协议。"
zh-Hant: "本文遵守 [LICENSE] 許可協議。"

LICENSE_INTRO:
en:
zh: "欢迎转载,转载需注明出处,且禁止用于商业目的。"
zh-Hans: "欢迎转载,转载需注明出处,且禁止用于商业目的。"
zh-Hant: "歡迎轉載,轉載需註明出處,且禁止用於商業目的。"

POST_ON_GITHUB:
en: "View this POST on Github."
zh: "在 Github 上查阅此文。"
zh-Hans: "在 Github 上查阅此文。"
zh-Hant: "在 Github 上查閱此文。"
en: "Edit on Github"
zh: "在 Github 上修改"
zh-Hans: "在 Github 上修改"
zh-Hant: "在 Github 上修改"

FOLLOW_ME:
en: "Follow me on [NAME]."
Expand Down
13 changes: 8 additions & 5 deletions _data/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ default:
chart: false
toc:
selectors: 'h1,h2,h3'
show_title: true
show_header: true
full_width: false
pageview: false
excerpt_type: text
sources: bootcdn
excerpt_type: text

page:
show_header: true
show_title: true
show_edit_on_github: false
full_width: false
pageview: false

sources:
bootcdn:
Expand Down
6 changes: 3 additions & 3 deletions _includes/analytics-providers/google.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{%- if site.ga_tracking_id -%}
{%- if site.analytics.google.tracking_id -%}

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', '{{ site.ga_tracking_id }}', 'auto');
ga('create', '{{ site.analytics.google.tracking_id }}', 'auto');
ga('send', 'pageview');
{% if site.ga_anonymize_ip == true %}
{% if site.analytics.google.anonymize_ip == true %}
ga('set', 'anonymizeIp', true);
{% endif %}
</script>
Expand Down
8 changes: 6 additions & 2 deletions _includes/analytics.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{%- if jekyll.environment != "development" -%}
{%- include analytics-providers/google.html -%}
{%- if jekyll.environment != 'development' -%}
{%- if site.analytics.provider == 'google' -%}
{%- include analytics-providers/google.html -%}
{%- elsif site.analytics.provider == 'custom' -%}
{%- include analytics-providers/custom.html -%}
{%- endif -%}
{%- endif -%}
File renamed without changes.
14 changes: 14 additions & 0 deletions _includes/article-footer/license.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="license">
{%- assign locale = site.data.locale -%}
{%- assign __locale = locale.LICENSE_ANNOUNCE -%}
{%- include snippets/locale-to-string.html -%}
{%- assign _license_announce = __return -%}
{%- assign __path = '/assets/images/license-cc4.png' -%}
{%- include snippets/prepend-baseurl.html -%}
{%- assign _license_img_src = __return -%}
<p>{{ _license_announce | replace: "[LICENSE]", '<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">CC-BY-NC-4.0</a>' }}
<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">
<img alt="Creative Commons License" src="{{ _license_img_src }}" />
</a>
</p>
</div>
35 changes: 18 additions & 17 deletions _includes/article-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{%- include snippets/assign.html -%}
{%- assign _pageview = __return -%}

<div class="article-info clearfix">
<div class="article__info clearfix">
{%- if page -%}
<meta itemprop="author" itemscope itemtype="https://schema.org/Person">
{%- if page.author -%}
Expand All @@ -20,7 +20,7 @@
</meta>
{%- endif -%}
{%- if cur_page.tags[0] -%}
<ul class="article-info__left-col menu">
<ul class="left-col menu">
{%- if site.paths.all -%}
{%- assign all_path = site.paths.all -%}
{%- else -%}
Expand All @@ -36,29 +36,30 @@
{%- endfor -%}
</ul>
{%- endif -%}

{%- if (_pageview or post) and cur_page.date -%}
<ul class="article-info__right-col menu">
{%- if (_pageview or post) or cur_page.date -%}
<ul class="right-col menu">
{%- if _pageview or post -%}
{%- if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class -%}
{%- if site.pageview.provider -%}
{%- assign __locale = site.data.locale.VIEWS } -%}
{%- include snippets/locale-to-string.html -%}
<li class="pageview">
<span class="js-pageview" data-page-key="{{ cur_page.key }}">0</span> {{ __return }}
</li>
{%- endif -%}
{%- endif -%}
<li class="publish-date">
{%- assign __locale = site.data.locale.ARTICLE_DATE_FORMAT } -%}
{%- include snippets/locale-to-string.html -%}
{%- if post -%}
<span>{{ cur_page.date | date: __return }}</span>
{%- elsif page -%}
<time datetime="{{ page.date | date_to_xmlschema }}"
itemprop="datePublished">{{ cur_page.date | date: __return }}
</time>
{%- endif -%}
</li>
{%- if cur_page.date -%}
<li class="publish-date">
{%- assign __locale = site.data.locale.ARTICLE_DATE_FORMAT } -%}
{%- include snippets/locale-to-string.html -%}
{%- if post -%}
<span>{{ cur_page.date | date: __return }}</span>
{%- elsif page -%}
<time datetime="{{ page.date | date_to_xmlschema }}"
itemprop="datePublished">{{ cur_page.date | date: __return }}
</time>
{%- endif -%}
</li>
{%- endif -%}
</ul>
{%- endif -%}
</div>
9 changes: 0 additions & 9 deletions _includes/comment.html

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%- if page.key and
site.disqus.shortname -%}
site.comments.disqus.shortname -%}

<div id="disqus_thread"></div>
<script>
Expand All @@ -12,7 +12,7 @@
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{%- if page.key and
site.gitalk.clientID and
site.gitalk.clientSecret and
site.gitalk.repository and
site.gitalk.owner and
site.gitalk.admin -%}
site.comments.gitalk.clientID and
site.comments.gitalk.clientSecret and
site.comments.gitalk.repository and
site.comments.gitalk.owner and
site.comments.gitalk.admin -%}

{%- include snippets/get-sources.html -%}
{%- assign _sources = __return -%}
<div id="js-gitalk-container"></div>
{%- assign _admin = '' -%}
{%- for adminId in site.gitalk.admin -%}
{%- for adminId in site.comments.gitalk.admin -%}
{%- assign _admin = _admin | append: ", '" | append: adminId | append: "'" -%}
{%- endfor -%}
{%- assign last = _admin | size | minus: 1 -%}
Expand All @@ -18,10 +18,10 @@
window.Lazyload.css('{{ _sources.gitalk.css }}');
window.Lazyload.js('{{ _sources.gitalk.js }}', function() {
var gitalk = new Gitalk({
clientID: '{{ site.gitalk.clientID }}',
clientSecret: '{{ site.gitalk.clientSecret }}',
repo: '{{ site.gitalk.repository }}',
owner: '{{ site.gitalk.owner }}',
clientID: '{{ site.comments.gitalk.clientID }}',
clientSecret: '{{ site.comments.gitalk.clientSecret }}',
repo: '{{ site.comments.gitalk.repository }}',
owner: '{{ site.comments.gitalk.owner }}',
admin: [{{ _admin }}],
id: '{{ page.key }}'
});
Expand Down
10 changes: 10 additions & 0 deletions _includes/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{%- if jekyll.environment != 'development' -%}
{%- if site.comments.provider == 'disqus' -%}
{%- include comments-providers/disqus.html -%}
{%- elsif site.comments.provider == 'gitalk' -%}
{%- include comments-providers/gitalk.html -%}
{%- elsif site.comments.provider == 'custom' -%}
{%- include comments-providers/custom.html -%}
{%- endif -%}

{%- endif -%}
26 changes: 0 additions & 26 deletions _includes/license.html

This file was deleted.

Empty file.
Empty file.
6 changes: 3 additions & 3 deletions _includes/pageview-providers/leancloud/home.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{%- include snippets/get-sources.html -%}
{%- assign _sources = __return -%}

{%- assign _LEANCLOUD_APP_ID = site.leancloud.app_id -%}
{%- assign _LEANCLOUD_APP_KEY = site.leancloud.app_key -%}
{%- assign _LEANCLOUD_APP_CLASS = site.leancloud.app_class -%}
{%- assign _LEANCLOUD_APP_ID = site.pageview.leancloud.app_id -%}
{%- assign _LEANCLOUD_APP_KEY = site.pageview.leancloud.app_key -%}
{%- assign _LEANCLOUD_APP_CLASS = site.pageview.leancloud.app_class -%}

{%- if _LEANCLOUD_APP_ID and
_LEANCLOUD_APP_KEY and
Expand Down
6 changes: 3 additions & 3 deletions _includes/pageview-providers/leancloud/post.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{%- include snippets/get-sources.html -%}
{%- assign _sources = __return -%}

{%- assign _LEANCLOUD_APP_ID = site.leancloud.app_id -%}
{%- assign _LEANCLOUD_APP_KEY = site.leancloud.app_key -%}
{%- assign _LEANCLOUD_APP_CLASS = site.leancloud.app_class -%}
{%- assign _LEANCLOUD_APP_ID = site.pageview.leancloud.app_id -%}
{%- assign _LEANCLOUD_APP_KEY = site.pageview.leancloud.app_key -%}
{%- assign _LEANCLOUD_APP_CLASS = site.pageview.leancloud.app_class -%}

{%- if page.key and
_LEANCLOUD_APP_ID and
Expand Down
12 changes: 10 additions & 2 deletions _includes/pageview.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
{%- if page.layout == "home" -%}

{%- if jekyll.environment != "development" -%}
{%- include pageview-providers/leancloud/home.html -%}
{%- if site.pageview.provider == 'leancloud' -%}
{%- include pageview-providers/leancloud/home.html -%}
{%- elsif site.pageview.provider == 'custom' -%}
{%- include pageview-providers/custom/home.html -%}
{%- endif -%}
{%- endif -%}


Expand All @@ -16,7 +20,11 @@

{%- if jekyll.environment != "development" and
jekyll.environment != "beta" -%}
{%- include pageview-providers/leancloud/post.html -%}
{%- if site.pageview.provider == 'leancloud' -%}
{%- include pageview-providers/leancloud/post.html -%}
{%- elsif site.pageview.provider == 'custom' -%}
{%- include pageview-providers/custom/post.html -%}
{%- endif -%}
{%- endif -%}

{%- endif -%}
Expand Down
22 changes: 16 additions & 6 deletions _includes/snippets/page-title.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{%- assign __locale = page.titles -%}
{%- include snippets/locale-to-string.html -%}
{%- assign __localeTitle = __return -%}
{%- if page.title -%}
{%- assign __return = page.title -%}
{%- else -%}
{%- assign __source = page.title -%}
{%- assign __target = layout.title -%}
{%- include snippets/assign.html -%}
{%- assign _title = __return -%}

{%- assign __source = page.titles -%}
{%- assign __target = layout.titles -%}
{%- include snippets/assign.html -%}
{%- assign _titles = __return -%}

{%- if _title -%}
{%- assign __return = _title -%}
{%- elsif _titles -%}
{%- assign __locale = _titles -%}
{%- include snippets/locale-to-string.html -%}
{%- assign __localeTitle = __return -%}
{%- assign __return = __localeTitle -%}
{%- endif -%}
3 changes: 2 additions & 1 deletion _layouts/archive.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
layout: page
titles:
en: All Posts
en: Archive
zh: 归档
zh-Hans: 归档
zh-Hant: 歸檔
show_title: false
---

<div class="layout--all js-all">
<div class="search-box js-search-box">
<div class="icon-search"><i class="fas fa-search"></i></div>
Expand Down
Loading

0 comments on commit 0c3c5e1

Please sign in to comment.