Skip to content

Commit

Permalink
fix: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Jun 30, 2018
1 parent dad73fd commit 49e5180
Show file tree
Hide file tree
Showing 36 changed files with 528 additions and 364 deletions.
12 changes: 7 additions & 5 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ repository_tree: master
## => Paths
##############################
paths:
base : # "/"" (default)
root : # title link url, "/" (default)
home : # home layout url, "/" (default)
archive : # "/archive.html" (default)
rss : # "/feed.xml" (default)

Expand All @@ -75,16 +76,17 @@ license: CC-BY-NC-4.0 # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4
toc:
selectors: # "h1,h2,h3" (default)

## Markdown Enhancements

# Mathjax
## => Markdown Enhancements
##############################
## Mathjax
mathjax: # false (default), true
mathjax_autoNumber: # false (default), true

# Mermaid
## Mermaid
mermaid: # false (default), true

# Chart
## Chart
chart: # false (default), true


Expand Down
3 changes: 2 additions & 1 deletion _data/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ default:
text_color_theme: default
lang: en
paths:
base: /
root: /
home: /
archive: /archive.html
rss: /feed.xml
mathjax: false
Expand Down
1 change: 1 addition & 0 deletions _includes/article-footer/custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- this will show at every article content's bottom -->
63 changes: 39 additions & 24 deletions _includes/article-info.html
Original file line number Diff line number Diff line change
@@ -1,75 +1,90 @@
{%- if post -%}
{%- assign cur_page = post -%}
{%- assign _cur_page = post -%}
{%- elsif page -%}
{%- assign cur_page = page -%}
{%- assign _cur_page = page -%}
{%- endif -%}

{%- assign __source = page.pageview -%}
{%- assign __target = site.data.variables.default.pageview -%}
{%- assign __source = page.pageview -%}
{%- include snippets/assign.html -%}
{%- assign _pageview = __return -%}

{%- assign __target = site.data.variables.default.paths.archive -%}
{%- assign __source = site.paths.archive -%}
{%- include snippets/assign.html -%}
{%- assign _all_path = __return -%}

{%- if _cur_page.author -%}
{%- assign _author = site.data.authors[_cur_page.author] -%}
{%- else -%}
{%- assign _author = site.author -%}
{%- endif -%}


<div class="article__info clearfix">
{%- if cur_page.tags[0] -%}

{%- if _author -%}
<meta itemprop="author" content="{{ _author.name }}"/>
{%- endif -%}

{%- if _cur_page.tags[0] -%}
<ul class="left-col menu">
{%- if site.paths.all -%}
{%- assign all_path = site.paths.all -%}
{%- else -%}
{%- assign all_path = site.data.variables.default.paths.all -%}
{%- endif -%}

{%- assign _keywords = '' -%}
{%- for _tag in cur_page.tags -%}
{%- for _tag in _cur_page.tags -%}
{%- assign _tag_encode = _tag | strip | url_encode } -%}
{%- if forloop.last -%}
{%- assign _keywords = _keywords | append: _tag -%}
{%- else -%}
{%- assign _keywords = _keywords | append: _tag | append: ',' -%}
{%- endif -%}
{%- assign __path = all_path | append: '?tag=' -%}
{%- assign __path = _all_path | append: '?tag=' -%}
{%- include snippets/prepend-baseurl.html -%}
<li>
<a class="button button--secondary button--pill button--sm" href="{{ __return | append: _tag_encode | replace: '//', '/' }}">{{ _tag }}</a>
<a class="button button--secondary button--pill button--sm"
href="{{ __return | append: _tag_encode | replace: '//', '/' }}">{{ _tag }}</a>
</li>
{%- endfor -%}
<meta itemprop="keywords" content="{{ _keywords }}">
</ul>
{%- endif -%}
{%- if (_pageview or post) or cur_page.date -%}


{%- if (_pageview or post) or _cur_page.date -%}
<ul class="right-col menu">
{%- if cur_page.author -%}
{%- assign _author = site.data.authors[cur_page.author] -%}
{%- if !_cur_page.author -%}
<li><i class="fas fa-user"></i> <span>{{ _author.name }}</span></li>
{%- else -%}
{%- assign _author = site.author -%}
{%- endif -%}
{%- if _author -%}
<meta itemprop="author" content="{{ _author.name }}"/>
{%- endif -%}

