Skip to content

Commit 17d6ca6

Browse files
committed
[v1.8] thanks to Huxpro#74, extract duplicated partials
1 parent 9425296 commit 17d6ca6

18 files changed

+322
-413
lines changed

404.html

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
---
22
layout: default
3+
title: 404
4+
hide-in-nav: true
35
description: "你来到了没有知识的荒原 :("
46
header-img: "img/404-bg.jpg"
57
permalink: /404.html
68
---
79

810

911
<!-- Page Header -->
10-
<header class="intro-header" style="background-image: url('{{ site.baseurl }}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}')">
11-
<div class="container">
12-
<div class="row">
13-
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
14-
<div class="site-heading" id="tag-heading">
15-
<h1>404</h1>
16-
<span class="subheading">{{ page.description }}</span>
17-
</div>
18-
</div>
19-
</div>
20-
</div>
21-
</header>
12+
{% include intro-header.html type="page" %}
2213

2314
<script>
2415
document.body.classList.add('page-fullscreen');

_includes/featured-tags.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{% comment %}
2+
@param {boolean} bottom - bottom will render <hr>
3+
{% endcomment %}
4+
5+
{% if site.featured-tags %}
6+
<section>
7+
{% if include.bottom %}
8+
<hr class="hidden-sm hidden-xs">
9+
{% endif %}
10+
<h5><a href="{{'/tags/' | prepend: site.baseurl }}">FEATURED TAGS</a></h5>
11+
<div class="tags">
12+
{% capture tags %}
13+
{% for tag in site.tags %}
14+
{% if tag[1].size > site.featured-condition-size %}
15+
<a data-sort="{{ site.posts.size | minus: tag[1].size | prepend: '0000' | slice: -4, 4 }}"
16+
href="{{ site.baseurl }}/tags/#{{ tag[0] }}"
17+
title="{{ tag[0] }}"
18+
rel="{{ tag[1].size }}">{{ tag[0] }}
19+
</a>
20+
{% endif %}
21+
{% endfor %}
22+
{% endcapture %}
23+
{{ tags | split:'</a>' | sort | join:'</a>' }}
24+
</div>
25+
</section>
26+
{% endif %}

_includes/footer.html

Lines changed: 3 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,82 +3,9 @@
33
<div class="container">
44
<div class="row">
55
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
6-
<ul class="list-inline text-center">
7-
{% if site.RSS %}
8-
<li>
9-
<a href="{{ "/feed.xml" | prepend: site.baseurl }}">
10-
<span class="fa-stack fa-lg">
11-
<i class="fa fa-circle fa-stack-2x"></i>
12-
<i class="fa fa-rss fa-stack-1x fa-inverse"></i>
13-
</span>
14-
</a>
15-
</li>
16-
{% endif %}
17-
{% if site.twitter_username %}
18-
<li>
19-
<a href="https://twitter.com/{{ site.twitter_username }}">
20-
<span class="fa-stack fa-lg">
21-
<i class="fa fa-circle fa-stack-2x"></i>
22-
<i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
23-
</span>
24-
</a>
25-
</li>
26-
{% endif %}
27-
28-
<!-- add Weibo, Zhihu by Hux, add target = "_blank" to <a> by Hux -->
29-
{% if site.zhihu_username %}
30-
<li>
31-
<a target="_blank" href="https://www.zhihu.com/people/{{ site.zhihu_username }}">
32-
<span class="fa-stack fa-lg">
33-
<i class="fa fa-circle fa-stack-2x"></i>
34-
<i class="fa fa-stack-1x fa-inverse"></i>
35-
</span>
36-
</a>
37-
</li>
38-
{% endif %}
39-
{% if site.weibo_username %}
40-
<li>
41-
<a target="_blank" href="http://weibo.com/{{ site.weibo_username }}">
42-
<span class="fa-stack fa-lg">
43-
<i class="fa fa-circle fa-stack-2x"></i>
44-
<i class="fa fa-weibo fa-stack-1x fa-inverse"></i>
45-
</span>
46-
</a>
47-
</li>
48-
{% endif %}
49-
50-
51-
{% if site.facebook_username %}
52-
<li>
53-
<a target="_blank" href="https://www.facebook.com/{{ site.facebook_username }}">
54-
<span class="fa-stack fa-lg">
55-
<i class="fa fa-circle fa-stack-2x"></i>
56-
<i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
57-
</span>
58-
</a>
59-
</li>
60-
{% endif %}
61-
{% if site.github_username %}
62-
<li>
63-
<a target="_blank" href="https://github.com/{{ site.github_username }}">
64-
<span class="fa-stack fa-lg">
65-
<i class="fa fa-circle fa-stack-2x"></i>
66-
<i class="fa fa-github fa-stack-1x fa-inverse"></i>
67-
</span>
68-
</a>
69-
</li>
70-
{% endif %}
71-
{% if site.linkedin_username %}
72-
<li>
73-
<a target="_blank" href="https://www.linkedin.com/in/{{ site.linkedin_username }}">
74-
<span class="fa-stack fa-lg">
75-
<i class="fa fa-circle fa-stack-2x"></i>
76-
<i class="fa fa-linkedin fa-stack-1x fa-inverse"></i>
77-
</span>
78-
</a>
79-
</li>
80-
{% endif %}
81-
</ul>
6+
<!-- SNS Link -->
7+
{% include sns-links.html center=true %}
8+
829
<p class="copyright text-muted">
8310
Copyright &copy; {{ site.title }} {{ site.time | date: '%Y' }}
8411
<br>

