Skip to content

Commit

Permalink
opti: default variables config
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Jan 27, 2018
1 parent 0d8cf7c commit dd51ad3
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rvm:
branches:
only:
- master
script: bundle exec jekyll build --config ./_config.demo.yml
script: JEKYLL_ENV=production bundle exec jekyll build --config ./_config.demo.yml
deploy:
provider: pages
skip_cleanup: true
Expand Down
5 changes: 1 addition & 4 deletions _config.demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,4 @@ plugins:
- jemoji

## Server ##
server_url: "0.0.0.0"

## Development ##
isdebug: false
server_url: "0.0.0.0"
19 changes: 8 additions & 11 deletions _config.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# config file for development, DELETE IT IF YOU WANT.

text_color_theme: default #eg: default | dark | forest | ocean | chocolate | orange
# text_color_theme: default #eg: default | dark | forest | ocean | chocolate | orange
## Base settings ##
# url: #the base hostname & protocol for your site e.g. https://www.someone.com

Expand All @@ -33,17 +33,17 @@ nav_lists:
url: https://www.baidu.com

paths:
base: /
home: /
all: /all.html
rss: /feed.xml
# base: /
# home: /
# all: /all.html
# rss: /feed.xml

## GitHub repository (if the site is hosted by GitHub) ##
repository: someone/someone.github.io
repository_tree: master

## Language & timezone ##
lang: en #the language of your site, eg: en(English), zh(简体中文), zh-Hans(简体中文), zh-Hant(繁體中文)
# lang: en #the language of your site, eg: en(English), zh(简体中文), zh-Hans(简体中文), zh-Hant(繁體中文)
timezone: Asia/Shanghai #see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for the available values

## Author & social ##
Expand All @@ -60,7 +60,7 @@ author:

## TOC
toc:
selectors: 'h1,h2,h3,h4,h5,h6'
# selectors: 'h1,h2,h3,h4,h5,h6'

## Comment system (Disqus) ##
disqus:
Expand Down Expand Up @@ -126,7 +126,4 @@ plugins:
- jemoji

## Server ##
server_url: "0.0.0.0"

## Development ##
isdebug: false
server_url: "0.0.0.0"
5 changes: 1 addition & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,4 @@ plugins:
- jemoji

## Server ##
server_url: "0.0.0.0"

## Development ##
isdebug: false
server_url: "0.0.0.0"
10 changes: 8 additions & 2 deletions _data/locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ READMORE:
zh-Hans: "点我阅读更多..."
zh-Hant: "「點我閱讀更多」"

COPYRIGHT_DATES: "2018"
VIEWS:
en: "views"
zh: "阅读"
zh-Hans: "阅读"
zh-Hant: "閱讀"

LAST_UPDATED:
en: "Last updated"
Expand Down Expand Up @@ -75,4 +79,6 @@ EMAIL_ME:
en: "Send me Email."
zh: "给我发邮件。"
zh-Hans: "给我发邮件。"
zh-Hant: "給我發郵件。"
zh-Hant: "給我發郵件。"

