-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
135 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
title: 页面配置 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
页面配置即定义在 Front Matter 中的变量,除了会用到静态网站生成器预定义与约定俗成的变量之外,本主题也自定义了一些—— | ||
|
||
## SEO | ||
|
||
影响生成 SEO 相关信息的变量: | ||
|
||
| 变量名 | 值类型/可选值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `ksio_seo_title` | `string` | 显示在 `<title>` 中的页面标题,不指定则使用 `title` | | ||
| `ksio_seo_role` | `'writer' | 'developer'` | 根据角色生成特定的页面描述 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,124 +1,162 @@ | ||
在 `_config.yml` 文件中声明的用于控制主题预置渲染逻辑的配置项,它们都挂在 `ksio` 下面,通过 `site.ksio` 访问—— | ||
在网站配置文件中声明的用于控制主题预置渲染逻辑的配置项,整体是个多层嵌套的对象,在本文档中的表现形式为: | ||
|
||
配置项「值类型」有 `Link` 字样的,代表 `Link` 是一个描述链接信息的对象,用 TypeScript 的类型表现为: | ||
1. 一级属性会作为二级标题,然后紧接着是对其的简单说明; | ||
2. 二级属性列在表格中,若需要更为详细的解释,则会另起三级标题; | ||
3. 三级及以下层级的属性会以 TypeScript 的类型定义的方式呈现。 | ||
|
||
{% highlight typescript %} | ||
当配置项「值类型」有 `Link` 字样的,代表 `Link` 是一个描述链接信息的对象: | ||
|
||
```typescript | ||
interface Link { | ||
text: string; | ||
url?: string; | ||
children?: Link[]; | ||
} | ||
{% endhighlight %} | ||
|
||
可用配置项有: | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `master` | `object` | - | 站长信息,[详见下方](#master) | | ||
| `meta` | `object` | - | 网站信息,[详见下方](#meta) | | ||
| `brand` | `object` | - | 品牌相关配置,主要控制页头左上角的链接与文本,[详见下方](#brand) | | ||
| `copyright` | `object` | - | 网站版权声明,[详见下方](#copyright) | | ||
| `header` | `object` | - | 页面头部,[详见下方](#header) | | ||
| `footer` | `object` | - | 页面底部,[详见下方](#footer) | | ||
| `social` | `object` | - | 社交相关功能的开关与配置,[详见下方](#social) | | ||
| `seo` | `object` | - | SEO 相关配置,[详见下方](#seo) | | ||
| `statistic` | `object` | - | 数据统计相关配置,[详见下方](#statistic) | | ||
``` | ||
|
||
## `master` | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `name` | `string` | `site.author.name` | 站长名称 | | ||
|
||
## `meta` | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `url` | `string` | - | 网站发布后的访问链接 | | ||
为方便查找,以下内容按字母顺序排列—— | ||
|
||
## `brand` | ||
|
||
品牌相关配置,主要控制页头左上角的链接与文本。 | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `text` | `string` | `site.title` | 当前网站品牌所要显示的文本,不指定则显示网站标题 | | ||
| `color` | `string` | - | 品牌主题色,[详见下方](#color) | | ||
| `icon` | `string` | `'ksio/favicon.ico'` | 品牌图标,[详见下方](#icon) | | ||
| `parent` | `Link` | - | 当前网站的父品牌,指定后会在当前网站品牌的左边显示 | | ||
| `text` | `string` | 网站标题 | 当前网站品牌所要显示的文本,不指定则显示网站标题 | | ||
|
||
### `color` | ||
|
||
设置之后,会在 `<head>` 标签内生成 [`<meta name="theme-color" content="指定主题色">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color){:target="_blank"}{:rel="external "}。 | ||
|
||
### `icon` | ||
|
||
除了会通过 `<link rel="icon" href="指定图标">` 显示在网页浏览器标签中以外,还会用于 SEO 等其他信息中。 | ||
|
||
## `copyright` | ||
|
||
网站版权声明。 | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `fragments` | `string` | - | 显示在版权声明右侧的额外信息,[详见下方](#fragments) | | ||
| `owner` | `Link` | - | 版权所有人,默认使用网站标题与地址 | | ||
| `period` | `object` | - | 有效期间,[详见下方](#period) | | ||
| `period` | `CopyrightPeriod` | - | 有效期间,[详见下方](#period) | | ||
| `provider` | `boolean` | `true` | 是否显示主题与提供者声明 | | ||
|
||
### `period` | ||
### `fragments` | ||
|
||
值是可以包含 HTML 的字符串,最好每段内容都包含在 `<p>` 标签中,相邻的 `<p>` 标签之间会显示一个垂直的分隔符。 | ||
|
||
结构、默认值与说明如下: | ||
若 `provider` 没设为 `false`,整个内容会显示在主题与提供者声明右侧。 | ||
|
||
{% highlight js %} | ||
{ | ||
start: 当前年份, // 起始时间,一般只有年份 | ||
### `period` | ||
|
||
```typescript | ||
interface CopyrightPeriod { | ||
start?: Date | string | number; // 起始时间,一般只有年份,默认使用网站构建时间 | ||
} | ||
{% endhighlight %} | ||
``` | ||
|
||
## `footer` | ||
|
||
页面底部。 | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `links` | `Link[]` | - | 页面底部链接 | | ||
| `partial` | `string` | `'ksio/footer.html'` | 预置布局模板中页脚部分,可指定自定义的替换主题预置的 | | ||
|
||
## `header` | ||
|
||
页面头部。 | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `partial` | `string` | `'ksio/header.html'` | 预置布局模板中页头部分,可指定自定义的替换主题预置的 | | ||
| `navbar` | `HeaderNavBar` | - | 页头导航栏,[详见下方](#navbar) | | ||
| `navs` | `Link[]` | - | 页面头部导航 | | ||
| `navbar` | `object` | - | 页头导航栏,[详见下方](#navbar) | | ||
| `partial` | `string` | `'ksio/header.html'` | 预置布局模板中页头部分,可指定自定义的替换主题预置的 | | ||
|
||
### `navbar` | ||
|
||
结构、默认值与说明如下: | ||
|
||
{% highlight js %} | ||
{ | ||
placement: 'left', // 导航菜单显示位置 | ||
```typescript | ||
interface HeaderNavBar { | ||
placement?: 'left' | 'right'; // 导航菜单显示位置,默认为 `'left'` | ||
} | ||
{% endhighlight %} | ||
|
||
## `footer` | ||
``` | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `partial` | `string` | `'ksio/footer.html'` | 预置布局模板中页脚部分,可指定自定义的替换主题预置的 | | ||
| `links` | `Link[]` | - | 页面底部链接 | | ||
## `master` | ||
|
||
## `social` | ||
站长信息。 | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `feed` | `object` | - | feed 订阅功能,[详见下方](#feed) | | ||
| `share` | `boolean` | `false` | 是否启用将页面分享到其他 SNS 的按钮 | | ||
| `comment` | `object` | - | 评论功能,[详见下方](#comment) | | ||
| `name` | `string` | - | 站长名称,[详见下方](#name) | | ||
|
||
### `feed` | ||
### `name` | ||
|
||
结构、默认值与说明如下: | ||
在使用 Jekyll 时,一般会在网站配置文件中定义一个 `author`,因此在 Jekyll 中使用本主题时若没指定 `name` 则会使用 `site.author.name`。 | ||
|
||
{% highlight js %} | ||
{ | ||
rss: false, // 是否生成 RSS feed | ||
atom: false, // 是否生成 Atom feed | ||
} | ||
{% endhighlight %} | ||
## `meta` | ||
|
||
### `comment` | ||
网站信息。 | ||
|
||
待补充。 | ||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `url` | `string` | - | 网站发布后的访问链接 | | ||
|
||
## `seo` | ||
|
||
SEO 相关配置。 | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `suffix` | `boolean` | `true` | 是否在 `<title>` 中将站名作为后缀拼接 | | ||
|
||
## `social` | ||
|
||
社交相关功能的开关与配置。 | ||
|
||
| 属性名 | 值类型/可选值 | 默认值 | 说明 | | ||
| --- | --- | --- | --- | | ||
| `comment` | `SocialComment` | - | 评论功能,[详见下方](#comment) | | ||
| `feed` | `SocialFeed` | - | feed 订阅功能,[详见下方](#feed) | | ||
| `share` | `boolean` | `true` | 是否启用将页面分享到其他 SNS 的按钮 | | ||
|
||
### `comment` | ||
|
||
```typescript | ||
interface SocialComment { | ||
// Disqus | ||
disqus?: { | ||
shortname: string; // Disqus 上注册的网站名 | ||
// 以下几个配置项是在无法加载 Disqus 的情况下的代理, | ||
// 默认为 DisqusJS(详见 https://disqusjs.skk.moe/) | ||
proxy?: { | ||
endpoint: string; // 用于 DisqusJS 的 `api` 配置项 | ||
key: string; // 用于 DisqusJS 的 `apikey` 配置项 | ||
}; | ||
username?: string; // 用于 DisqusJS 的 `admin` 配置项 | ||
label?: string; // 用于 DisqusJS 的 `adminLabel` 配置项 | ||
}; | ||
// 多说 | ||
duoshuo?: { | ||
shortname?: string; | ||
}; | ||
} | ||
``` | ||
|
||
### `feed` | ||
|
||
```typescript | ||
interface SocialFeed { | ||
rss?: boolean; // 是否生成 RSS feed,默认为 `false`,会用到 `meta.url` | ||
atom?: boolean; // 是否生成 Atom feed,默认为 `false` | ||
} | ||
``` | ||
|
||
## `statistic` | ||
|
||
待补充。 | ||
数据统计相关配置,待补充。 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,5 +169,3 @@ ksio: | |
url: /about/ | ||
- text: 资助 | ||
url: /about/#donation | ||
social: | ||
share: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ cookbook: | |
collection: apis | ||
items: | ||
- site-config | ||
- page-config | ||
- html-reuse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters