Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复了因为 baseurl 导致的错误 (Fix issues caused by baseurl) #112

Merged
merged 9 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ description: '昵称悟空,千禧一代,前端开发者/伪极客/灵魂摄
keyword: '廖柯宇, 廖柯宇的独立博客, 廖柯宇的博客, 前端, 前端开发, 前端博客, javascript, vuejs, nodejs, 设计'
url: '' # your host

# if you don't need baseurl, you should leave this value blank.
# when build blog on server, if you don't need baseurl, you should leave this value blank.
# 在服务器上建站时,如果你不需要子域名,请将这一格留空
# if you're using GitHub Pages, set baseurl to your blog's .
# 如果你在使用 GitHub Pages, 请将 baseurl 设置为你的网址的子域名
# for example, if your site is "kaeyleo.github.io", then this url should leave blank.
# 例如,当你的域名是 "kaeyleo.github.io" 时,这个 url 需要留空
# but if your created a repo named "myblog", and the site is "kaeyleo.github.io/myblog", change baseurl to '/myblog'
# 但是,如果你创建了一个叫 "myblog" 的网站,此时网址会变成 "kaeyleo.github.io/myblog" ,这时再将 baseurl 设置为 '/myblog'
baseurl: ''

# Navigation links
Expand Down
8 changes: 4 additions & 4 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<meta property="og:site_name" content="{{ site.title }}">
<link rel="stylesheet" href="//cdn.staticfile.org/normalize/6.0.0/normalize.min.css">
<link rel="stylesheet" href="//at.alicdn.com/t/font_271755_rdxzzo2kqwk.css">
<link rel="stylesheet" href="/assets/css/github-markdown.css">
<link rel="stylesheet" href="/assets/css/prism.css">
<link rel="stylesheet" href="/assets/css/share.min.css">
<link rel="stylesheet" href="/assets/css/app.min.css">
<link rel="stylesheet" href="{{ "/assets/css/github-markdown.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/css/prism.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/css/share.min.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/css/app.min.css" | relative_url }}">
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
</head>
2 changes: 1 addition & 1 deletion _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<nav class="g-nav">
<ul>
{% for i in site.nav %}
<li><a href="{{ i[1] }}">{{ i[0] }}</a></li>
<li><a href="{{ i[1] | relative_url}}">{{ i[0] }}</a></li>
{% endfor %}
</ul>
</nav>
Expand Down
8 changes: 4 additions & 4 deletions _includes/post-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<meta property="og:site_name" content="{{ site.title }}">
<link rel="stylesheet" href="//cdn.staticfile.org/normalize/6.0.0/normalize.min.css">
<link rel="stylesheet" href="//at.alicdn.com/t/font_roc50gemkxpw4s4i.css">
<link rel="stylesheet" href="/assets/css/github-markdown.css">
<link rel="stylesheet" href="/assets/css/prism.css">
<link rel="stylesheet" href="/assets/css/share.min.css">
<link rel="stylesheet" href="/assets/css/app.min.css">
<link rel="stylesheet" href="{{ "/assets/css/github-markdown.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/css/prism.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/css/share.min.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/css/app.min.css" | relative_url }}">
<link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
{% if site.mathjax %}
Expand Down
4 changes: 2 additions & 2 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{{ content }}
</div>
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<script src="/assets/js/prism.js"></script>
<script src="/assets/js/index.min.js"></script>
<script src="{{ "/assets/js/prism.js" | relative_url }}"></script>
<script src="{{ "/assets/js/index.min.js" | relative_url }}"></script>
</body>
</html>
20 changes: 10 additions & 10 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="post-tags">
{% if page.tags.size > 0 %}
{% for tag in page.tags %}
<a href="{{ "tags#" | append: tag | absolute_url }}" class="post-tag">{{ tag }}</a>
<a href="{{ "/tags.html#" | append: tag | relative_url }}" class="post-tag">{{ tag }}</a>
{% endfor %}
{% endif %}
</div>
Expand All @@ -28,7 +28,7 @@ <h1>{{ page.title }}</h1>
</div>
{% if page.cover %}
<div class="filter"></div>
<div class="post-cover" style="background: url('{{ page.cover }}') center no-repeat; background-size: cover;"></div>
<div class="post-cover" style="background: url('{{ page.cover | relative_url }}') center no-repeat; background-size: cover;"></div>
{% endif %}
</header>