COPYRIGHT_DATES: "2018"
10 changes: 10 additions & 0 deletions _data/variables.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
default:
text_color_theme: default
paths:
base: /
home: /
all: /all.html
rss: /feed.xml
lang: zh
toc:
selectors: 'h1,h2,h3'
4 changes: 3 additions & 1 deletion _includes/components/article-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
{%- endif -%}
<div class="other-wrapper">
{%- if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class -%}
{%- assign __locale = site.data.locale.VIEWS } -%}
{%- include snippets/locale-to-string.html -%}
<div class="view-wrapper">
<span class="article-view" id="post-key-{{ cur_page.key }}">0
</span> views
</span> {{ __return }}
</div>
{%- endif -%}
<div class="date-wrapper">
Expand Down
24 changes: 4 additions & 20 deletions _includes/components/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,21 @@
<div class="main clearfix">
<div class='site-logo'>
{%- include logo/logo.svg -%}
{%- if site.paths.base -%}
{%- assign __path = site.paths.base -%}
{%- else -%}
{%- assign __path = '/' -%}
{%- endif -%}
{%- assign __path = site.paths.base | default: site.data.variables.default.paths.base -%}
{%- include snippets/get-nav-url.html -%}
{%- if site.title -%}
<a title="{%- if site.description -%}{{ site.description }}{%- endif -%}" href="{{ __return }}">{{ site.title }}</a>
{%- endif -%}
</div>
<nav>
<ul>
{%- if site.paths.home -%}
{%- assign __path = site.paths.home -%}
{%- else -%}
{%- assign __path = '/' -%}
{%- endif -%}
{%- assign __path = site.paths.home | default: site.data.variables.default.paths.home -%}
{%- include snippets/get-nav-url.html -%}
{%- assign href = __return -%}
{%- assign __locale = site.data.locale.NAV.HOME -%}
{%- include snippets/locale-to-string.html -%}
<li><a href="{{ href }}">{{ __return }}</a></li>
{%- if site.paths.all -%}
{%- assign __path = site.paths.all -%}
{%- else -%}
{%- assign __path = '/all.html' -%}
{%- endif -%}
{%- assign __path = site.paths.all | default: site.data.variables.default.paths.all -%}
{%- include snippets/get-nav-url.html -%}
{%- assign href = __return -%}
{%- assign __locale = site.data.locale.NAV.ALL -%}
Expand All @@ -42,11 +30,7 @@
{%- include snippets/locale-to-string.html -%}
<li><a href="{{ href }}">{%- if list.title -%}{{ list.title }}{%- else -%}{{ __return }}{%- endif -%}</a></li>
{%- endfor -%}
{%- if site.paths.rss -%}
{%- assign __path = site.paths.rss -%}
{%- else -%}
{%- assign __path = '/feed.xml' -%}
{%- endif -%}
{%- assign __path = site.paths.rss | default: site.data.variables.default.paths.rss -%}
{%- include snippets/get-nav-url.html -%}
{%- assign href = __return -%}
{%- assign __locale = site.data.locale.NAV.RSS -%}
Expand Down
4 changes: 2 additions & 2 deletions _includes/snippets/get-lang.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{%- assign __return = '' -%}
{%- assign __return = site.data.variables.default.lang -%}
{%- if page.lang -%}
{%- assign __return = page.lang -%}
{%- else -%}
{%- elsif site.lang -%}
{%- assign __return = site.lang -%}
{%- endif -%}
2 changes: 1 addition & 1 deletion _layouts/blog-base.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</script>
{%- include utils/mathjax.html -%}
{%- include utils/mermaid.html -%}
{%- if site.isdebug == false -%}
{%- if jekyll.environment != "development" -%}
{%- include utils/google-analytics.html -%}
{%- endif -%}
</body>
Expand Down
2 changes: 1 addition & 1 deletion _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ <h1><a href="{{ href }}">{{ post.title }}</a></h1>
{%- endif -%}
</div>
</div>
{%- if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class and site.isdebug == false -%}
{%- if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class and jekyll.environment != "development" -%}
<script src="//cdn1.lncld.net/static/js/3.4.1/av-min.js"></script>
<script>
$(function() {
Expand Down
7 changes: 2 additions & 5 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ <h1 itemprop="headline" itemprop="name headline">{{ __return }}</h1>
</div>
</div>
</div>
{%- assign _toc_selectors = site.toc.selectors -%}
{%- if _toc_selectors == nil -%}
{%- assign _toc_selectors = 'h1,h2,h3' -%}
{%- endif -%}
{%- assign _toc_selectors = site.toc.selectors | default: site.data.variables.default.toc.selectors -%}
<script src="//cdn.bootcss.com/toc/0.3.2/toc.min.js"></script>
<script type="text/javascript">
window.throttle = function(func, wait) {
Expand Down Expand Up @@ -150,7 +147,7 @@ <h1 itemprop="headline" itemprop="name headline">{{ __return }}</h1>
});
});
</script>
{%- if page.key and site.leancloud.app_id and site.leancloud.app_key and site.leancloud.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 jekyll.environment != "development" -%}
<script src="//cdn1.lncld.net/static/js/3.4.1/av-min.js"></script>
<script type="text/javascript">
$(function() {
Expand Down
2 changes: 1 addition & 1 deletion assets/css/blog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@charset "utf-8";

@import
"colors/{{ site.text_color_theme | default: 'default' }}",
"colors/{{ site.text_color_theme | default: site.data.variables.default.text_color_theme }}",

"common/variables",
"common/highlighting",
Expand Down
3 changes: 0 additions & 3 deletions test/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,3 @@ gems:

## Server ##
server_url: "0.0.0.0"

## Development ##
isdebug: false

0 comments on commit dd51ad3

Please sign in to comment.