{%- if cur_page.date -%}
{%- if _cur_page.date -%}
<li>
{%- assign __locale = site.data.locale.ARTICLE_DATE_FORMAT } -%}
{%- include snippets/locale-to-string.html -%}
{%- if post -%}
<i class="far fa-calendar-alt"></i> <span itemprop="datePublished">{{ cur_page.date | date: __return }}</span>
<i class="far fa-calendar-alt"></i> <span itemprop="datePublished">{{ _cur_page.date | date: __return }}</span>
{%- elsif page -%}
<i class="far fa-calendar-alt"></i> <time datetime="{{ page.date | date_to_xmlschema }}"
itemprop="datePublished">{{ cur_page.date | date: __return }}
itemprop="datePublished">{{ _cur_page.date | date: __return }}
</time>
{%- endif -%}
</li>
{%- endif -%}

{%- if _pageview or post -%}
{%- if site.pageview.provider -%}

{%- assign __locale = site.data.locale.VIEWS } -%}
{%- include snippets/locale-to-string.html -%}
{%- assign _locale_views = __return -%}

<li itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter">
<link itemprop="interactionType" href="http://schema.org/WatchAction"/>
<i class="far fa-eye"></i> <span class="js-pageview" data-page-key="{{ cur_page.key }}">0</span> {{ __return }}
<i class="far fa-eye"></i> <span class="js-pageview" data-page-key="{{ _cur_page.key }}">0</span> {{ _locale_views }}
</li>
{%- endif -%}
{%- endif -%}

</ul>
{%- endif -%}

</div>
34 changes: 22 additions & 12 deletions _includes/author-profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
{%- else -%}
{%- assign _author_itemtype = 'http://schema.org/Person' -%}
{%- endif -%}

<div itemscope itemtype="{{ _author_itemtype }}" class="author-profile card card--no-shadow clearfix">

{%- if _author.avatar -%}
{%- if _author.url -%}
<a href="{{ _author.url }}">
Expand All @@ -19,22 +21,30 @@
</a>
{%- endif -%}
{%- endif -%}


<div class="right-col clearfix">

{%- if _author.name -%}
<meta itemprop="name" content="{{ _author.name }}">
<p class="author-profile__name">
{%- if _author.url -%}
<meta itemprop="name" content="{{ _author.url }}">
<a href="{{ _author.url }}">
{%- endif -%}
{{ _author.name }}
{%- if _author.url -%}
</a>
{%- endif -%}
</p>
<meta itemprop="name" content="{{ _author.name }}">
<p class="author-profile__name">
{%- if _author.url -%}
<meta itemprop="url" content="{{ _author.url }}">
<a href="{{ _author.url }}">
{%- endif -%}
{{ _author.name }}
{%- if _author.url -%}
</a>
{%- endif -%}
</p>
{%- endif -%}
{%- if _author.bio -%}<p itemprop="description">{{ _author.bio }}</p>{%- endif -%}

{%- if _author.bio -%}
<p itemprop="description">{{ _author.bio }}</p>
{%- endif -%}

{%- assign __author = _author -%}
{%- include follow-me.html -%}

