diff --git a/man/cookbook/apis/site-config/readme.md b/man/cookbook/apis/site-config/readme.md index 61c6984..6f62fa2 100644 --- a/man/cookbook/apis/site-config/readme.md +++ b/man/cookbook/apis/site-config/readme.md @@ -67,7 +67,7 @@ interface CopyrightPeriod { | 属性名 | 值类型/可选值 | 默认值 | 说明 | | --- | --- | --- | --- | | `links` | `Link[]` | - | 页面底部链接 | -| `partial` | `string` | `'ksio/footer.html'` | 预置布局模板中页脚部分,可指定自定义的替换主题预置的 | +| `partial` | `string` | `'ksio/partials/footer.html'` | 预置布局模板中页脚部分,可指定自定义的替换主题预置的 | ## `header` @@ -77,7 +77,7 @@ interface CopyrightPeriod { | --- | --- | --- | --- | | `navbar` | `HeaderNavBar` | - | 页头导航栏,[详见下方](#navbar) | | `navs` | `Link[]` | - | 页面头部导航 | -| `partial` | `string` | `'ksio/header.html'` | 预置布局模板中页头部分,可指定自定义的替换主题预置的 | +| `partial` | `string` | `'ksio/partials/header.html'` | 预置布局模板中页头部分,可指定自定义的替换主题预置的 | ### `navbar` diff --git a/src/hexo/source/posts.md b/src/hexo/source/posts.md index 8157dd2..63d5429 100644 --- a/src/hexo/source/posts.md +++ b/src/hexo/source/posts.md @@ -1,6 +1,5 @@ --- title: 博客 -ksio_seo_role: writer ksio_slot_banner: _ksio/pages/posts/banner ksio_slot_content: _ksio/pages/posts/content ksio_slot_footer: _ksio/pages/posts/footer diff --git a/src/jekyll/_assets/stylesheets/local/pages/doc.scss b/src/jekyll/_assets/stylesheets/local/pages/doc.scss new file mode 100644 index 0000000..4049107 --- /dev/null +++ b/src/jekyll/_assets/stylesheets/local/pages/doc.scss @@ -0,0 +1 @@ +@import "../../ksio/pages/doc"; diff --git a/src/jekyll/_assets/stylesheets/local/pages/post.scss b/src/jekyll/_assets/stylesheets/local/pages/post.scss new file mode 100644 index 0000000..2507d13 --- /dev/null +++ b/src/jekyll/_assets/stylesheets/local/pages/post.scss @@ -0,0 +1 @@ +@import "../../ksio/pages/post"; diff --git a/src/jekyll/_assets/stylesheets/local/pages/posts.scss b/src/jekyll/_assets/stylesheets/local/pages/posts.scss new file mode 100644 index 0000000..c6a62e5 --- /dev/null +++ b/src/jekyll/_assets/stylesheets/local/pages/posts.scss @@ -0,0 +1 @@ +@import "../../ksio/pages/posts"; diff --git a/src/jekyll/_config.yml b/src/jekyll/_config.yml index d8eff34..0242a92 100644 --- a/src/jekyll/_config.yml +++ b/src/jekyll/_config.yml @@ -71,8 +71,8 @@ defaults: values: layout: ksio/doc css: - - ksio/pages/post - - ksio/pages/doc + - local/pages/post + - local/pages/doc js: - ksio/initializers/time - ksio/initializers/lazyload @@ -90,7 +90,7 @@ defaults: values: layout: ksio/post css: - - ksio/pages/post + - local/pages/post js: - ksio/initializers/time - ksio/initializers/lazyload diff --git a/src/jekyll/_includes/ksio/pages/404.html b/src/jekyll/_includes/ksio/pages/404.html new file mode 100644 index 0000000..24edfe1 --- /dev/null +++ b/src/jekyll/_includes/ksio/pages/404.html @@ -0,0 +1 @@ +

孩子,迷路了吧?来让蜀黍送你回家

diff --git a/src/jekyll/_includes/ksio/pages/posts/banner.html b/src/jekyll/_includes/ksio/pages/posts/banner.html new file mode 100644 index 0000000..7c8726d --- /dev/null +++ b/src/jekyll/_includes/ksio/pages/posts/banner.html @@ -0,0 +1,7 @@ +{% assign banner_url = "ksio/banners/blog" | asset_path %} + diff --git a/src/jekyll/_includes/ksio/pages/posts/content.html b/src/jekyll/_includes/ksio/pages/posts/content.html new file mode 100644 index 0000000..006b57f --- /dev/null +++ b/src/jekyll/_includes/ksio/pages/posts/content.html @@ -0,0 +1,98 @@ +{% assign posts = site.posts %} +{% if posts.size > 0 %} + {% assign first_post = posts.first %} + +

最近的一篇文章发表于 ——

+
+

{{ first_post.content | markdownify | strip_html | strip_newlines | escape_once | truncate: 100, "..." }}

+ +
+

想看完整内容?快戳《{{ first_post.title }}》!(((o(*゚▽゚*)o)))

+ +

本站主打三类文章,以下为快速通道:

+ + +
+ {% assign prev_post = null %} + {% assign first_post_year = posts.last.date | date: "%Y" %} + {% assign last_post_year = first_post.date | date: "%Y" %} + + {% assign current_year = site.time | date: "%Y" %} + {% assign year_duration = 10 %} + +
+

{{ last_post_year | minus: first_post_year | plus: 1 }} 年间共写了 {{ posts.size }} 篇文章。本页只显示最近十年({{ current_year | minus: year_duration | plus: 1 }} 年~{{ current_year }} 年)的文章,其他年份的文章请访问下面的年份归档页面:

+ +
+ + {% for post in posts %} + {% assign prev_year = prev_post.date | date: "%Y" %} + {% assign year = post.date | date: "%Y" %} + {% assign diff = current_year | minus: year %} + + {% if prev_post == null or year != prev_year %} + {% assign first_item = true %} + {% else %} + {% assign first_item = false %} + {% endif %} + + {% if diff < year_duration %} + {% if first_item == true %} +

{{ year }}

+ {% endif %} + +
{{ post.title }}{% if post.album %}{% endif %}{% if post.tags contains 'vlog' %}{% endif %}
+ {% endif %} + + {% assign prev_post = post %} + {% endfor %} +
+{% else %} +

暂无文章

+{% endif %} diff --git a/src/jekyll/_includes/ksio/pages/posts/footer.html b/src/jekyll/_includes/ksio/pages/posts/footer.html new file mode 100644 index 0000000..2221271 --- /dev/null +++ b/src/jekyll/_includes/ksio/pages/posts/footer.html @@ -0,0 +1,19 @@ +{% if site.posts.size > 0 %} + +{% endif %} +{% include ksio/widgets/share.html %} +{% include ksio/widgets/toc.html %} diff --git a/src/jekyll/_includes/ksio/slots/aside.html b/src/jekyll/_includes/ksio/slots/aside.html index 436cbb9..a534fd2 100644 --- a/src/jekyll/_includes/ksio/slots/aside.html +++ b/src/jekyll/_includes/ksio/slots/aside.html @@ -1,5 +1,5 @@ {% if page.ksio_slot_aside %} -
{% include "{{ page.ksio_slot_aside | replace: '.html', '' }}.html" %}
+
{% include {{ page.ksio_slot_aside | replace: ".html", "" | append: ".html" }} %}
{% else %} {% ifhascontent sidebar %}
{% contentblock sidebar %}
diff --git a/src/jekyll/_includes/ksio/slots/banner.html b/src/jekyll/_includes/ksio/slots/banner.html index f3912c7..0240dab 100644 --- a/src/jekyll/_includes/ksio/slots/banner.html +++ b/src/jekyll/_includes/ksio/slots/banner.html @@ -1,5 +1,5 @@ {% if page.ksio_slot_banner %} - {% include "{{ page.ksio_slot_banner | replace: '.html', '' }}.html" %} + {% include {{ page.ksio_slot_banner | replace: ".html", "" | append: ".html" }} %} {% else %} {% assign banner = page.banner %} {% if banner %} diff --git a/src/jekyll/_includes/ksio/slots/content.html b/src/jekyll/_includes/ksio/slots/content.html index 4e48b4c..d3afb79 100644 --- a/src/jekyll/_includes/ksio/slots/content.html +++ b/src/jekyll/_includes/ksio/slots/content.html @@ -1 +1 @@ -{% if page.ksio_slot_content %}{% include "{{ page.ksio_slot_content | replace: '.html', '' }}.html" %}{% else %}{{ content }}{% endif %} +{% if page.ksio_slot_content %}{% include {{ page.ksio_slot_content | replace: ".html", "" | append: ".html" }} %}{% else %}{{ content }}{% endif %} diff --git a/src/jekyll/_includes/ksio/slots/footer.html b/src/jekyll/_includes/ksio/slots/footer.html index e90c79c..838d101 100644 --- a/src/jekyll/_includes/ksio/slots/footer.html +++ b/src/jekyll/_includes/ksio/slots/footer.html @@ -1,5 +1,5 @@ {% if page.ksio_slot_footer %} - {% include "{{ page.ksio_slot_footer | replace: '.html', '' }}.html" %} + {% include {{ page.ksio_slot_footer | replace: ".html", "" | append: ".html" }} %} {% else %} {% ifhascontent footer %}{% contentblock footer %}{% endifhascontent %} {% ifnothascontent footer %} diff --git a/src/jekyll/_includes/ksio/slots/header.html b/src/jekyll/_includes/ksio/slots/header.html index 2ed8d24..99da335 100644 --- a/src/jekyll/_includes/ksio/slots/header.html +++ b/src/jekyll/_includes/ksio/slots/header.html @@ -1,12 +1,12 @@ {% if page.ksio_slot_header %} - {% include "{{ page.ksio_slot_header | replace: '.html', '' }}.html" %} + {% include {{ page.ksio_slot_header | replace: ".html", "" | append: ".html" }} %} {% else %} {% ifhascontent header_content %} {% contentblock header_content %} {% endifhascontent %} {% ifnothascontent header_content %} {% if page.ksio_slot_title %} -

{% include "{{ page.ksio_slot_title | replace: '.html', '' }}.html" %}

+

{% include {{ page.ksio_slot_title | replace: ".html", "" | append: ".html" }} %}

{% else %} {% ifhascontent post_title %}

{% contentblock post_title %}

@@ -16,7 +16,7 @@

{{ page.title }}

{% endifnothascontent %} {% endif %} {% if page.ksio_slot_meta %} - {% include "{{ page.ksio_slot_meta | replace: '.html', '' }}.html" %} + {% include {{ page.ksio_slot_meta | replace: ".html", "" | append: ".html" }} %} {% else %} {% ifhascontent post_meta %} {% contentblock post_meta %} diff --git a/src/jekyll/_layouts/ksio/default.html b/src/jekyll/_layouts/ksio/default.html index 2f9eb86..35d5170 100644 --- a/src/jekyll/_layouts/ksio/default.html +++ b/src/jekyll/_layouts/ksio/default.html @@ -8,7 +8,7 @@ {% endif %} - {% include ksio/head.html %} + {% include ksio/partials/head.html %} {% if site.ksio.social.comment.disqus.proxy %}{% stylesheet ksio/vendors/disqusjs.min %}{% endif %} {% stylesheet global %} diff --git a/src/jekyll/_layouts/ksio/index.html b/src/jekyll/_layouts/ksio/index.html new file mode 100644 index 0000000..6eb4888 --- /dev/null +++ b/src/jekyll/_layouts/ksio/index.html @@ -0,0 +1,14 @@ +--- +layout: ksio/default +--- + +{% include {{ site.ksio.header.partial | default: "ksio/partials/header.html" }} %} +
+
+
+

{{ site.title }}

+

{{ site.tagline | default: site.description }}

+
+
+
+{% include {{ site.ksio.footer.partial | default: "ksio/partials/footer.html" }} %} diff --git a/src/jekyll/_pages/404.html b/src/jekyll/_pages/404.html index 39641fb..3b4debb 100644 --- a/src/jekyll/_pages/404.html +++ b/src/jekyll/_pages/404.html @@ -6,4 +6,4 @@ permalink: 404.html --- -

孩子,迷路了吧?来让蜀黍送你回家

+{% include ksio/pages/404.html %} diff --git a/src/jekyll/_pages/about.md b/src/jekyll/_pages/about.md index 57f7325..9894a6f 100644 --- a/src/jekyll/_pages/about.md +++ b/src/jekyll/_pages/about.md @@ -13,8 +13,3 @@ title: 关于本站 {:#donation} 若您正在使用或喜欢本主题,请考虑[请我喝杯咖啡]({{ sponsor_url }}#donation){:target="_blank"}{:rel="external nofollow"}以表心意;也许除了本主题之外,还看好[我写的文章](https://ourai.ws/posts/?{{ utm_params }}){:target="_blank"}{:rel="external nofollow"}和[其他作品](https://oss.ourai.ws/?{{ utm_params }}){:target="_blank"}{:rel="external nofollow"},希望能够保持长期且高质量的产出,也可以考虑[赞助]({{ sponsor_url }}#sponsor){:target="_blank"}{:rel="external nofollow"}我,感激不尽! - -{% contentfor footer %} - {% include ksio/widgets/share.html %} - {% include ksio/widgets/toc.html %} -{% endcontentfor %} diff --git a/src/jekyll/_pages/guides.md b/src/jekyll/_pages/guides.md index b26859b..2d4cf79 100644 --- a/src/jekyll/_pages/guides.md +++ b/src/jekyll/_pages/guides.md @@ -2,8 +2,8 @@ title: 概述 layout: ksio/doc css: - - ksio/pages/post - - ksio/pages/doc + - local/pages/post + - local/pages/doc js: - ksio/initializers/time - ksio/initializers/lazyload diff --git a/src/jekyll/_pages/index.html b/src/jekyll/_pages/index.html index ba662d6..39b5098 100644 --- a/src/jekyll/_pages/index.html +++ b/src/jekyll/_pages/index.html @@ -5,7 +5,7 @@ permalink: index.html --- -{% include ksio/header.html %} +{% include ksio/partials/header.html %}
diff --git a/src/jekyll/_pages/posts.html b/src/jekyll/_pages/posts.html index 71d61fe..d64cce5 100644 --- a/src/jekyll/_pages/posts.html +++ b/src/jekyll/_pages/posts.html @@ -1,136 +1,8 @@ --- title: 博客 -css: - - ksio/pages/posts +ksio_slot_banner: ksio/pages/posts/banner +ksio_slot_content: ksio/pages/posts/content +ksio_slot_footer: ksio/pages/posts/footer +ksio_asset_css: + - local/pages/posts --- - -{% contentfor post_banner %} - {% assign banner_url = "ksio/banners/blog" | asset_path %} - -{% endcontentfor %} - -{% contentfor footer %} - {% if site.posts.size > 0 %} - - {% endif %} - {% include ksio/widgets/share.html %} - {% include ksio/widgets/toc.html %} -{% endcontentfor %} - -{% assign posts = site.posts %} -{% if posts.size > 0 %} - {% assign first_post = posts.first %} - -

最近的一篇文章发表于 ——

-
-

{{ first_post.content | markdownify | strip_html | strip_newlines | escape_once | truncate: 100, "..." }}

-
{{ first_post.author.name }}
-
-

想看完整内容?快戳《{{ first_post.title }}》!(((o(*゚▽゚*)o)))

- -

本站主打三类文章,以下为快速通道:

- - -
- {% assign prev_post = null %} - {% assign first_post_year = posts.last.date | date: "%Y" %} - {% assign last_post_year = first_post.date | date: "%Y" %} - - {% assign current_year = site.time | date: "%Y" %} - {% assign year_duration = 10 %} - -
-

{{ last_post_year | minus: first_post_year | plus: 1 }} 年间共写了 {{ posts.size }} 篇文章。本页只显示最近十年({{ current_year | minus: year_duration | plus: 1 }} 年~{{ current_year }} 年)的文章,其他年份的文章请访问下面的年份归档页面:

-
    - {% for post in posts %} - {% assign prev_year = prev_post.date | date: "%Y" %} - {% assign year = post.date | date: "%Y" %} - {% assign diff = current_year | minus: year %} - - {% if prev_post == null or year != prev_year %} - {% assign first_item = true %} - {% else %} - {% assign first_item = false %} - {% endif %} - - {% if diff >= year_duration %} - {% if first_item == true %} - {% assign year_posts = 0 %} - - {% for p in site.posts %} - {% assign y = p.date | date: "%Y" %} - - {% if y == year %} - {% assign year_posts = year_posts | plus: 1 %} - {% endif %} - {% endfor %} - -
  • {{ year }}共 {{ year_posts }} 篇
  • - {% else %} - {% continue %} - {% endif %} - {% endif %} - - {% assign prev_post = post %} - {% endfor %} -
-
- - {% for post in posts %} - {% assign prev_year = prev_post.date | date: "%Y" %} - {% assign year = post.date | date: "%Y" %} - {% assign diff = current_year | minus: year %} - - {% if prev_post == null or year != prev_year %} - {% assign first_item = true %} - {% else %} - {% assign first_item = false %} - {% endif %} - - {% if diff < year_duration %} - {% if first_item == true %} -

{{ year }}

- {% endif %} - -
{{ post.title }}{% if post.album %}{% endif %}{% if post.tags contains 'vlog' %}{% endif %}
- {% endif %} - - {% assign prev_post = post %} - {% endfor %} -
-{% else %} -

暂无文章

-{% endif %}