_includes/friends.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% if site.friends %}
2+
<hr>
3+
<h5>FRIENDS</h5>
4+
<ul class="list-inline">
5+
{% for friend in site.friends %}
6+
<li><a href="{{friend.href}}">{{friend.title}}</a></li>
7+
{% endfor %}
8+
</ul>
9+
{% endif %}

_includes/intro-header.html

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{% comment %}
2+
@param {string} type - 'page' | 'post' | 'keynote'
3+
@param {boolean} short
4+
{% endcomment %}
5+
6+
{% if include.type == 'post' %}
7+
<style type="text/css">
8+
header.intro-header{
9+
position: relative;
10+
background-image: url('{{ site.baseurl }}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}')
11+
}
12+
13+
{% if page.header-mask %}
14+
header.intro-header .header-mask{
15+
width: 100%;
16+
height: 100%;
17+
position: absolute;
18+
background: rgba(0,0,0, {{ page.header-mask }});
19+
}
20+
{% endif %}
21+
</style>
22+
<header class="intro-header" >
23+
<div class="header-mask"></div>
24+
<div class="container">
25+
<div class="row">
26+
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
27+
<div class="post-heading">
28+
<div class="tags">
29+
{% for tag in page.tags %}
30+
<a class="tag" href="{{ site.baseurl }}/tags/#{{ tag }}" title="{{ tag }}">{{ tag }}</a>
31+
{% endfor %}
32+
</div>
33+
<h1>{{ page.title }}</h1>
34+
{% comment %} always create a h2 for keeping the margin {% endcomment %}
35+
<h2 class="subheading">{{ page.subtitle }}</h2>
36+
<span class="meta">Posted by {% if page.author %}{{ page.author }}{% else %}{{ site.title }}{% endif %} on {{ page.date | date: "%B %-d, %Y" }}</span>
37+
</div>
38+
</div>
39+
</div>
40+
</div>
41+
</header>
42+
{% endif %}
43+
44+
{% if include.type == 'keynote' %}
45+
<style type="text/css">
46+
header.intro-header{
47+
height: 500px;
48+
overflow: hidden;
49+
}
50+
header.intro-header .container{
51+
visibility: hidden;
52+
}
53+
header iframe{
54+
width: 100%;
55+
height: 100%;
56+
border: 0;
57+
}
58+
/* Override Nav Style */
59+
{% if page.navcolor == "invert" %}
60+
.navbar-custom .nav li a,
61+
.navbar-custom .nav li a:hover,
62+
.navbar-custom .navbar-brand,
63+
.navbar-custom .navbar-brand:hover {color:#777;}
64+
.navbar-default .navbar-toggle .icon-bar {background-color:#777;}
65+
{% endif %}
66+
</style>
67+
<header class="intro-header" >
68+
<iframe src="{{page.iframe}}"></iframe>
69+
<!-- keep for SEO -->
70+
<div class="container">
71+
<div class="row">
72+
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
73+
<div class="post-heading">
74+
<div class="tags">
75+
{% for tag in page.tags %}
76+
<a class="tag" href="{{ site.baseurl }}/tags/#{{ tag }}" title="{{ tag }}">{{ tag }}</a>
77+
{% endfor %}
78+
</div>
79+
<h1>{{ page.title }}</h1>
80+
{% comment %} always create a h2 for keeping the margin {% endcomment %}
81+
<h2 class="subheading">{{ page.subtitle }}</h2>
82+
<span class="meta">Posted by {% if page.author %}{{ page.author }}{% else %}{{ site.title }}{% endif %}
83+
on {{ page.date | date: "%B %-d, %Y" }}</span>
84+
</div>
85+
</div>
86+
</div>
87+
</div>
88+
</header>
89+
{% endif %}
90+
91+
{% if include.type == 'page' %}
92+
<header class="intro-header" style="background-image: url('{{ site.baseurl }}/{% if page.header-img %}{{ page.header-img }}{% else %}{{ site.header-img }}{% endif %}')">
93+
<div class="container">
94+
<div class="row">
95+
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
96+
{% if include.short %}
97+
<div class="site-heading" id="tag-heading">
98+
{% else %}
99+
<div class="site-heading">
100+
{% endif %}
101+
<h1>{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</h1>
102+
<span class="subheading">{{ page.description }}</span>
103+
</div>
104+
</div>
105+
</div>
106+
</div>
107+
</header>
108+
{% endif %}

_includes/nav.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
<li>
2020
<a href="{{ site.baseurl }}/">Home</a>
2121
</li>
22-
{% for page in site.pages %}{% if page.title %}
22+
{% for page in site.pages %}
23+
{% if page.title and page.hide-in-nav != true %}
2324
<li>
2425
<a href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>
2526
</li>
26-
{% endif %}{% endfor %}
27+
{% endif %}
28+
{% endfor %}
2729
</ul>
2830
</div>
2931
</div>

_includes/short-about.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<section class="visible-md visible-lg">
2+
<hr>
3+
<h5><a href="{{'/about/' | prepend: site.baseurl }}">ABOUT ME</a></h5>
4+
<div class="short-about">
5+
{% if site.sidebar-avatar %}
6+
<img src="{{site.sidebar-avatar}}" />
7+
{% endif %}
8+
{% if site.sidebar-about-description %}
9+
<p>{{site.sidebar-about-description}}</p>
10+
{% endif %}
11+
<!-- SNS Link -->
12+
{% include sns-links.html %}
13+
</div>
14+
</section>

_includes/sns-links.html

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{% comment %}
2+
@param {Boolean} center
3+
{% endcomment %}
4+
5+
{% if include.center %}
6+
<ul class="list-inline text-center">
7+
{% else %}
8+
<ul class="list-inline">
9+
{% endif %}
10+
11+
{% if site.RSS %}
12+
<li>
13+
<a href="{{ "/feed.xml" | prepend: site.baseurl }}">
14+
<span class="fa-stack fa-lg">
15+
<i class="fa fa-circle fa-stack-2x"></i>
16+
<i class="fa fa-rss fa-stack-1x fa-inverse"></i>
17+
</span>
18+
</a>
19+
</li>
20+
{% endif %}
21+
{% if site.twitter_username %}
22+
<li>
23+
<a href="https://twitter.com/{{ site.twitter_username }}">
24+
<span class="fa-stack fa-lg">
25+
<i class="fa fa-circle fa-stack-2x"></i>
26+
<i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
27+
</span>
28+
</a>
29+
</li>
30+
{% endif %}
31+
{% if site.zhihu_username %}
32+
<li>
33+
<a target="_blank" href="https://www.zhihu.com/people/{{ site.zhihu_username }}">
34+
<span class="fa-stack fa-lg">
35+
<i class="fa fa-circle fa-stack-2x"></i>
36+
<i class="fa fa-stack-1x fa-inverse"></i>
37+
</span>
38+
</a>
39+
</li>
40+
{% endif %}
41+
{% if site.weibo_username %}
42+
<li>
43+
<a target="_blank" href="http://weibo.com/{{ site.weibo_username }}">
44+
<span class="fa-stack fa-lg">
45+
<i class="fa fa-circle fa-stack-2x"></i>
46+
<i class="fa fa-weibo fa-stack-1x fa-inverse"></i>
47+
</span>
48+
</a>
49+
</li>
50+
{% endif %}
51+
{% if site.facebook_username %}
52+
<li>
53+
<a target="_blank" href="https://www.facebook.com/{{ site.facebook_username }}">
54+
<span class="fa-stack fa-lg">
55+
<i class="fa fa-circle fa-stack-2x"></i>
56+
<i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
57+
</span>
58+
</a>
59+
</li>
60+
{% endif %}
61+
{% if site.github_username %}
62+
<li>
63+
<a target="_blank" href="https://github.com/{{ site.github_username }}">
64+
<span class="fa-stack fa-lg">
65+
<i class="fa fa-circle fa-stack-2x"></i>
66+
<i class="fa fa-github fa-stack-1x fa-inverse"></i>
67+
</span>
68+
</a>
69+
</li>
70+
{% endif %}
71+
{% if site.linkedin_username %}
72+
<li>
73+
<a target="_blank" href="https://www.linkedin.com/in/{{ site.linkedin_username }}">
74+
<span class="fa-stack fa-lg">
75+
<i class="fa fa-circle fa-stack-2x"></i>
76+
<i class="fa fa-linkedin fa-stack-1x fa-inverse"></i>
77+
</span>
78+
</a>
79+
</li>
80+
{% endif %}
81+
</ul>

0 commit comments

Comments
 (0)