</div>
</div>
8 changes: 4 additions & 4 deletions _includes/comments-providers/gitalk.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
{%- assign _sources = __return -%}
<div id="js-gitalk-container"></div>
{%- assign _admin = '' -%}
{%- for adminId in site.comments.gitalk.admin -%}
{%- assign _admin = _admin | append: ", '" | append: adminId | append: "'" -%}
{%- for _admin_id in site.comments.gitalk.admin -%}
{%- assign _admin = _admin | append: ", '" | append: _admin_id | append: "'" -%}
{%- endfor -%}
{%- assign last = _admin | size | minus: 1 -%}
{%- assign _admin = _admin | slice: 2, last -%}
{%- assign _last = _admin | size | minus: 1 -%}
{%- assign _admin = _admin | slice: 2, _last -%}
<script>
window.Lazyload.css('{{ _sources.gitalk.css }}');
window.Lazyload.js('{{ _sources.gitalk.js }}', function() {
Expand Down
1 change: 0 additions & 1 deletion _includes/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
{%- elsif site.comments.provider == 'custom' -%}
{%- include comments-providers/custom.html -%}
{%- endif -%}

{%- endif -%}
12 changes: 12 additions & 0 deletions _includes/follow-me.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@

<div class="follow-me">
<ul class="menu menu--nowrap menu--center">


{%- if _author.url -%}
<link itemprop="url" href="{{ _author.url }}">
{%- endif -%}

{%- assign __locale = site.data.locale.EMAIL_ME -%}
{%- include snippets/locale-to-string.html -%}
{%- if _author.email -%}
Expand All @@ -17,56 +20,65 @@
<i class="fas fa-envelope"></i>
</a>
{%- endif -%}

{%- assign __locale = site.data.locale.FOLLOW_ME -%}
{%- include snippets/locale-to-string.html -%}

{%- if _author.weibo -%}
<li title="{{ __return | replace: '[NAME]', 'Weibo' }}">
<a class="button button--circle weibo-button" itemprop="sameAs" href="https://weibo.com/{{ _author.weibo }}" target="_blank">
<div class="icon">{%- include svg/icon/social/weibo.svg -%}</div>
</a>
</li>
{%- endif -%}

{%- if _author.facebook -%}
<li title="{{ __return | replace: '[NAME]', 'Facebook' }}">
<a class="button button--circle facebook-button" itemprop="sameAs" href="https://www.facebook.com/{{ _author.facebook }}" target="_blank">
<div class="icon">{%- include svg/icon/social/facebook.svg -%}</div>
</a>
</li>
{%- endif -%}

{%- if _author.twitter -%}
<li title="{{ __return | replace: '[NAME]', 'Twitter' }}">
<a class="button button--circle twitter-button" itemprop="sameAs" href="https://twitter.com/{{ _author.twitter }}" target="_blank">
<div class="icon">{%- include svg/icon/social/twitter.svg -%}</div>
</a>
</li>
{%- endif -%}

{%- if _author.googleplus -%}
<li title="{{ __return | replace: '[NAME]', 'Google+' }}">
<a class="button button--circle googlepluse-button" itemprop="sameAs" href="https://plus.google.com/u/0/{{ _author.googleplus }}" target="_blank">
<div class="icon">{%- include svg/icon/social/googleplus.svg -%}</div>
</a>
</li>
{%- endif -%}

{%- if _author.github -%}
<li title="{{ __return | replace: '[NAME]', 'Github' }}">
<a class="button button--circle github-button" itemprop="sameAs" href="https://github.com/{{ _author.github }}" target="_blank">
<div class="icon">{%- include svg/icon/social/github.svg -%}</div>
</a>
</li>
{%- endif -%}

{%- if _author.linkedin -%}
<li title="{{ __return | replace: '[NAME]', 'Linkedin' }}">
<a class="button button--circle linkedin-button" itemprop="sameAs" href="https://www.linkedin.com/in/{{ _author.linkedin }}" target="_blank">
<div class="icon">{%- include svg/icon/social/linkedin.svg -%}</div>
</a>
</li>
{%- endif -%}

{%- if _author.douban -%}
<li title="{{ __return | replace: '[NAME]', 'Douban' }}">
<a class="button button--circle douban-button" itemprop="sameAs" href="https://www.douban.com/people/{{ _author.douban }}" target="_blank">
<div class="icon">{%- include svg/icon/social/douban.svg -%}</div>
</a>
</li>
{%- endif -%}

</ul>
</div>
17 changes: 8 additions & 9 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@

<div class="footer js-page-footer">
<div class="main">

{%- assign __author = site.author -%}
{%- if __author.type == 'organization' -%}
{%- assign _author_itemtype = 'http://schema.org/Organization' -%}
{%- else -%}
{%- assign _author_itemtype = 'http://schema.org/Person' -%}
{%- endif -%}

<aside itemscope itemtype="{{ _author_itemtype }}">
<meta itemprop="name" content="{{ __author.name }}">
{%- if __author.url -%}
{%- assign _author_url = __author.url -%}
{%- else -%}
{%- assign __path = '/'-%}
{%- include snippets/prepend-baseurl.html -%}
{%- assign _author_url = __return -%}
{%- endif -%}
{%- assign __path = __author.url | default: '/'-%}
{%- include snippets/get-nav-url.html -%}
{%- assign _author_url = __return -%}
<meta itemprop="url" content="{{ _author_url }}">
{%- if __author.bio -%}
<meta itemprop="description" content="{{ __author.bio }}">
Expand All @@ -25,12 +23,13 @@
<footer class="site-info">
{%- assign __path = site.paths.rss | default: site.data.variables.default.paths.rss -%}
{%- include snippets/get-nav-url.html -%}
{%- assign href = __return -%}
{%- assign _href = __return -%}
{%- assign __locale = site.data.locale.NAV.RSS -%}
{%- include snippets/locale-to-string.html -%}
{%- assign _locale_nav_rss = __return -%}
<p>
<span class="site-info__copyright">© {{ site.title }} {{ site.data.locale.COPYRIGHT_DATES }}</span>
<a class="site-info__rss" type="application/rss+xml" href="{{ href }}">{{ __return }}</a>
<a class="site-info__rss" type="application/rss+xml" href="{{ _href }}">{{ _locale_nav_rss }}</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>.
Expand Down
Loading

0 comments on commit 49e5180

Please sign in to comment.