Expand All @@ -51,7 +51,7 @@ <h2 class="post-subtitle">{{ page.subtitle }}</h2>
<section class="author-detail">
<section class="post-footer-item author-card">
<div class="avatar">
<img src="{{ site.avatar | absolute_url }}" alt="">
<img src="{{ site.avatar | relative_url }}" alt="">
</div>
<div class="author-name" rel="author">{{ site.author }}</div>
<div class="bio">
Expand All @@ -72,28 +72,28 @@ <h2 class="post-subtitle">{{ page.subtitle }}</h2>
<section class="post-footer-item read-next">
{% if page.next.url %}
<div class="read-next-item">
<a href="{{ page.next.url }}" class="read-next-link"></a>
<a href="{{ page.next.url | relative_url }}" class="read-next-link"></a>
<section>
<span>{{ page.next.title }}</span>
<p>{{ page.next.excerpt | strip_html | strip_newlines | truncate: 60}}</p>
</section>
{% if page.next.cover %}
<div class="filter"></div>
<img src="{{ page.next.cover }}" alt="">
<img src="{{ page.next.cover | relative_url }}" alt="">
{% endif %}
</div>
{% endif %}

{% if page.previous.url %}
<div class="read-next-item">
<a href="{{ page.previous.url }}" class="read-next-link"></a>
<a href="{{ page.previous.url | relative_url }}" class="read-next-link"></a>
<section>
<span>{{ page.previous.title }}</span>
<p>{{ page.previous.excerpt | strip_html | strip_newlines | truncate: 60}}</p>
</section>
{% if page.previous.cover %}
<div class="filter"></div>
<img src="{{ page.previous.cover }}" alt="">
<img src="{{ page.previous.cover | relative_url }}" alt="">
{% endif %}
</div>
{% endif %}
Expand All @@ -107,7 +107,7 @@ <h2 class="post-subtitle">{{ page.subtitle }}</h2>

{% include footer.html %}

