From ccc558dabba4549ae1775a0534009099fedc4dc4 Mon Sep 17 00:00:00 2001 From: kitian616 Date: Sun, 10 Dec 2017 12:23:31 +0800 Subject: [PATCH] feat: add paths.base config & paths config surpport http:// | https:// --- _config.demo.yml | 9 +++++---- _config.dev.yml | 1 + _config.yml | 1 + _includes/blog/header.html | 31 +++++++++++++++++++++++-------- test/_config.yml | 1 + 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/_config.demo.yml b/_config.demo.yml index 3df61a801f2..231b5a1acd1 100644 --- a/_config.demo.yml +++ b/_config.demo.yml @@ -28,10 +28,11 @@ nav_lists: zh-Hant: 關於 url: /about.html -# paths: -# home: / -# all: /all.html -# rss: /feed.xml +paths: + base: / + home: https://github.com/kitian616/jekyll-TeXt-theme/ + # all: /all.html + # rss: /feed.xml ## GitHub repository (if the site is hosted by GitHub) ## repository: kitian616/jekyll-TeXt-theme diff --git a/_config.dev.yml b/_config.dev.yml index bebfc524a69..347d5215ed9 100644 --- a/_config.dev.yml +++ b/_config.dev.yml @@ -29,6 +29,7 @@ nav_lists: url: /about.html paths: + base: / home: / all: /all.html rss: /feed.xml diff --git a/_config.yml b/_config.yml index 3f19661bbcb..ea524dbcf6d 100644 --- a/_config.yml +++ b/_config.yml @@ -27,6 +27,7 @@ nav_lists: url: /about.html # paths: +# base: / # home: / # all: /all.html # rss: /feed.xml diff --git a/_includes/blog/header.html b/_includes/blog/header.html index 6fddc23215c..392d47ca698 100644 --- a/_includes/blog/header.html +++ b/_includes/blog/header.html @@ -1,21 +1,36 @@
- {% if site.paths.home %} - {% assign __path = site.paths.home %} + {% if site.paths.base %} + {% assign __path = site.paths.base %} {% else %} {% assign __path = '/' %} {% endif %} - {% include snippets/prepend-baseurl.html %} + {% assign pre7 = __path | slice: 0, 7 %} {% assign pre8 = __path | slice: 0, 8 %} + {% if pre7 == 'http://' or pre8 == 'https://' %} + {% assign href = __path %} + {% else %} + {% include snippets/prepend-baseurl.html %} + {% assign href = __return %} + {% endif %} {% if site.title %} - {{ site.title }} + {{ site.title }} {% endif %}