Skip to content

Commit

Permalink
chore: prepend-baseurl
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed Nov 19, 2017
1 parent c45246a commit 631776d
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 71 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
language: ruby
rvm:
- 2.4.0
branches:
only:
- master
before_script: mkdir ./_posts && cp -Rfv ./test/_posts/** ./_posts
script: bundle exec jekyll build --config ./_config.demo.yml
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
github_token: $GITHUB_TOKEN
local_dir: _site
on:
branch: master
Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# `--' `----''--' '--' `--'

## Base settings ##
# url: # the base hostname & protocol for your site e.g. https://www.someone.com
# url: #!the base hostname & protocol for your site e.g. https://www.someone.com
baseurl: '/'
title: Someone's blog
description: > #this means to ignore newlines until "nav_lists:"
Expand Down
4 changes: 3 additions & 1 deletion _includes/blog/article-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
<ul class="inline-list tag-wrapper">
{% for tag in cur_page.tags %}
{% assign _tag = tag | strip | url_encode } %}
{% assign __path = '/all.html?tag=' %}
{% include snippets/prepend-baseurl.html %}
<li><a class="round-rect-button"
href="{{ "/all.html?tag=" | prepend: site.baseurl | append: _tag | replace: '//', '/' }}">{{ tag }}
href="{{ __return | append: _tag | replace: '//', '/' }}">{{ tag }}
</a></li>
{% endfor %}
</ul>
Expand Down
27 changes: 21 additions & 6 deletions _includes/blog/header.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
<header class="m-page-header main clearfix">
{% assign __path = '/' %}
{% include snippets/prepend-baseurl.html %}
{% if site.title %}
<a class="site-title" title="{% if site.description %}{{ site.description }}{% endif %}"
href="{{ "/" | prepend: site.baseurl | replace: '//', '/' }}">{% if site.title %}{{ site.title }}{% endif %}
</a>
href="{{ __return }}">{{ site.title }}</a>
{% endif %}
<div class="site-logo">
{% include logo/logo.svg %}
</div>
<nav>
<ul class="inline-list">
{% assign __path = '/' %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
{% assign __locale = site.data.locale.NAV.HOME %}
{% include snippets/locale-to-string.html %}
<li><a href="{{ '/' | prepend: site.baseurl | replace: '//', '/' }}">{{ __return }}</a></li>
<li><a href="{{ href }}">{{ __return }}</a></li>
{% assign __path = '/all.html' %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
{% assign __locale = site.data.locale.NAV.ALL %}
{% include snippets/locale-to-string.html %}
<li><a href="{{ '/all.html' | prepend: site.baseurl | append: "?tag=" | replace: '//', '/'}}">{{ __return }}</a></li>
<li><a href="{{ href | append: "?tag=" | replace: '//', '/'}}">{{ __return }}</a></li>
{% for list in site.nav_lists %}
{% assign __path = list.url %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
{% assign __locale = list.titles %}
{% include snippets/locale-to-string.html %}
<li><a href="{{ list.url | prepend: site.baseurl | replace: '//', '/' }}">{% if list.title %}{{ list.title }}{% else %}{{ __return }}{% endif %}</a></li>
<li><a href="{{ href }}">{% if list.title %}{{ list.title }}{% else %}{{ __return }}{% endif %}</a></li>
{% endfor %}
{% assign __path = '/feed.xml' %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
{% assign __locale = site.data.locale.NAV.RSS %}
{% include snippets/locale-to-string.html %}
<li><a type="application/rss+xml" href="{{ '/feed.xml' | prepend: site.baseurl | replace: '//', '/'}}">{{ __return }}</a></li>
<li><a type="application/rss+xml" href="{{ href }}">{{ __return }}</a></li>
</ul>
</nav>
</header>
9 changes: 6 additions & 3 deletions _includes/blog/license.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
<div class="m-license">
<div class="clearfix">
{% if site.repository and site.repository_tree %}
{% assign __path = '/assets/images/octocat.jpg' %}
{% include snippets/prepend-baseurl.html %}
<a class="octocat" href="https://github.com/{{ site.repository }}/tree/{{ site.repository_tree }}/{{ page.path }}">
<img alt="View on Github" src="{{ "/assets/images/octocat.jpg" | prepend: site.baseurl | replace: '//', '/'}}" />
</a>
<img alt="View on Github" src="{{ __return }}" /></a>
{% assign __locale = locale.POST_ON_GITHUB %}
{% include snippets/locale-to-string.html %}
<p><a href="https://github.com/{{ site.repository }}/tree/{{ site.repository_tree }}/{{ page.path }}">{{ __return }}</a></p>
{% endif %}
{% assign __locale = locale.LICENSE_ANNOUNCE %}
{% include snippets/locale-to-string.html %}
<p>{{ __return | replace: "[LICENSE]", '<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">CC-BY-NC-4.0</a>' }}</p>
{% assign __path = '/assets/images/license-cc4.png' %}
{% include snippets/prepend-baseurl.html %}
<a class="license" rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">
<img alt="Creative Commons License" src="{{ '/assets/images/license-cc4.png' | prepend: site.baseurl | replace: '//', '/'}}" />
<img alt="Creative Commons License" src="{{ __return }}" />
</a>
{% assign __locale = locale.LICENSE_INTRO %}
{% include snippets/locale-to-string.html %}
Expand Down
4 changes: 3 additions & 1 deletion _includes/common-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
<title>{% if __return %}{{ __return }} - {{ site.title }}{% else %}{{ site.title }}{% endif %}</title>
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
<link rel="canonical" href="{% include snippets/page-url.html %}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{% include snippets/rss-url.html %}">
{% assign __path = '/feed.xml' %}
{% include snippets/prepend-baseurl.html %}
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ __return | prepend: site.url }}">
59 changes: 36 additions & 23 deletions _includes/head-icons-rel.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
<!--
for Safari on iOS
https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/
-->
<link rel="apple-touch-icon" sizes="180x180" href="/assets/images/logo/icon-180x180.png">
<link rel="apple-touch-icon" sizes="167x167" href="/assets/images/logo/icon-167x167.png">
<link rel="apple-touch-icon" sizes="152x152" href="/assets/images/logo/icon-152x152.png">
<link rel="apple-touch-icon" sizes="120x120" href="/assets/images/logo/icon-120x120.png">
<link rel="shortcut icon" href="/assets/images/logo/icon-120x120.png">
<!--
for Chrome on Android
https://developer.chrome.com/multidevice/android/installtohomescreen
-->
<!-- for Safari on iOS https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/ -->
{% assign __path = '/assets/images/logo/icon-180x180.png' %}
{% include snippets/prepend-baseurl.html %}
<link rel="apple-touch-icon" sizes="180x180" href="{{ __return }}">
{% assign __path = '/assets/images/logo/icon-167x167.png' %}
{% include snippets/prepend-baseurl.html %}
<link rel="apple-touch-icon" sizes="167x167" href="{{ __return }}">
{% assign __path = '/assets/images/logo/icon-152x152.png' %}
{% include snippets/prepend-baseurl.html %}
<link rel="apple-touch-icon" sizes="152x152" href="{{ __return }}">
{% assign __path = '/assets/images/logo/icon-120x120.png' %}
{% include snippets/prepend-baseurl.html %}
<link rel="apple-touch-icon" sizes="120x120" href="{{ __return }}">
{% assign __path = '/assets/images/logo/icon-120x120.png' %}
{% include snippets/prepend-baseurl.html %}
<link rel="shortcut icon" href="{{ __return }}">
<!-- for Chrome on Android https://developer.chrome.com/multidevice/android/installtohomescreen -->
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="192x192" href="/assets/images/logo/icon-192x192.png">
<!--
for Edge on Windows 10
https://msdn.microsoft.com/en-us/library/dn255024(v=vs.85).aspx
-->
<meta name="msapplication-TileImage" content="/assets/images/logo/icon-144x144.png">
<meta name="msapplication-square310x310logo" content="/assets/images/icon-310x310.png">
<meta name="msapplication-wide310x150logo" content="/assets/images/icon-310x150.png">
<meta name="msapplication-square150x150logo" content="/assets/images/icon-150x150.png">
<meta name="msapplication-square70x70logo" content="/assets/images/icon-70x70.png">
{% assign __path = '/assets/images/logo/icon-192x192.png' %}
{% include snippets/prepend-baseurl.html %}
<link rel="icon" sizes="192x192" href="{{ __return }}">
<!-- for Edge on Windows 10 https://msdn.microsoft.com/en-us/library/dn255024(v=vs.85).aspx -->
{% assign __path = '/assets/images/logo/icon-144x144.png' %}
{% include snippets/prepend-baseurl.html %}
<meta name="msapplication-TileImage" content="{{ __return }}">
{% assign __path = '/assets/images/logo/icon-310x310.png' %}
{% include snippets/prepend-baseurl.html %}
<meta name="msapplication-square310x310logo" content="{{ __return }}">
{% assign __path = '/assets/images/logo/icon-310x150.png' %}
{% include snippets/prepend-baseurl.html %}
<meta name="msapplication-wide310x150logo" content="{{ __return }}">
{% assign __path = '/assets/images/logo/icon-150x150.png' %}
{% include snippets/prepend-baseurl.html %}
<meta name="msapplication-square150x150logo" content="{{ __return }}">
{% assign __path = '/assets/images/logo/icon-70x70.png' %}
{% include snippets/prepend-baseurl.html %}
<meta name="msapplication-square70x70logo" content="{{ __return }}">
<meta name="msapplication-TileColor" content="#eeeeee">
1 change: 1 addition & 0 deletions _includes/snippets/prepend-baseurl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% assign __return = __path | replace:'index.html','' | prepend: site.baseurl | replace:'//','/' %}
1 change: 0 additions & 1 deletion _includes/snippets/rss-url.html

This file was deleted.

12 changes: 7 additions & 5 deletions _layouts/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,29 @@ <h1 class="js-page-heading">{{ __return }}</h1>
<!--group by year: http://stackoverflow.com/questions/19086284/jekyll-liquid-templating-how-to-group-blog-posts-by-year-->
<section class="js-year-wrapper">
{% for post in site.posts %}
{% assign currentdate = post.date | date: "%Y" %}
{% assign currentdate = post.date | date: '%Y' %}
{% if currentdate != date %}
{% unless forloop.first %}</ul></section>{% endunless %}
<section id="{{ post.date | date: "%Y" }}">
<h2 class="year-title" id="year-{{ post.date | date: "%Y" }}">{{ currentdate }}</h2>
<ul class="year-list">
{% assign date = currentdate %}
{% endif %}
{% assign _tags = "" %}
{% assign _tags = '' %}
{% for tag in post.tags %}
{% assign _tag = tag | strip | url_encode %}
{% assign _tags = _tags | append: ","" | append: _tag %}
{% assign _tags = _tags | append: ',' | append: _tag %}
{% endfor %}
{% assign last = _tags | size | minus: 1 %}
{% assign _tags = _tags | slice: 1, last %}
{% assign __path = post.url %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
{% assign __locale = site.data.locale.ARTICLE_LIST_DATE_FORMAT } %}
{% include snippets/locale-to-string.html %}
<li class="js-post-block" data-tag="{{ _tags }}">
<span class="post-date">{{ post.date | date: __return }}</span>
<a class="post-link" href="{{ post.url | prepend: site.baseurl | replace: '//', '/' }}">{{ post.title }}</a>
</li>
<a class="post-link" href="{{ href }}">{{ post.title }}</a></li>
{% if forloop.last %}</ul></section>{% endif %}
{% endfor %}
</section>
Expand Down
14 changes: 8 additions & 6 deletions _layouts/blog-base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
<head>
{% include common-head.html %}
{% include head-icons-rel.html %}
<link rel="stylesheet" href="{{ "/assets/css/blog.css" | prepend: site.baseurl | replace:'//','/' }}">
{% assign __path = '/assets/css/blog.css' %}
{% include snippets/prepend-baseurl.html %}
<link rel="stylesheet" href="{{ __return }}">
<style>
{% if page.picture_frame == 'shadow' %}
.m-article-content img:not(.emoji) {
box-shadow: 0 0 5px rgba(0, 0, 0, .4);
}
{% endif %}
{% if page.picture_frame == 'shadow' %}
.m-article-content img:not(.emoji) {
box-shadow: 0 0 5px rgba(0, 0, 0, .4);
}
{% endif %}
</style>
<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
{% include utils/mathjax.html %}
Expand Down
52 changes: 29 additions & 23 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@
<div class="m-post-list">
{% for post in paginator.posts %}
<article>
<h1>
<a href="{{ post.url | prepend: site.baseurl | replace: '//', '/' }}">{{ post.title }}</a>
</h1>
{% assign __path = post.url %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<h1><a href="{{ href }}">{{ post.title }}</a></h1>
<div class="m-article-content">
{% if site.excerpt_type == 'html' %}
{{ post.excerpt }}
{% else %}
{{ post.excerpt | strip_html | truncate: 350 }}
{% endif %}
</div>
{% assign __path = post.url %}
{% include snippets/prepend-baseurl.html %}
{% assign __locale = site.data.locale.READMORE %}
{% include snippets/locale-to-string.html %}
<a href="{{ post.url | prepend: site.baseurl | replace: '//', '/' }}">{{ __return }}</a>
<a href="{{ href }}">{{ __return }}</a>
{% include blog/article-data.html %}
</article>
{% endfor %}
Expand All @@ -37,38 +40,41 @@ <h1>
<p>{{ __return | replace: '[PAGE_COUNT]', post_count | replace: '[PAGE_COUNT]', page_count }}</p>
<ul class="inline-list">
{% if paginator.previous_page %}
<li><a class="round-button" href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">
<div class="icon icon--previous">{% include icon/previous.svg %}</div>
</a></li>
{% assign __path = paginator.previous_page_path %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<li><a class="round-button" href="{{ href }}">
<div class="icon icon--previous">{% include icon/previous.svg %}</div></a></li>
{% else %}
<li><div class="round-button inactive">
<div class="icon icon--prrevious">{% include icon/previous.svg %}</div>
</div></li>
<div class="icon icon--prrevious">{% include icon/previous.svg %}</div></div></li>
{% endif %}
{% for page in (1..paginator.total_pages) %}
{% if page == paginator.page %}
<li><div class="round-button cur">
<span>{{ page }}</span>
</div></li>
<span>{{ page }}</span></div></li>
{% elsif page == 1 %}
{% assign __path = '/' %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<li><a class="round-button"
href="{{ '/' | prepend: site.baseurl | replace: '//', '/' }}">
<span>{{ page }}</span>
</a></li>
href="{{ href }}">
<span>{{ page }}</span></a></li>
{% else %}
<li><a class="round-button" href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">
<span>{{ page }}</span>
</a></li>
{% assign __path = site.paginate_path %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<li><a class="round-button" href="{{ href | replace: ':num', page }}">
<span>{{ page }}</span></a></li>
{% endif %}
{% endfor %}
{% if paginator.next_page %}
<li><a class="round-button" href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">
<div class="icon icon--next">{% include icon/next.svg %}</div>
</a></li>
{% assign __path = paginator.next_page_path %}
{% include snippets/prepend-baseurl.html %}
{% assign href = __return %}
<li><a class="round-button" href="{{ href }}"><div class="icon icon--next">{% include icon/next.svg %}</div></a></li>
{% else %}
<li><div class="round-button inactive">
<div class="icon icon--next">{% include icon/next.svg %}</div>
</div></li>
<li><div class="round-button inactive"><div class="icon icon--next">{% include icon/next.svg %}</div></div></li>
{% endif %}
</ul>
</nav>
Expand Down
1 change: 1 addition & 0 deletions _sass/components/_article.content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
display: block;
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
margin: $content-gap 0;
border-collapse: collapse;
th, td {
Expand Down

0 comments on commit 631776d

Please sign in to comment.