<script src="/assets/js/social-share.min.js"></script>
<script src="{{ "/assets/js/social-share.min.js" | relative_url }}"></script>
<script>
socialShare('.social-share', {
sites: [
Expand Down Expand Up @@ -142,8 +142,8 @@ <h2 class="post-subtitle">{{ page.subtitle }}</h2>
</script>
{% endif %}

<script src="/assets/js/prism.js"></script>
<script src="/assets/js/index.min.js"></script>
<script src="{{ "/assets/js/prism.js" | relative_url }}"></script>
<script src="{{ "/assets/js/index.min.js" | relative_url }}"></script>
</body>

</html>
2 changes: 1 addition & 1 deletion assets/js/index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div
class="g-banner home-banner {{ site.theme-color | prepend: 'banner-theme-' }}"
data-theme="{{ site.theme-color }}"
style="{% if page.header-img %}background: url({{ page.header-img | prepend: site.baseurl }}) no-repeat center center; background-size: cover;{% endif %}"
style="{% if page.header-img %}background: url({{ page.header-img | relative_url }}) no-repeat center center; background-size: cover;{% endif %}"
>
<h2>{{ page.home-title }}</h2>
<h3>{{ page.description }}</h3>
Expand All @@ -21,12 +21,12 @@ <h3>{{ page.description }}</h3>
<article class="article-item">
{% if post.cover %}
<div class="post-cover">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}" title="{{ post.title }}"></a>
<img src="{{ post.cover }}" href="{{ post.url | prepend: site.baseurl }}" alt="">
<a class="post-link" href="{{ post.url | relative_url }}" title="{{ post.title }}"></a>
<img src="{{ post.cover | relative_url }}" href="{{ post.url | relative_url }}" alt="">
</div>
{% endif %}
<section class="post-preview">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}" title="{{ post.title }}"></a>
<a class="post-link" href="{{ post.url | relative_url }}" title="{{ post.title }}"></a>
<h2 class="post-title">{{ post.title }}</h2>
{% if post.subtitle %}
<h3 class="post-subtitle">{{ post.subtitle }}</h3>
Expand All @@ -39,7 +39,7 @@ <h3 class="post-subtitle">{{ post.subtitle }}</h3>
<div class="post-tags">
{% if post.tags.size > 0 %}
{% for tag in post.tags %}
<a href={{ "tags.html#" | append: tag | pretend: site.baseurl}} class="post-tag">{{ tag }}</a>
<a href={{ "tags.html#" | append: tag | relative_url }} class="post-tag">{{ tag }}</a>
{% endfor %}
{% endif %}
</div>
Expand All @@ -58,7 +58,7 @@ <h3 class="post-subtitle">{{ post.subtitle }}</h3>
<div class="g-sidebar">
<section class="author-card">
<div class="avatar">
<img src="{{ site.avatar | prepend: site.baseurl }}" alt="">
<img src="{{ site.avatar | relative_url }}" alt="">
</div>
<div class="author-name" rel="author">{{ site.author }}</div>
<div class="bio">
Expand All @@ -83,7 +83,7 @@ <h3 class="post-subtitle">{{ post.subtitle }}</h3>
{% if forloop.index > site.recommend-condition-size %}
{% break %}
{% endif %}
<a href="{{ "tags.html#" | append: tag[0] | prepend: site.baseurl }}" class="tag">{{ tag[0]}}</a>
<a href="{{ "tags.html#" | append: tag[0] | relative_url }}" class="tag">{{ tag[0]}}</a>
{% endfor %}
</section>
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ layout: null
<channel>
<title>{{ site.title | xml_escape }}</title>
<description>{{ site.description | xml_escape }}</description>
<link>{{ site.url }}{{ site.baseurl }}/</link>
<atom:link href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/rss+xml" />
<link>{{ site.url }}{{ "/" | relative_url }}/</link>
<atom:link href="{{ "/feed.xml" | relative_url | prepend: site.url }}" rel="self" type="application/rss+xml" />
<pubDate>{{ site.time | date_to_rfc822 }}</pubDate>
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>
<generator>Jekyll v{{ jekyll.version }}</generator>
Expand All @@ -16,8 +16,8 @@ layout: null
<title>{{ post.title | xml_escape }}</title>
<description>{{ post.content | xml_escape }}</description>
<pubDate>{{ post.date | date_to_rfc822 }}</pubDate>
<link>{{ post.url | prepend: site.baseurl | prepend: site.url }}</link>
<guid isPermaLink="true">{{ post.url | prepend: site.baseurl | prepend: site.url }}</guid>
<link>{{ post.url | relative_url | prepend: site.url }}</link>
<guid isPermaLink="true">{{ post.url | relative_url | prepend: site.url }}</guid>
{% for tag in post.tags %}
<category>{{ tag | xml_escape }}</category>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion search.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout: null
{
"title" : "{{ post.title | escape }}",
"tags" : "{% for tag in post.tags %}{% if forloop.rindex != 1 %}{{ tag }} {% else %}{{ tag }}{% endif %}{% endfor %}",
"url" : "{{ post.url }}"
"url" : "{{ post.url | relative_url }}"
} {% unless forloop.last %},{% endunless %}
{% endfor %}
]
2 changes: 1 addition & 1 deletion tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h2>TAGS</h2>
<li>
<span class="tag-name" id="{{ tag[0] }}">「{{ tag[0] }}」</span>
{% for post in tag[1] %}
<a class="tag-post" href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a>
<a class="tag-post" href="{{ post.url | relative_url }}" title="{{ post.title }}">{{ post.title }}</a>
{% endfor %}
</li>
{% endfor%}
Expand Down