This commit is contained in:
186526 2020-12-19 22:55:12 +08:00
commit ddecaf82dd
Signed by untrusted user: 186526
GPG Key ID: C7EB1E6B8CC5E51D
406 changed files with 28378 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
.DS_Store
Thumbs.db
db.json
*.log
node_modules/
public/
.deploy*/
.vercel

0
_config.landscape.yml Normal file
View File

125
_config.yml Normal file
View File

@ -0,0 +1,125 @@
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site
title: 186526's Blog
subtitle: "Just a blog"
description: ""
keywords: "Blog,Frontend,node.js"
author: "186526"
language: zh-CN
timezone: "Asia/Shanghai"
# URL
## If your site is put in a subdirectory, set url as 'http://example.com/child' and root as '/child/'
url: https://blog.186526.xyz
root: /
permalink: post/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks
# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
enable: true # Open external links in new tab
field: site # Apply to the whole site
exclude: ""
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: false
line_number: false
auto_detect: false
tab_replace: false
wrap: false
hljs: false
prismjs:
enable: false
preprocess: true
line_number: true
tab_replace: ""
# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
path: ""
per_page: 10
order_by: -date
# Category & Tag
default_category: uncategorized
category_map:
tag_map:
# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true
# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## updated_option supports 'mtime', 'date', 'empty'
updated_option: "mtime"
# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page
# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
exclude:
ignore:
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: suka
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: ""
suka_theme:
search:
enable: true
path: search.json
field: post # Page | Post | All. Default post
prism:
enable: true
line_number: true
theme: default
feed:
type: atom
path: atom.xml
limit: 20
hub:
content:
content_limit:
content_limit_delim: " "

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "yarn --cwd ./themes/suka --production;hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"hexo": {
"version": "5.3.0"
},
"dependencies": {
"hexo": "^5.0.0",
"hexo-generator-archive": "^1.0.0",
"hexo-generator-category": "^1.0.0",
"hexo-generator-feed": "^3.0.0",
"hexo-generator-index": "^2.0.0",
"hexo-generator-tag": "^1.0.0",
"hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^3.0.0",
"hexo-renderer-stylus": "^2.0.0",
"hexo-server": "^2.0.0",
"hexo-theme-landscape": "^0.0.3"
}
}

4
scaffolds/draft.md Normal file
View File

@ -0,0 +1,4 @@
---
title: {{ title }}
tags:
---

4
scaffolds/page.md Normal file
View File

@ -0,0 +1,4 @@
---
title: {{ title }}
date: {{ date }}
---

5
scaffolds/post.md Normal file
View File

@ -0,0 +1,5 @@
---
title: {{ title }}
date: {{ date }}
tags:
---

View File

@ -0,0 +1,414 @@
---
title: 如何使用debootstrap构建一个最小化的Ubuntu
date: 2020-12-19 22:39:33
tags:
- Ubuntu
- Linux
- Debootstrap
---
> debootstrap是debian及其附属分支下的一个工具用来构建一套基本的系统(根文件系统)。生成的目录符合Linux文件系统标准(FHS),即包含了/boot、/etc、/bin、/usr等等目录但它比发行版本的Linux体积小很多
<!--more-->
## 0.0 debootstrap介绍
### 0.1 啥是debootstrap
debootstrap是debian及其附属分支下的一个工具用来构建一套基本的系统(根文件系统)。生成的目录符合Linux文件系统标准(FHS),即包含了/boot、/etc、/bin、/usr等等目录但它比发行版本的Linux体积小很多
~~似曾相识燕归来~~
### 0.2 debootstrap有啥用
debootstrap可以用来快速 简便的构建一个最小化的debian及其附属分支的最小化rootfs
我们可以用其构建一个最小化的rootfs (主要是这个相较于 Ubuntu Server版本还是小得多)
### 0.3 如何使用debootstrap
其实 使用debootstrap很简单 他已经被放入到默认源了 我们只需要apt install即可
``` bash
sudo apt install debootstrap
```
如何使用呢 ~~自己看~~ 详情wiki
```bash
sudo debootstrap [--arch 架构(可选项)][发行版本] [目录] [映像源(可选项)]
```
## 1.0 开始动手构建自己的Ubuntu
我们这里使用Ubuntu Server 20.04作为Live CD来进行构建
### 1.1 进入Shell并安装debootstrap
![Ubuntu ISO shell](https://cdn.jsdelivr.net/gh/186526/jsdelivr@master/img/Ubuntu%20ISO.png)
1. 点击Help
2. Enter Shell
3. 可选修改sources.list
4. update sourcelist并安装debootstrap
``` bash
$ sudo apt update && apt install debootstrap
Ign:1 cdrom://Ubuntu-Server 20.04 LTS _Focal Fossa_ - Release amd64 (20200423) focal InRelease
Hit:2 cdrom://Ubuntu-Server 20.04 LTS _Focal Fossa_ - Release amd64 (20200423) focal Release
Get:4 http://mirrors.aliyun.com/ubuntu focal InRelease [265 kB]
Get:5 http://mirrors.aliyun.com/ubuntu focal-updates InRelease [107 kB]
Get:6 http://mirrors.aliyun.com/ubuntu focal-backports InRelease [98.3 kB]
Get:7 http://mirrors.aliyun.com/ubuntu focal-security InRelease [107 kB]
Get:8 http://mirrors.aliyun.com/ubuntu focal/main amd64 Packages [970 kB]
Get:9 http://mirrors.aliyun.com/ubuntu focal/main Translation-en [506 kB]
Get:10 http://mirrors.aliyun.com/ubuntu focal/main amd64 c-n-f Metadata [29.5 kB]
Get:11 http://mirrors.aliyun.com/ubuntu focal/restricted amd64 Packages [22.0 kB]
Get:12 http://mirrors.aliyun.com/ubuntu focal/restricted Translation-en [6212 B]
Get:13 http://mirrors.aliyun.com/ubuntu focal/restricted amd64 c-n-f Metadata [392 B]
Get:14 http://mirrors.aliyun.com/ubuntu focal/universe amd64 Packages [8628 kB]
Get:15 http://mirrors.aliyun.com/ubuntu focal/universe Translation-en [5124 kB]
Get:16 http://mirrors.aliyun.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Get:17 http://mirrors.aliyun.com/ubuntu focal/multiverse amd64 Packages [144 kB]
Get:18 http://mirrors.aliyun.com/ubuntu focal/multiverse Translation-en [104 kB]
Get:19 http://mirrors.aliyun.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9136 B]
Get:20 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 Packages [197 kB]
Get:21 http://mirrors.aliyun.com/ubuntu focal-updates/main Translation-en [77.7 kB]
Get:22 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 c-n-f Metadata [5676 B]
Get:23 http://mirrors.aliyun.com/ubuntu focal-updates/restricted amd64 Packages [11.0 kB]
Get:24 http://mirrors.aliyun.com/ubuntu focal-updates/restricted Translation-en [3000 B]
Get:25 http://mirrors.aliyun.com/ubuntu focal-updates/restricted amd64 c-n-f Metadata [116 B]
Get:26 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 Packages [110 kB]
Get:27 http://mirrors.aliyun.com/ubuntu focal-updates/universe Translation-en [51.9 kB]
Get:28 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [4092 B]
Get:29 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse amd64 Packages [1172 B]
Get:30 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse Translation-en [540 B]
Get:31 http://mirrors.aliyun.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [116 B]
Get:32 http://mirrors.aliyun.com/ubuntu focal-backports/main amd64 c-n-f Metadata [112 B]
Get:33 http://mirrors.aliyun.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
Get:34 http://mirrors.aliyun.com/ubuntu focal-backports/universe amd64 Packages [2784 B]
Get:35 http://mirrors.aliyun.com/ubuntu focal-backports/universe Translation-en [1272 B]
Get:36 http://mirrors.aliyun.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [192 B]
Get:37 http://mirrors.aliyun.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
Get:38 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 Packages [106 kB]
Get:46 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 c-n-f Metadata [1612 B]
Get:47 http://mirrors.aliyun.com/ubuntu focal-security/multiverse amd64 Packages [1172 B]
Get:48 http://mirrors.aliyun.com/ubuntu focal-security/multiverse Translation-en [540 B]
Get:49 http://mirrors.aliyun.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [116 B]
Fetched 17.1 MB in 6s (3096 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
65 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
arch-test squid-deb-proxy-client
The following NEW packages will be installed:
debootstrap
0 upgraded, 1 newly installed, 0 to remove and 65 not upgraded.
Need to get 39.4 kB of archives.
After this operation, 299 kB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 debootstrap all 1.0.118ubuntu1.1 [39.4 kB]
Fetched 39.4 kB in 0s (221 kB/s)
Selecting previously unselected package debootstrap.
(Reading database ... 33860 files and directories currently installed.)
Preparing to unpack .../debootstrap_1.0.118ubuntu1.1_all.deb ...
Unpacking debootstrap (1.0.118ubuntu1.1) ...
Setting up debootstrap (1.0.118ubuntu1.1) ...
Processing triggers for man-db (2.9.1-1) ...
$ debootstrap
I: usage: [OPTION]... <suite> <target> [<mirror> [<script>]]
I: Try `debootstrap --help' for more information.
E: You must specify a suite and a target.
```
### 1.2 给硬盘分区
这步没啥好说的 用cfdisk进行分区 使用mkfs.ext4来格式化硬盘请记住如何分区的后面编写fstab会涉及到
| /dev路径 | 挂载位置 | 分区模式 | 作用 |
| --------- | -------- | -------- | ----------- |
| /dev/sda1 | /boot | fat32 | 负责efi引导 |
| /dev/sda2 | swap | swap | 内存交换 |
| /dev/sda3 | / | ext4 | 根目录 |
```bash
$ mkfs.ext4 /dev/sda3
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 9311995 4k blocks and 2330160 inodes
Filesystem UUID: fbe7f7fe-1997-4ab3-929f-52aa73aa72eb
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done
$ mkswap /dev/sda2
Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)s
no label, UUID=9fe83e8e-cd78-4a25-8a1e-ab305181c46d
$ swapon /dev/sda2
$ mkfs.vfat /dev/sda1
mkfs.fat 4.1 (2017-01-24)
```
### 1.3 挂载分区并释放rootfs
这里构建选择最新的Focal X86_64位
```bash
$ mkdir /target
$ mount /dev/sda3 /target
$ debootstrap focal /target http://mirrors.aliyun.com/ubuntu
I: Retrieving InRelease
I: Checking Release signature
I: Valid Release signature (key id F6ECB3762474EDA9D21B7022871920D1991BC93C)
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://mirrors.aliyun.com/ubuntu...
I: Retrieving adduser 3.118ubuntu2
I: Validating adduser 3.118ubuntu2
I: Retrieving apt 2.0.2
I: Validating apt 2.0.2
…………………………………………………………
I: Configuring console-setup...
I: Configuring kbd...
I: Configuring ubuntu-minimal...
I: Configuring libc-bin...
I: Configuring systemd...
I: Configuring ca-certificates...
I: Base system installed successfully. ##当你看到这句时 说明你的操作没有问题
```
### 1.4 chroot并进行基本设置
#### 1.4.1 修改软件源
默认rootfs中的软件源不完整 我们这里cp一下live cd的软件源
``` bash
cp /etc/apt/sources.list /target/etc/apt/sources.list;sed -i 3d /target/etc/apt/sources.list
```
``` bash
$ cat >> /target/etc/apt/sources.list << EOF
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted
# deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ focal universe
# deb-src http://mirrors.aliyun.com/ubuntu/ focal universe
deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/ focal multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ focal-security universe
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security universe
deb http://mirrors.aliyun.com/ubuntu/ focal-security multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security multiverse
```
#### 1.4.2 编写fstab
这里推荐一下这篇文章 [linux之fstab文件详解 来自csdn richerg85](https://blog.csdn.net/richerg85/article/details/17917129)
fstab主要由这几部分组成
``` text
<file system> <dir> <type> <options> <dump> <pass>
/dev下的位置挂载位置文件系统挂载参数dump 工具通过它决定何时作备份fsck 读取 <pass> 的数值来决定需要检查的文件系统的检查顺序。)
```
这里以我的fstab文件作为实例
```bash
$ cat >> /target/etc/fstab << EOF
tmpfs /tmp tmpfs nodev,nosuid 0 0
/dev/sda2 none swap defaults 0 0
/dev/sda3 / ext4 defaults,noatime 0 0
```
#### 1.4.3 chroot进入系统
先挂载efi分区
```bash
mkdir /target/boot/efi && \
mount /dev/sda1 /target/boot/efi
```
挂载proc等分区
```bash
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /target$i; done
```
挂载并安装grub和kernel(这里安装的是虚拟化内核)
```bash
$ sudo chroot /target
$ sudo passwd ##配置passwd
New password:
Retype new password:
passwd: password updated successfully
$ sudo apt install grub-efi-amd64 linux-virtual -y ##安装grub和kernel
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
efibootmgr gettext-base grub-common grub-efi-amd64-bin grub-efi-amd64-signed grub2-common libefiboot1 libefivar1
libfreetype6 libfuse2 libpng16-16 linux-headers-generic linux-headers-virtual os-prober sbsigntool secureboot-db
Suggested packages:
rvice.
Running in chroot, ignoring request: daemon-reload
Running in chroot, ignoring request: is-active
Running in chroot, ignoring request: start
Setting up libefiboot1:amd64 (37-2ubuntu2) ...
Setting up linux-virtual (5.4.0.26.32) ...
Setting up libfreetype6:amd64 (2.10.1-2) ...
Setting up efibootmgr (17-1) ...
Setting up grub-common (2.04-1ubuntu26) ...
Running in chroot, ignoring request: daemon-reload
Running in chroot, ignoring request: daemon-reload
Running in chroot, ignoring request: is-active
Running in chroot, ignoring request: restart
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Running in chroot, ignoring request: daemon-reload
Running in chroot, ignoring request.
Running in chroot, ignoring request: daemon-reload
Running in chroot, ignoring request: is-active
Running in chroot, ignoring request: restart
Setting up os-prober (1.74ubuntu2) ...
Setting up grub-efi-amd64-bin (2.04-1ubuntu26) ...
Setting up grub2-common (2.04-1ubuntu26) ...
Setting up grub-efi-amd64 (2.04-1ubuntu26) ...
Setting up grub-efi-amd64-signed (1.142+2.04-1ubuntu26) ...
Processing triggers for systemd (245.4-4ubuntu3) ...
Running in chroot, ignoring request: daemon-reload
Processing triggers for libc-bin (2.31-0ubuntu9) ...
```
#### 1.4.4 安装grub2
```bash
$ grub-install /dev/sda
update-grub Installing for x86_64-efi platform.
Installation finished. No error reported.
$ update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-26-generic
Found initrd image: /boot/initrd.img-5.4.0-26-generic
Adding boot menu entry for UEFI Firmware Settings
done
```
#### 1.4.5 设置网络
Ubuntu 18.04及其上的Server版本默认使用systemd-networkd联网
先使用ip a获取设备
```bash
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 ## ens33就是网络设备
link/ether 00:0c:29:9d:a0:73 brd ff:ff:ff:ff:ff:ff
inet 192.168.57.140/24 brd 192.168.57.255 scope global dynamic ens33
valid_lft 5433596sec preferred_lft 5433596sec
inet6 fe80::20c:29ff:fe9d:a073/64 scope link
valid_lft forever preferred_lft forever
```
配置所有网卡DHCP联网
```bash
$ cat >> /etc/systemd/network/ens33.network << EOF
[Match]
Name=*
[Network]
DHCP=both
```
#### 1.4.6 重启
```bash
$ exit
exit
reboot
```
PS: 第一次开机会有一点点慢(就亿点点)
### 1.5 重启并配置网络
启动systemd-networkd
```bash
$ systemctl enable --now systemd-networkd
Created symlink /etc/systemd/system/dbus-org.freedesktop.network1.service → /lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-networkd.service → /lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/sockets.target.wants/systemd-networkd.socket → /lib/systemd/system/systemd-networkd.socket.
Created symlink /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service → /lib/systemd/system/systemd-networkd-wait-online.service.
```
修改hostname并添加hosts
```bash
$ hostnamectl set-hostname vm-ubuntu-test
$ cat >> /etc/hosts << EOF
127.0.0.1 vm-ubuntu-test localhost
::1 vm-ubuntu-test localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
```
最后reboot生效
享受全新的ubuntu体验吧

View File

@ -0,0 +1,39 @@
---
title: Hello World
---
Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues).
<!--more-->
## Quick Start
### Create a new post
``` bash
$ hexo new "My New Post"
```
More info: [Writing](https://hexo.io/docs/writing.html)
### Run server
``` bash
$ hexo server
```
More info: [Server](https://hexo.io/docs/server.html)
### Generate static files
``` bash
$ hexo generate
```
More info: [Generating](https://hexo.io/docs/generating.html)
### Deploy to remote sites
``` bash
$ hexo deploy
```
More info: [Deployment](https://hexo.io/docs/one-command-deployment.html)

View File

@ -0,0 +1,97 @@
---
title: Onemanager-php 缓存0->1
date: 2020-12-19 22:32:27
tags:
- Onemanager-php
- Cloudflare
- Worker
---
因为一些众所周知的原因 你需要将OneManager-php站点使用 `Cloudflare` 那么这篇文章貌似就有用了(
<!--more-->
## 目录
1. [可自定义域名](#VPS、网站空间、Heroku-绑卡及其他可自定义域名情况下)
2. [不可自定义](#Heroku-不绑定卡等不可自定义域名)
3. [检查缓存](#Check-Cache)
## VPS、网站空间、Heroku 绑卡及其他可自定义域名情况下
在这种情况下 只需要配置 Cloudflare 的页面规则即可
1. 第一条规则 配置到`<OM域名>/*`上:
- 缓存级别请使用缓存全部内容
- 浏览器缓存看心情设置
- 边缘缓存建议设置 8 小时(该项即为索引的 cf cdn 缓存时间)
- 若已经配置网站空间缓存规则可开缓存控制 否则不开启
- 可开启 Always Online 以及 Auto Minify
2. 第二条规则 配置到`<OM域名>/*?*`上:
- 浏览器缓存配置看心情设置
- 边缘缓存建议配置 8 小时
- 缓存级别请使用没有查询字符串
- 若已经配置网站空间缓存规则可开缓存控制 否则不开启
- 可开启 Always Online 以及 Auto Minify
3. 第三条缓存 配置到`<OM页面>/*nocache*`上:
- 缓存级别请选择绕过
- 其他同第二条
索引将会被缓存 管理后台以及文件路径中包含`nocache`的 url 将不会被缓存
请跳转至[查询缓存是否生效](#Check_Cache)
## Heroku 不绑定卡等不可自定义域名
我们需要使用`Cloudflare Worker`以及`Booster.js`
> [`Cloudflare Worker`](https://workers.dev)是一个`Serverless`函数 Platform 运行于`Cloudflare`边缘节点上
>
> [`Booster.js`](https://github.com/xiaoyang-liu-cs/booster.js/)是一个运行于`Cloudflare Worker`的反向代理项目
你需要打开[`Cloudflare Worker`](https://workers.dev) 注册 Worker 账户
在[此处](https://github.com/186526/Boomer.js/blob/main/index-min.js)复制代码 并部署Star后上车
请跳转至[查询缓存是否生效](#Check_Cache)
## Check_Cache
1. 方法一:
- 打开 CMD
- 输入 `curl -I <your domain>`
- 当出现类似一下情况 即表示配置成功
```text
C:\Users\186526>curl -I https://imagedl.186526.xyz
HTTP/1.1 200 OK
Date: Sun, 04 Oct 2020 06:14:48 GMT
Content-Type: text/html;charset=UTF-8
Connection: keep-alive
Set-Cookie: __cfduid=d785548bd40d709c98c06a349988227d71601792088; expires=Tue, 03-Nov-20 06:14:48 GMT; path=/; domain=.186526.xyz; HttpOnly; SameSite=Lax; Secure
Vary: Accept-Encoding
Cache-Control: max-age=86400
CF-Cache-Status: HIT //该项表示命中
Age: 54321
cf-request-id: 0593d8b2f80000d346c4af3200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report?lkg-colo=12&lkg-time=1601792089"}],"group":"cf-nel","max_age":604800}
NEL: {"report_to":"cf-nel","max_age":604800}
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Content-Type-Options: nosniff
Server: cloudflare
CF-RAY: 5dccc3cb2d69d346-LAX
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
```
2. 方法二:
- 打开 Chrome Devtool
- 选择 Network
- 点击第一项
- 若`Response Header`中`cf-cache-status`值为`HIT` 表明缓存成功
又水完一篇文章 溜了溜了

0
themes/.gitkeep Normal file
View File

View File

@ -0,0 +1,6 @@
{
"extends": "airbnb-base",
"plugins": [
"import"
]
}

90
themes/suka/.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,90 @@
<!--
IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION OR YOU DON'T READ THE DOCS AND CONFIGURE YOUR CONFIG CAREFULLY 】WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING
ATTENTION: THE DOCS MIGHT UPDATE ANYTIME, AND BEFORE YOU OPEN A NEW ISSUE, CHECK THE DOCS AGAIN.
如果你不填充下面的内容,或者你没有仔细阅读相关文档,或者合理地配置你的配置文件,我们可能会直接关闭你的 issue。
注意:文档可能随时都会更新。在提交一个 issue 前,请重新查看相关文档。
-->
**I certify that I have first consulted** (check with "x")
**我确认我已经查看了** (选择时请使用 "x" 取代方括号中的空格)
- [ ] [Hexo documentation | Hexo 文档](https://hexo.io/docs/)
- [ ] [Suka Theme documentation | Suka Theme 文档](https://theme-suka.skk.moe/docs/)
- [ ] [Suka theme issues | Suka 主题的其它 issue](https://github.com/SukkaW/hexo-theme-suka/issues?utf8=%E2%9C%93&q=is%3Aissue)
----
## I'm submitting a (check one with "x")
## 我正在申请 (选择时请使用 "x" 取代方括号中的空格)
- [ ] bug report | 反馈一个 Bug
- [ ] feature request | 申请添加新的特性或功能
- [ ] support request | 请求技术支持
----
## 如果你遇到了运行 `hexo g` `hexo s` 时报错
## If you get error when you are running `hexo s` `hexo g`.
### Node.js and NPM Information
### Node.js 和 NPM 的相关信息
<!-- Paste output from `node -v && npm -v` (粘贴 `node -v && npm -v` 输出的信息) -->
### Package dependencies Information
### 依赖包相关信息
<!-- Paste output from `cat package.json` both from site and theme dir (分别从站点目录和主题目录下粘贴 `cat package.json` 输出的信息) -->
### Hexo version
### Hexo 版本号
<!-- Paste output from `hexo -v` (粘贴 `hexo -v` 输出的信息) -->
### Hexo & Theme Configuration
### 站点配置文件和主题配置文件
<!-- Paste USEFUL configuration from Hexo `_config.yml` (从 Hexo 和主题目录下的 `_config.yml` 中粘贴 有用的 信息) -->
### Error Log
### 报错日志
<!-- Only paste USEFUL log 务必仅粘贴有用的日志 -->
----
## 如果你在浏览器中发现了问题
## If you find something wrong when visiy your blog in browser.
### Which device am I using, such as Android, iOS, Windows, Linux, MacOS
### 我使用的平台,如 Android、iOS、Windows、Linux、MacOS 等
### Which brows am I using, such as Chrome 58.0.3029.110 (64-bit)
### 我使用的浏览器(如 Chrome 58.0.3029.110 64 位)
### Dev Tool - Console.log
### 开发者面板的控制台日志
### What you are expected and what you actually get
### 预期结果和你的实际结果
----
### Demo site related with this issue, JSFiddle and gist are welcomed.
### 和 issue 有关的在线演示页面,推荐使用 JSFiddle 和 gist
### Link(s) to source code or any usefull link(s)
### 相关源码或有用资源的入口
<!-- ----------- -->

View File

@ -0,0 +1,86 @@
---
name: Bug report
about: Create a report to help us improve
---
<!--
IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION OR YOU DON'T READ THE DOCS AND CONFIGURE YOUR CONFIG CAREFULLY 】WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING
ATTENTION: THE DOCS MIGHT UPDATE ANYTIME, AND BEFORE YOU OPEN A NEW ISSUE, CHECK THE DOCS AGAIN.
如果你不填充下面的内容,或者你没有仔细阅读相关文档,或者合理地配置你的配置文件,我们可能会直接关闭你的 issue。
注意:文档可能随时都会更新。在提交一个 issue 前,请重新查看相关文档。
-->
**I certify that I have first consulted** (check with "x")
**我确认我已经查看了** (选择时请使用 "x" 取代方括号中的空格)
- [ ] [Hexo documentation | Hexo 文档](https://hexo.io/docs/)
- [ ] [Suka Theme documentation | Suka Theme 文档](https://theme-suka.skk.moe/docs/)
- [ ] [Suka theme issues | Suka 主题的其它 issue](https://github.com/SukkaW/hexo-theme-suka/issues?utf8=%E2%9C%93&q=is%3Aissue)
----
## 如果你遇到了运行 `hexo g` `hexo s` 时报错
## If you get error when you are running `hexo s` `hexo g`.
### Node.js and NPM Information
### Node.js 和 NPM 的相关信息
<!-- Paste output from `node -v && npm -v` (粘贴 `node -v && npm -v` 输出的信息) -->
### Package dependencies Information
### 依赖包相关信息
<!-- Paste output from `cat package.json` both from site and theme dir (分别从站点目录和主题目录下粘贴 `cat package.json` 输出的信息) -->
### Hexo version
### Hexo 版本号
<!-- Paste output from `hexo -v` (粘贴 `hexo -v` 输出的信息) -->
### Hexo & Theme Configuration
### 站点配置文件和主题配置文件
<!-- Paste USEFUL configuration from Hexo `_config.yml` (从 Hexo 和主题目录下的 `_config.yml` 中粘贴 有用的 信息) -->
### Error Log
### 报错日志
<!-- Only paste USEFUL log 务必仅粘贴有用的日志 -->
----
## 如果你在浏览器中发现了问题
## If you find something wrong when visiy your blog in browser.
### Which device am I using, such as Android, iOS, Windows, Linux, MacOS
### 我使用的平台,如 Android、iOS、Windows、Linux、MacOS 等
### Which brows am I using, such as Chrome 58.0.3029.110 (64-bit)
### 我使用的浏览器(如 Chrome 58.0.3029.110 64 位)
### Dev Tool - Console.log
### 开发者面板的控制台日志
### What you are expected and what you actually get
### 预期结果和你的实际结果
----
### Demo site related with this issue, JSFiddle and gist are welcomed.
### 和 issue 有关的在线演示页面,推荐使用 JSFiddle 和 gist
### Link(s) to source code or any usefull link(s)
### 相关源码或有用资源的入口
<!-- ----------- -->

View File

@ -0,0 +1,15 @@
---
name: Feature request
about: Suggest an idea for this project
---
### Describe what you need.
### 介绍你需要的特性
### Demo site related with this issue, JSFiddle and gist are welcomed.
### 和 issue 有关的在线演示页面,推荐使用 JSFiddle 和 gist
### Link(s) to source code or any usefull link(s)
### 相关源码或有用资源的入口

View File

@ -0,0 +1,45 @@
<!--
IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR PULL REQUESTS WITHOUT INVESTIGATING
-->
**Contributing rules**
- Fork the repo and create your branch from `canary`. Then be sure to put the `canary` branch as the target for your pull request.
- Please be sure to follow the [contributing guidelines](https://github.com/SukkaW/hexo-theme-suka/blob/master/CONTRIBUTING.md), especially for commit message.
- Remove the `Contributing rules` part from this description if you like.
- Fill out the other parts from this description.
> If you don't do so, we might change your pull request's title and using `squash` to merge your changed.
<!-- ----------- -->
## Please check if your PR fulfills the following requirements:
- [ ] The commit message follows our guidelines.
- [ ] Tests for the changes have been added (for bug fixes / new features).
- [ ] Docs have been added / updated (for bug fixes / new features).
## What kind of change does this PR introduce? (check with "x")
- [ ] Bug fix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
## Does this PR introduce a breaking change? (check one with "x")
- [ ] Yes
- [ ] No
____
## Description
____
## Verification steps

11
themes/suka/.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
.DS_Store
*.log
node_modules
.idea
.directory
package-lock.json

31
themes/suka/.travis.yml Normal file
View File

@ -0,0 +1,31 @@
language: node_js
node_js:
- "8"
- "10"
- "12"
git:
depth: 5
quiet: true
before_install:
- rm -rf .git
- npm set audit false
install:
- cd ..
- git clone https://github.com/theme-suka/hexo-theme-unit-test.git --depth=2
- rm -rf hexo-theme-unit-test/.git
- mkdir -p suka-theme-test
- mv -f hexo-theme-unit-test/* suka-theme-test
- cd suka-theme-test
- npm i > /dev/null
- chmod +x ./install-theme.sh
- ./install-theme.sh
script:
- chmod +x ./build.sh
- ./build.sh
- chmod +x ./deploy.sh
- ./deploy.sh > /dev/null
cache:
directories:
- /home/travis/build/SukkaW/suka-theme-test/themes/suka/node_modules
- /home/travis/build/SukkaW/suka-theme-test/node_modules
timeout: 60

150
themes/suka/CONTRIBUTING.md Normal file
View File

@ -0,0 +1,150 @@
# Commit message format
*Read this in other languages: [English](CONTRIBUTING.md), [简体中文](CONTRIBUTING.zh-cn.md).*
## 1. Title (Header)
**1type**
`type` is used to describe the commit class. It must be one of the following:
- feat: A new feature
- fix: A bug fix
- docs: Documentation related, such as changes on GitHub template or README.
- style: Changes that related to UI/UX or some small changes at appearance.
- codestyle: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- test: Adding missing tests or correcting existing tests
- chore: Changes that affect the build system or external dependencies
- merge: Merge Pull Request
- str: Including but not limited to the changes in the directory and the establishment of the theme structure
**2scope**
`scope` is used to describe the scope of the impact of commit, such as sns, lang, share, post.
`scope` is placed after `type` and within parenthesis (`()`).
**3subject**
`subject` is a short description of the commit purpose, not more than 50 characters.
- starts with a verb and uses the first person present, such as change, not changed or changes
- The first letter is lowercase
- End without a period (.)
---
See #119 `refactor(sns): simplify conditional display` for example.
## 2. Body
Body is a detailed description that can be divided into multiple lines. The following is an example.
> More detailed explanatory text, if necessary.
> Further paragraphs come after blank lines.
> - Bullet points are okay, too
- Use a hanging indent
There are two points to note:
(1) Use the first person present, such as `change` instead of `changed` or `changes`.
(2) The motivation for the code change should be stated, as well as the comparison with the previous behavior.
## 3. Footer
The Footer section is used only in two cases.
** (1) Incompatible changes **
If the current code is incompatible with the previous version, the Footer section begins with `BREAKING CHANGE`, followed by a description of the change, along with the reason for the change and the migration method.
BREAKING CHANGE: isolate scope bindings definition has changed.
To migrate the code follow the example below:
Before:
scope: {
myAttr: 'attribute',
}
After:
scope: {
myAttr: '@',
}
The removed `inject` wasn't generally useful for directives so there should be no code using it.
** (2) Close Issue **
If the current commit is for an issue, then you can close the issue in the Footer section.
Closes #234
You can also close more than one issue at a time.
Closes #123, #245, #992.
## 4. Revert
There is also a special case that if the current commit is used to revoke a previous commit, it must begin with `revert:` followed by the commit header.
revert: feat(pencil): add 'graphiteWidth' option
This reverts commit 667ecc1654a317a13331b17617d973392f415f02.
Body part of the format is fixed, must be written as `This reverts commit <hash>.`, Where `hash` is revoked SHA identifier of the commit.
If the current commit is in the same release as the revoked commit, they will not appear in the Change log. If the two are in different releases, the current commit will appear in the Change log under the `Reverts` subtitle.
## 5. Merge
When merging Pull Request, use `merge` as type of commit, use the number as scope of commit. This is an example: `merge(#402): merge feat/footer_text into canary`
When merging a pull request using Squash,fill subject with the summary of the changes,fill body with bullet points with every commit information(GitHub will automatically generate it for you when you are at github.com)
A Branch should include this three parts, and use `/` as sseparator:
- type
- scope
- subject
# Branch name format
## Type
A `type` is used to mark what the branch used for.There are some examples:
- feat: New Feature
- fix: Fix a bug
- docs: About Documentiations
- style: Format (And it won't affect the code running)
- refactor: Refactor(No new feature will be added or no bugs will be fixed)
- test: Test
- chore: Update our tools
## scope
It is used to explain which parts will this branch mainly affected.
## subject(Unnecessary)
This tell which objects will be affected, or why we open this branch.
-----
Here are some examples for branch names:
- fix/jsload
- fix/comment/disqusclick
- feat/sidebar
- revert/nprogress

View File

@ -0,0 +1,154 @@
# Commit message format
*其他语言版本: [English](CONTRIBUTING.md), [简体中文](CONTRIBUTING.zh-cn.md).*
## 1. Title (Header)
**1type**
`type` 用于说明 commit 的类别,只允许使用下面的标识。
- feat: New feature 新功能
- fix: Fix bug 修补 bug
- docs: Documentation 文档(包括 README 的更新)
- style: UI/UX 主题外观样式和风格的改动
- codestyle: Format 格式(不影响代码运行的变动)
- refactor: Refactor 重构
- test: Test 增加测试
- chore: 构建过程或辅助工具的变动
- merge: 合并 Pull Request
- str: 结构的改变,包括但不限于目录变动和主题框架的搭建
**2scope**
`scope` 用于说明 commit 影响的范围,比如 snslangsharepost。
`scope` 紧接 `type` 置于 `()` 之内。
**3subject**
`subject` 是 commit 目的的简短描述,不超过 50 个字符。
- 以动词开头,使用第一人称现在时,比如 change而不是 changed 或 changes
- 第一个字母小写
- 结尾不加句号(.
---
Title 可参考 #119 `refactor(sns): simplify conditional display`
## 2. Body
Body 部分是对本次 commit 的详细描述,可以分成多行。下面是一个范例。
> More detailed explanatory text, if necessary.
> Further paragraphs come after blank lines.
> - Bullet points are okay, too
- Use a hanging indent
有两个注意点:
1使用第一人称现在时比如使用 `change` 而不是 `changed``changes`
2应该说明代码变动的动机以及与以前行为的对比。
## 3. Footer
Footer 部分只用于两种情况。
**1不兼容变动**
如果当前代码与上一个版本不兼容,则 Footer 部分以 `BREAKING CHANGE` 开头,后面是对变动的描述、以及变动理由和迁移方法。
```
BREAKING CHANGE: isolate scope bindings definition has changed.
To migrate the code follow the example below:
Before:
scope: {
myAttr: 'attribute',
}
After:
scope: {
myAttr: '@',
}
The removed `inject` wasn't generally useful for directives so there should be no code using it.
```
**2关闭 Issue**
如果当前 commit 针对某个 issue那么可以在 Footer 部分关闭这个 issue 。
`Closes #234`
也可以一次关闭多个 issue 。
`Closes #123, #245, #992`
## 4. Revert
还有一种特殊情况,如果当前 commit 用于撤销以前的 commit则必须以 `revert:` 开头,后面跟着被撤销 Commit 的 Header。
```
revert: feat(pencil): add 'graphiteWidth' option
This reverts commit 667ecc1654a317a13331b17617d973392f415f02.
```
Body 部分的格式是固定的,必须写成 `This reverts commit <hash>.`,其中的 `hash` 是被撤销 commit 的 SHA 标识符。
如果当前 commit 与被撤销的 commit在同一个发布release里面那么它们都不会出现在 Change log 里面。如果两者在不同的发布,那么当前 commit会出现在 Change log 的 `Reverts` 小标题下面。
## 5. Merge
当使用 Merge Pull Request 合并一个分支到另一个分支时type 为 `merge`scope 为 PR 的编号。这是一个范例:`merge(#402): merge feat/footer_text into canary`
使用 Squash 合并分支时type 为 `merge`scope 为 PR 的编号subject 为这次 PR 主要改动的概括body 为以无序列表排列的对应多条 commit 记录(在网页端使用 Squash 合并时GitHub 会自动生成列表)。
一个 Branch 的命名应当包含三个部分,并使用 `/` 作为分隔符。
- type
- scope
- subject
# Branch name format
## Type
`type` 用于标记这个分支的作用。下面是一些例子:
- feat: 新的特性、新的功能
- fix: 修复 Bugs
- docs: 关于文档的更新
- style: 代码格式化,代码简化等(不影响代码的运行)
- refactor: 重构(没有新特性增加也没有 Bug 被修复)
- test: 项目测试
- chore: 升级工具(如 `gulpfile` 的更新)
- remove: 简单地将部分模块的代码从项目中移除
> 一个分支可以包含一或两个 Type。
## scope
用于注明项目中的哪一部分会被影响
## subject非必须
用于注明项目中这一部分中的哪些代码会被影响,或简单注明为什么新建了这个分支
----
这是几个分支命名的示例:
- fix/jsload
- fix/comment/disqusclick
- feat/sidebar
- revert/nprogress

674
themes/suka/LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

129
themes/suka/README.md Normal file
View File

@ -0,0 +1,129 @@
![](https://i.loli.net/2018/07/27/5b5b2eee0dc9b.png)
# <div align="center"><a title="Go to homepage" href="https://theme-suka.skk.moe"><img align="center" alt="S" width="56" height="56" src="https://i.loli.net/2018/07/27/5b5b32fb7963f.png"></a>u k a</div>
> Modern · Powerful · Simple
> 现代 · 强大 · 简洁
<p align="center">
<img alt="Version" src="https://img.shields.io/github/v/release/sukkaw/hexo-theme-suka?color=%235755d9&include_prereleases&label=version&style=flat-square">
<a href="https://skk.moe" target="_blank"><img alt="Author" src="https://img.shields.io/badge/Author-Sukka-b68469.svg?style=flat-square"/></a>
<a href="https://hexo.io" target="_blank"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83cd.svg?style=flat-square"/></a>
<a href="https://nodejs.org/" target="_blank"><img alt="node.js" src="https://img.shields.io/badge/node.js-10%2B-43853d.svg?style=flat-square"/></a>
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/sukkaw/hexo-theme-suka?style=flat-square">
<br>
<a href="https://travis-ci.org/SukkaW/hexo-theme-suka"><img alt="Build Status" src="https://img.shields.io/travis/SukkaW/hexo-theme-suka.svg?style=flat-square"/></a>
<a href="https://www.codacy.com/app/SukkaW/hexo-theme-suka" target="_blank"><img alt="Codacy Badge" src="https://img.shields.io/codacy/grade/273f45610882413aad88396e06bfa6ec.svg?style=flat-square"></a>
<a href="https://david-dm.org/SukkaW/hexo-theme-suka" target="_blank"><img alt="Dependency Status" src="https://img.shields.io/david/SukkaW/hexo-theme-suka.svg?style=flat-square"></a>
<a href="https://david-dm.org/SukkaW/hexo-theme-suka#info=devDependencies" target="_blank"><img alt="devDependency Status" src="https://img.shields.io/david/dev/SukkaW/hexo-theme-suka.svg?style=flat-square"></a>
</p>
## Contents 目录
- [Introduction 简介](#introduction-简介)
- [Demo 演示](#demo-演示)
- [Install 安装](#install-安装)
- [Documents 文档](#documents-文档)
- [Contributing 贡献](#contributing-贡献)
- [Changelog 更新日志](#changelog-更新日志)
- [Todo 计划](#todo-计划)
- [Maintainer 维护者](#maintainer-维护者)
- [License 许可证](#license-许可证)
- [Support 支持](#support-支持)
- [Render 渲染](#render-渲染)
## Introduction 简介
"Suka", a Modern and Simple Theme for Hexo, with a lot of powerful features.
「Suka」一个拥有许多强大特性的现代、简洁的 Hexo 主题。
## Demo 演示
- [Sukka's Blog](https://blog.skk.moe)
- [Suka Theme Demo](https://theme-suka.skk.moe/demo/)
## Install 安装
```bash
$ cd hexo
$ git clone https://github.com/SukkaW/hexo-theme-suka themes/suka
$ cat themes/suka/site_config.yml >> _config.yml
$ cd themes/suka
$ npm i
$ cd ..
$ cd ..
```
You can also read our [detailed installation instructions](https://theme-suka.skk.moe/docs/en/) if you want any other variant.
你也可以阅读我们的 [详细安装说明](https://theme-suka.skk.moe/docs/) 了解如何用其他方法下载「Suka」并启用。
## Documents 文档
[Suka Theme Docs](https://theme-suka.skk.moe/docs/en/)
> ATTENTION! The English Version of Docs is still under construction!<br>But do not worry, I wrote the detailed explainations in config file's comment in English. So you can still configure the theme without difficulty. Any problem please feel free to open a new issue.
[Suka 主题文档](https://theme-suka.skk.moe/docs/)
---
[The source code of Docs](https://github.com/theme-suka/docs/)
## Contributing 贡献
All kinds of contributions (enhancements, new features, documentation & code improvements, issues & bugs reporting) are welcome.<br>
please read the [Dev Guide](https://theme-suka.skk.moe/docs/en/dev/) before you start your contributing.
欢迎各种形式的贡献,包括但不限于优化,添加功能,文档 & 代码的改进,问题和 bugs 的报告。期待你的 Pull Request。<br>
在参与贡献之前,请先阅读 [开发指南](https://theme-suka.skk.moe/docs/dev/)。
## Changelog 更新日志
[View our release notes](https://github.com/SukkaW/hexo-theme-suka/releases)<br>
[阅读我们的更新日志](https://github.com/SukkaW/hexo-theme-suka/releases)
## Todo 计划
See [Repo's projects](https://github.com/SukkaW/hexo-theme-suka/projects) for details.
在 [Repo's projects](https://github.com/SukkaW/hexo-theme-suka/projects) 查看关于 Todo 的详细信息
> The Todo is written in Chinese
## Maintainer 维护者
**Suka Theme** © [Sukka](https://github.com/SukkaW), Released under the [GPL-3.0](./LICENSE) License.<br>
Authored and maintained by Sukka with help from contributors ([list](https://github.com/SukkaW/hexo-theme-suka/contributors)).
> [Personal Website](https://skk.moe) · [Blog](https://blog.skk.moe) · GitHub [@SukkaW](https://github.com/SukkaW) · Telegram Channel [@SukkaChannel](https://t.me/SukkaChannel) · Twitter [@isukkaw](https://twitter.com/isukkaw) · Keybase [@sukka](https://keybase.io/sukka)
## License 许可证
[![license](https://img.shields.io/github/license/sukkaw/hexo-theme-suka.svg?style=flat-square)](./LICENSE)
Open sourced under the GPL v3.0 license.
根据 GPL V3.0 许可证开源。
## Support 支持
[![jsdelivr.png](https://i.loli.net/2018/07/27/5b5b29e9a9820.png)](https://www.jsdelivr.com)
> jsDelivr Open Source CDN. free, fast, and reliable
Thanks jsDelivr for providing Public CDN service.
[![](https://data.jsdelivr.com/v1/package/gh/sukkaw/hexo-theme-suka/badge)](https://www.jsdelivr.com/package/gh/sukkaw/hexo-theme-suka)
<a href="https://picturepan2.github.io/spectre">
<img src="https://picturepan2.github.io/spectre/img/spectre-logo.svg" width="72" height="72">
</a>
> Spectre.css is a lightweight, responsive and modern CSS framework.
## Render 渲染
![](https://i.loli.net/2018/07/27/5b5b2b53359fc.png)

426
themes/suka/_config.yml Normal file
View File

@ -0,0 +1,426 @@
# ---------------------------------------------------------------
# !!ATTENTION!!
# ---------------------------------------------------------------
# There are two config file in Hexo Project, one in the root directory of your Hexo Project and another in the theme directory.
# For convenience of description, the former is referred to as the site config and the latter as the theme config.
#
# There are some pivotal config in `site_config.yml` in Suka Theme directory.
# You should copy them and paste them to the end of your site config file!
# Read the documents for more info.
# ---------------------------------------------------------------
# ---------------------------------------------------------------
# Site Information Settings
# ---------------------------------------------------------------
head:
# Favicon
# Put your favicons into `hexo-site/source/` directory.
# To get or check favicons visit: https://realfavicongenerator.net
favicon:
# You should use a image/x-icon type icon and configure it here.
ico: https://186526.xyz/pic/avatar-round.webp
# 16x16 png
small:
# 32x32 png
medium: # /img/suka-favicon.png
# 180x180 png
apple_touch_icon: https://186526.xyz/pic/avatar.png
# 192x192 png
large:
# svg icon
safari_pinned_tab:
# Color
# It will defined color below:
# Android Chrome Color
# Safari Pinned Tab
color: '#F8F9FA'
# PWA
# You can setup your blog as pwa with a manifest.
# https://app-manifest.firebaseapp.com where you can generate a manifest quickly
# Leave it blank if you don't have one
pwa_manifest: '/manifest.json'
# Open search
# Fill in your opensearch xml file here.
# Leave it blank if you don't have one
open_search:
# Keywords
# Define meta keywords tag
# split with ','
keywords: 'Blog,Frontend'
# Site Verification
site_verification:
google:
baidu:
footer:
# Copyright Since
# Specify the date when the site was setup.
# For example, if you set it as 2015, then footer will show something like '© 2015 - 2018'
# If you just want to show something like '© 2018' only, simly leave it blank.
copyright_since: '© 2020'
# Footer Text
# You can specify the text you want to show in footer, HTML tag is supported.
# For example, you can setup ICP license number as:
# custom_text: '<a href="http://www.miitbeian.gov.cn" rel="nofollow noopener noreferrer">某ICP备xxxxxxxx号-x</a>'
# Another example, you can setup 'Hosted on Coding Pages' as:
# custom_text: 'Hosted on <a href="https://pages.coding.me" rel="nofollow noopener noreferrer">Coding Pages</a>'
# Muilt line footer text is supported.
custom_text: 'Hosted by <a href="https://vercel.com" rel="nofollow noopener noreferrer">Vercel</a> | Performance by <a href="https://vercel.com" rel="nofollow noopener noreferrer">Cloudflare</a>'
# ---------------------------------------------------------------
# Customize Settings
# ---------------------------------------------------------------
uiux:
# Muilt line slogan is supported.
slogan: '啥都不会的屑'
# For most link color except post color
link_color:
primary_color:
# Background color
bg_color:
img:
avatar: 'https://i.186526.xyz/avatar'
# ---------------------------------------------------------------
# Menu Settings
# ---------------------------------------------------------------
# Nav settings
# Used to choose which
nav:
home:
use: true
archives:
use: true
rss:
use: true
share:
use: true
search:
use: false
link: /search
pages:
#About:
#link: /about/
#Friends:
#link: /links/
# SNS Share Switch
# Used to choose which items will be displayed in share menu.
sns_share:
weibo: true
facebook: true
twitter: true
telegram: false
googleplus: false
linkedin: false
qq: true
# Qrcode which will show in share menu, for redirect to other device
qrcode:
index_share: true
post_share: true
# ---------------------------------------------------------------
# Post Settings
# ---------------------------------------------------------------
post:
# Default Excerpt
# Please use <!-- more --> in the post to control excerpt accurately and will override the configuration here.
entry_excerpt: 120
# Notify on expire of the page
# To let the visitor know if the post hasn't been update for long.
expire: true
share: true
# Post License
# You can specify the text you want to show in the end of your posts and pages, HTML tag is supported.
# For example, you can setup a CC license as:
# license: 'This blog is under a <a href="/creativecommons.html" target="_blank">CC BY-NC-SA 3.0 Unported License</a>'
# You can also use Front-Matter `license` to override this setting
# or use Front-Matter `hide_license: true` to hide license on spefic post
license: '本文使用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)</a> 协议'
# Table Of Contents which will be show on right side of the post
toc:
# You can still disable toc for each single post by setting their front-matter with 'toc: false'
enable: true
# Show line number for each toc list-item or not. Default is true.
line_number: true
# ---------------------------------------------------------------
# Integrated Services
# ---------------------------------------------------------------
# Comment Systems
# Available value of "use":
# disqus | disqusjs | disqus_click | changyan | livere | gitment | gitalk | valine | facebook
# If you want to use DisqusJS for better disqus exprience in China, please read https://github.com/SukkaW/DisqusJS#readme
# If you want to use gitment or gitalk, you should get the client_id and client_secret form https://github.com/settings/applications/new
# If you want to use valine, you should get the app_id and app_key form https://leancloud.cn , more setting please see https://valine.js.org
comment:
use: valine
disqus:
shortname: # disqus shortname
disqusjs:
shortname:
siteName:
api:
apikey:
admin:
adminLabel:
changyan:
appid:
conf:
thread_key_type: path # id | path. Only when you generate static id for each post before you using 'id'
livere:
data_uid:
gitment:
repo:
owner:
client_id:
client_secret:
gitalk:
repo:
owner:
client_id:
client_secret:
valine:
leancloud_appId: 'u6RSYBGKK1qBIkHBdIEmMWSW-gzGzoHsz'
leancloud_appKey: 'pFcWuNMWM08I81COGKAl6SKJ'
notify: true # valine mail notify (true/false) https://github.com/xCss/Valine/wiki
verify: false # valine verify code (true/false)
pageSize: 10 # comment list page size
avatar: identicon # gravatar style https://valine.js.org/#/avatar
lang: zh-cn # i18n
placeholder: Just go go # valine comment input placeholder(like: Please leave your footprints )
guest_info: nick,mail,link #valine comment header info
wildfire:
database_provider: firebase # firebase or wilddog
wilddog_site_id:
firebase_api_key:
firebase_auth_domain:
firebase_database_url:
firebase_project_id:
firebase_storage_bucket:
firebase_messaging_sender_id:
theme: light # light or dark
locale: en # en or zh-CN
facebook:
colorschme: light # light | dark
numposts: 10
orderby: social # social | reverse_time | time
# You can only fill in one of them below when configuring.
# If you fill in both of them then appid method will be used.
# Read facebook developer documents for more info:
# https://developers.facebook.com/docs/plugins/comments/#moderation-setup-instructions
admin_fb_appid:
admin_fb_username: # Currently "Suka" don't support more than one admin. You can open a new issue if you really need one.
# Site Analytics
# Suka theme has a built in Baidu's, Google's website analytics and CNZZ's analytics service
analytics:
google_site_id:
gtags_site_id:
baidu_site_id:
cnzz_site_id:
tencent_site_id:
tencent_mta_id:
# Views Analytics
# Busuanzi
# The counter by https://busuanzi.ibruce.info
busuanzi:
enable: false
# Site views analytics support either pv or uv
# will be show at footer
site_uv:
enable: true
before: # html tag support
after: Viewers # html tag support
divider: '|' # html tag supported, something like '|' ',' '·' even '<br>', if you dont want any divider simply leave it blank,
offset: 0
site_pv:
enable: false
before: # html tag support
after: Views # html tag support
divider: # html tag supported, something like '|' ',' '·' even '<br>', if you dont want any divider simply leave it blank,
offset: 0
# Post views analytics
# will be show at post header info
post_pv:
enable: true
before: # html tag support
after: Views # html tag support
# The counter by https://valine.js.org/visitor.html
valine_counter:
# ATTENTION! You should use valine comment system to enable this feature!
enable: false
# By use config.url as id to count all site pv
site_pv:
enable: false
before: # html tag supported
after: # html tag supported
divider: # html tag supported, something like '|' ',' '·' even '<br>', if you dont want any divider simply leave it blank,
# Show pv for each post on index (Exprimental)
index_post_pv:
enable: false
before: # html tag supported
after: # html tag supported
# Show pv on post page
post_pv:
enable: false
before: # html tag supported
after: # html tag supported
# ---------------------------------------------------------------
# Plugin Settings
# ---------------------------------------------------------------
# Search
# Available value of "use":
# local | google | swiftype
search:
use: google
# Swiftype
swiftype_key:
# Code highlight
# You can only enable one of them to avoid issues.
# Suka support hexo built in preprocess highlight.js, and Suka Theme has various theme for you to choose.
# Suka Theme has also built in those code highlight: Hanabi | Prism | Prettify , you can config below.
# Run `hexo clean` first after changing code highlight configuration.
# Hexo built in highlight
# To use hexo built in highlight, you need to disable all other highlight option.
# Then enable Hexo highlight option in site config.
#
# highlight:
# enable: true
#
highlight:
theme: github
# You can only enable the Suka built in prettify theme here. Check the /source/css/highlight directories.
# The theme name is the css file name without `.min.css`, as [theme-name].min.css
# Hanabi (https://github.com/egoist/hanabi)
# To use hanabi, you need to disable all highlight option in hexo's site config:
#
# highlight:
# enable: false
# line_number: false
# auto_detect: false
# tab_replace: false
#
hanabi:
enable: false
# Prism
# To use prism, you need to disable all highlight option in hexo's site config.
#
# highlight:
# enable: false
# line_number: false
# auto_detect: false
# tab_replace: false
#
# Then you need to disable other code hightlight first, and enable prism at site config:
#
# suka_theme:
# ...
# prism:
# enable: true
# line_number: true # Enable line number or not
# theme: default
#
# You can only enable the Suka built in prism theme here. Check the /source/lib/prism directories.
# The theme name is the css file name without `.min.css` and `prism-`, as prism-[theme-name].min.css
# Google Code Prettify
# To use prettify, you need to disable all highlight option in hexo's site config.
#
# highlight:
# enable: false
# line_number: false
# auto_detect: false
# tab_replace: false
#
prettify:
enable: true
linenumber: true # We prefer to enable for avoiding some pretiffy's bugs.
# Prettify Theme
theme: github-v2 # It will not load any theme if you leave it blank
# You can only enable the Suka built in prettify theme here. Check the /source/lib/prettify/themes directories.
# The theme name is the css file name without `.min.css`, as [theme-name].min.css
#
# If you want to use other theme, you can leave that blank, and load your own theme by adding <link> tag using custom code.
# Learn how to use custom code here: https://theme-suka.skk.moe/docs/en/expert/#Add-custom-code
# ---------------------------------------------------------------
# Expert Settings
# ---------------------------------------------------------------
# !!ATTENTION!!
# Do Not Modify Below This Line, unless you know what you are doing!
# ---------------------------------------------------------------
# Vendors
# Set a CDN address for the vendor you want to customize.
# Be aware that you should use the same version as internal ones to avoid potential problems.
# We prefer you using the https protocol of CDN files whether you enable https on your site or not.
vendors:
# hexo-theme-suka
# https://github.com/SukkaW/hexo-theme-suka
# You can check current the Suka Version Code at the end of theme config.
suka:
style_css:
local_search_js:
hanabi_browser_js:
highlight_theme:
# You can fill in any suka built in highlight.js theme you want here, and it will override the prism theme config before.
lazyload_img:
# Spectre.css
# https://picturepan2.github.io/spectre/
# Version: 0.5.3
spectre:
spectre_css:
# Prism & Prism Theme
# https://github.com/PrismJS/prism/ https://github.com/PrismJS/prism-themes
# Prism Version: 1.15.0 | Prism Theme Version: 1.0.1
prism:
theme:
# You can fill in any prism theme you want here, and it will override the prism theme config in site config.
line_number:
# Lazyload
# https://github.com/verlok/lazyload
# Version: 8.9.0
lazyload:
# Busuanzi
# https://busuanzi.ibruce.info
busuanzi:
# Hanabi
# https://github.com/egoist/hanabi
# Version: 0.4.0
hanabi:
# Prettify Core
# Attention! It is NOT the `run_prettify.js`!
# Version: 0.1.0
prettify:
# Prettify Theme
# You can fill in any prettify theme you want here, and it will override the prettify theme config before.
# Personally I prefer the theme here: https://github.com/jmblog/color-themes-for-google-code-prettify
prettify_theme:
fragment_cache: false
# Theme Version
# localStorage cache version
verison: 1.3.3
old_verison:
- 0.2.0
- 0.0.1
- 0.1.0
- 1.0.0
- 1.0.1
- 1.1.0
- 1.1.1
- 1.2.0
- 1.3.0
- 1.3.2

View File

@ -0,0 +1,40 @@
// https://gitmagic.io/rules
{
"commit": {
"subject_cannot_be_empty": true,
"subject_must_be_in_tense": "imperative",
"subject_must_not_end_with_dot": true,
"subject_lines_must_be_shorter_than": 51,
"subject_must_be_single_line": true,
"subject_must_be_in_case": "lower",
"subject_must_include_prefix": {
"prefixes": ["feat", "fix", "docs", "style", "refactor", "test", "chore"],
"require_after_prefix": "(*): "
}
},
"pull_request": {
"subject_cannot_be_empty": true,
"subject_must_be_in_tense": "imperative",
"subject_must_start_with_case": "lower",
"subject_must_not_end_with_dot": true,
"subject_must_include_prefix": {
"prefixes": ["feat", "fix", "docs", "style", "refactor", "test", "chore"],
"require_after_prefix": "(*): "
},
"body_cannot_be_empty": true,
"body_must_include_verification_steps": true
},
"issue": {
"subject_cannot_be_empty": true,
"subject_must_start_with_case": "upper",
"subject_must_not_end_with_dot": true,
"body_cannot_be_empty": true,
"body_must_include_reproduction_steps": ["bug"]
},
"branch": {
"name_must_be_longer_than": 4,
"name_must_include_prefix": {
"prefixes": ["feat", "fix", "refactor", "chore"],
"require_after_prefix": "/"
}
}

48
themes/suka/gulpfile.js Normal file
View File

@ -0,0 +1,48 @@
const gulp = require('gulp');
const autoprefixer = require('gulp-autoprefixer');
const cleanCSS = require('gulp-clean-css');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const configs = {
autoprefixer: {
overrideBrowserslist: [
'last 2 versions',
'> 1%',
'Chrome >= 30',
'Firefox >= 30',
'ie >= 9',
'Safari >= 8',
],
},
cleanCSS: {
compatibility: 'ie9'
},
};
gulp.task('minify-js', () => {
return gulp.src('src/**/*.js')
.pipe(uglify({
output: {
comments: /^!/
}
}))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('source'));
});
gulp.task('minify-css', () => {
return gulp.src('src/**/*.css')
.pipe(autoprefixer(configs.autoprefixer))
.pipe(cleanCSS(configs.cleanCSS))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('source'));
});
gulp.task('build', gulp.parallel('minify-js', 'minify-css'));
gulp.task('default', gulp.parallel('build'));
gulp.task('watch', () => {
gulp.watch('src/**', gulp.parallel('build'));
});

View File

@ -0,0 +1,85 @@
/* hexo-prism-plugin
* author: ele828
* license: MIT
* patched by SukkaW for hexo-theme-suka
*/
'use strict';
module.exports = function (hexo) {
// Plugin settings
const config = hexo.config.suka_theme.prism;
if (config.enable !== true) {
return;
}
const Prism = require('node-prismjs');
const map = {
'&#39;': '\'',
'&amp;': '&',
'&gt;': '>',
'&lt;': '<',
'&quot;': '"'
};
const regex = /<pre><code class="(.*)?">([\s\S]*?)<\/code><\/pre>/igm;
const captionRegex = /<p><code>(?![\s\S]*<code)(.*?)\s(.*?)\n([\s\S]*)<\/code><\/p>/igm;
const line_number = config.line_number || true;
/**
* Unescape from Marked escape
* @param {String} str
* @return {String}
*/
function unescape(str) {
if (!str || str === null) return '';
const re = new RegExp('(' + Object.keys(map).join('|') + ')', 'g');
return String(str).replace(re, (match) => map[match]);
}
/**
* Code transform for prism plugin.
* @param {Object} data
* @return {Object}
*/
function PrismPlugin(data) {
// Patch for caption support
if (captionRegex.test(data.content)) {
// Attempt to parse the code
data.content = data.content.replace(captionRegex, (origin, lang, caption, code) => {
if (!lang || !caption || !code) return origin;
return `<figcaption>${caption}</figcaption><pre><code class="${lang}">${code}</code></pre>`;
});
}
data.content = data.content.replace(regex, (origin, lang, code) => {
const lineNumbers = line_number ? 'line-numbers' : '';
const startTag = `<pre class="${lineNumbers} highlight language-${lang}"><code class="language-${lang}">`;
const endTag = `</code></pre>`;
code = unescape(code);
let parsedCode = '';
if (Prism.languages[lang]) {
parsedCode = Prism.highlight(code, Prism.languages[lang]);
} else {
parsedCode = code;
}
if (line_number) {
const match = parsedCode.match(/\n(?!$)/g);
const linesNum = match ? match.length + 1 : 1;
let lines = new Array(linesNum + 1);
lines = lines.join('<span></span>');
const startLine = '<span aria-hidden="true" class="line-numbers-rows">';
const endLine = '</span>';
parsedCode += startLine + lines + endLine;
}
return startTag + parsedCode + endTag;
});
return data;
}
hexo.extend.filter.register('after_post_render', PrismPlugin);
};

View File

@ -0,0 +1,82 @@
module.exports = function (hexo) {
if (hexo.config.suka_theme.search.enable !== true) {
return;
}
const pathFn = require('path');
const { stripHTML } = require('hexo-util');
let config = hexo.config.suka_theme.search;
// Set default search path
if (!config.path) config.path = 'search.json';
function searchGenerator(locals = {}) {
const url_for = hexo.extend.helper.get('url_for').bind(this);
const parse = (item) => {
let _item = {};
if (item.title) _item.title = item.title;
if (item.date) _item.date = item.date;
if (item.path) _item.url = url_for(item.path);
if (item.tags && item.tags.length > 0) {
_item.tags = [];
item.tags.forEach((tag) => {
_item.tags.push(tag.name);
});
}
if (item.categories && item.categories.length > 0) {
_item.categories = [];
item.categories.forEach((cate) => {
_item.categories.push(cate.name);
});
}
if (item._content) {
_item.content = stripHTML(item.content.trim().replace(/<pre(.*?)\<\/pre\>/gs, ''))
.replace(/\n/g, ' ').replace(/\s+/g, ' ')
.replace(new RegExp('(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]', 'g'), '');
}
return _item;
};
const searchfield = config.field;
let posts,
pages;
if (searchfield) {
if (searchfield === 'post') {
posts = locals.posts.sort('-date');
} else if (searchfield === 'page') {
pages = locals.pages;
} else {
posts = locals.posts.sort('-date');
pages = locals.pages;
}
} else {
posts = locals.posts.sort('-date');
}
let res = [];
if (posts) {
posts.each((post) => {
res.push(parse(post));
});
}
if (pages) {
pages.each((page) => {
res.push(parse(page));
});
}
return {
path: config.path,
data: JSON.stringify(res)
};
}
if (pathFn.extname(config.path) === '.json') {
hexo.extend.generator.register('json', searchGenerator);
}
};

View File

@ -0,0 +1,42 @@
const { htmlTag } = require('hexo-util');
module.exports = function (hexo) {
hexo.extend.helper.register('favicon', function () {
const url_for = hexo.extend.helper.get('url_for').bind(this);
const { favicon } = this.theme.head;
let html = '';
if (favicon.ico) {
html += htmlTag('link', { rel: 'icon', type: 'image/ico', href: url_for(favicon.ico) });
}
if (favicon.apple_touch_icon) {
html += htmlTag('link', { rel: 'apple-touch-icon', sizes: '180x180', href: url_for(favicon.apple_touch_icon) });
}
if (favicon.large) {
html += htmlTag('link', { rel: 'icon', typt: 'image/png', sizes: '192x192', href: url_for(favicon.large) });
}
if (favicon.medium) {
html += htmlTag('link', { rel: 'icon', typt: 'image/png', sizes: '32x32', href: url_for(favicon.medium) });
}
if (favicon.small) {
html += htmlTag('link', { rel: 'icon', typt: 'image/png', sizes: '16x16', href: url_for(favicon.small) });
}
return html;
});
hexo.extend.helper.register('site_logo', function () {
const full_url_for = hexo.extend.helper.get('full_url_for').bind(this);
const { favicon } = this.theme.head;
const getFavicon = (type) => full_url_for(favicon[type]);
if (favicon.large) return getFavicon('large');
if (favicon.apple_touch_icon) return getFavicon('apple_touch_icon');
if (favicon.medium) return getFavicon('medium');
if (favicon.small) return getFavicon('small');
if (favicon.ico) return getFavicon('ico');
return 'https://theme-suka.skk.moe/demo/img/suka-favicon.png';
});
};

View File

@ -0,0 +1,72 @@
/**
* Generate title string based on page type
* @example
* <%- page_title(page) %>
* <%- page_descr(page) %>
* <%- page_tags(page) %>
*/
const { stripHTML } = require('hexo-util');
module.exports = function (hexo) {
hexo.extend.helper.register('page_title', function (page = null) {
page = (page === null) ? this.page : page;
let title = page.title;
if (this.is_archive()) {
title = this.__('archive');
if (this.is_month()) {
title += `: ${page.year}/${page.month}`;
} else if (this.is_year()) {
title += `: ${page.year}`;
}
} else if (this.is_category()) {
title = `${this.__('category')}: ${page.category}`;
} else if (this.is_tag()) {
title = `${this.__('tag')}: ${page.tag}`;
}
return [title, hexo.config.title].filter((str) => typeof (str) !== 'undefined' && str.trim() !== '').join(' | ');
});
hexo.extend.helper.register('page_descr', function (page = null) {
page = (page === null) ? this.page : page;
let description = page.description || page.excerpt || page.content || hexo.config.description ;
description = stripHTML(description).trim() // Remove prefixing/trailing spaces
.replace(/^s*/, '').replace(/s*$/, '')
.substring(0, 200)
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;')
.replace(/\n/g, ' '); // Replace new lines by spaces
return [description, hexo.config.author, hexo.config.title].filter((str) => typeof (str) !== 'undefined' && str.trim() !== '').join(' - ');
});
hexo.extend.helper.register('page_tags', function (page = null) {
page = (page === null) ? this.page : page;
const { config } = this;
let page_tags = page.keywords || page.tags,
site_tags = config.keywords || this.theme.head.keywords;
const parse = (tags) => {
let result = [];
if (tags) {
if (typeof tags === 'string') {
result.push(tags);
} else if (tags.length) {
result.push(tags.map(tag => tag.name ? tag.name : tag).filter(tags => !!tags).join(', '));
}
}
return result;
};
return [parse(page_tags), parse(site_tags)].filter(tags => tags.length && tags.length !== 0).join(', ');
});
};

View File

@ -0,0 +1,25 @@
const qrImage = require('qr-image');
module.exports = function (hexo) {
hexo.extend.helper.register('qrcode', (url, option) => {
const qrConfig = Object.assign(
{
size: 6,
margin: 0
},
option || {}
);
const qrUrl = url.replace('index.html', '');
const buffer = qrImage.imageSync(
qrUrl,
{
type: 'png',
size: qrConfig.size,
margin: qrConfig.margin
}
);
return `data:image/png;base64,${buffer.toString('base64')}`;
});
};

View File

@ -0,0 +1,135 @@
'use strict';
const urlFn = require('url');
const moment = require('moment');
const { escapeHTML, htmlTag, stripHTML } = require('hexo-util');
module.exports = function (hexo) {
const { helper } = hexo.extend;
helper.register('_meta_generator', () => `<meta name="generator" content="Hexo ${hexo.version}">`);
helper.register('css_async', (url) => `<link rel="preload" href="${url}" as="style" onload="this.onload=null;this.rel='stylesheet'"><noscript><link rel="stylesheet" href="${url}"></noscript>`);
helper.register('_open_graph', function (options = {}) {
function meta(name, content, escape) {
if (escape !== false && typeof content === 'string') {
content = escapeHTML(content);
}
return htmlTag('meta', { name, content });
}
function og(name, content, escape) {
if (escape !== false && typeof content === 'string') {
content = escapeHTML(content);
}
return htmlTag('meta', { property: name, content });
}
const { config, page } = this;
const { content } = page;
let images = options.image || options.images || page.photos || [];
const description = helper.get('page_descr').bind(this)();
const _tags = helper.get('page_tags').bind(this)();
let keywords;
const _title = helper.get('page_title').bind(this);
const title = (() => _title())();
const type = options.type || (this.is_post() ? 'article' : 'website');
const url = (options.url || this.url).replace('index.html', '');
const siteName = options.site_name || config.title;
const date = options.date !== false ? options.date || page.date : false;
const updated = options.updated !== false ? options.updated || page.updated : false;
const thumbnail = page.thumbnail;
const language = options.language || config.language;
const author = config.author;
// Images
if (!Array.isArray(images)) images = [images];
if (!images.length && content) {
images = images.slice();
if (content.includes('<img')) {
let img;
const imgPattern = /<img [^>]*src=['"]([^'"]+)([^>]*>)/gi;
while (img = imgPattern.exec(content)) {
images.push(img[1]);
}
}
}
images = images.map(path => {
if (!urlFn.parse(path).host) {
// resolve `path`'s absolute path relative to current page's url
// `path` can be both absolute (starts with `/`) or relative.
return urlFn.resolve(url || config.url, path);
}
return path;
});
if (thumbnail) images.unshift(thumbnail);
let result = '';
result += og('og:title', title);
result += og('og:site_name', siteName);
result += og('og:type', type);
result += og('og:url', url, false);
if (language) result += og('og:locale', language, false);
if (description) result += meta('description', description, false);
if (_tags) {
if (typeof _tags === 'string') {
keywords = _tags
} else if (_tags.length) {
keywords = _tags.map(tag => tag.name ? tag.name : tag).filter(keyword => !!keyword).join()
}
result += meta('keywords', keywords);
}
images.forEach(path => {
result += og('og:image', path, false);
});
if (date) {
if ((moment.isMoment(date) || moment.isDate(date)) && !isNaN(date.valueOf())) {
result += og('article:published_time', date.toISOString());
}
}
if (updated) {
if ((moment.isMoment(updated) || moment.isDate(updated)) && !isNaN(updated.valueOf())) {
result += og('article:modified_time', updated.toISOString());
result += og('og:updated_time', updated.toISOString());
}
}
if (this.is_post()) {
if (author) {
result += og('article:author', author);
}
if (_tags) {
result += og('article:tag', keywords);
}
if (thumbnail) {
result += meta('twitter:card', 'summary_large_image');
result += meta('twitter:image', thumbnail, false);
} else {
result += meta('twitter:card', 'summary');
}
};
return result.trim();
});
};

View File

@ -0,0 +1,26 @@
const logger = require('hexo-log')();
const pkg = require('../../package.json');
const depsList = Object.keys(pkg.dependencies);
function checkDep(name) {
try {
require.resolve(name);
return true;
} catch(e) {
logger.error(`Package ${name} is not installed.`);
}
return false;
}
logger.info('Checking dependencies');
const missingDeps = depsList.map(checkDep).some(installed => !installed);
if (missingDeps) {
logger.error('Please install the missing dependencies.');
logger.error('You can enter suka-theme directory and run following commands:');
logger.error('$ npm i --production');
logger.error('$ yarn --production # If you prefer yarn.');
process.exit(-1);
}

View File

@ -0,0 +1,11 @@
const logger = require('hexo-log')();
module.exports = function (hexo) {
if (hexo.version.startsWith('3')) {
logger.error('Please update Hexo to v4.0.0 or greater!');
logger.error('You can run following commands at your site directory:');
logger.error('$ npm i hexo@4');
logger.error('$ yarn add hexo@4 # If you prefer yarn.');
process.exit(-1);
}
}

View File

@ -0,0 +1,11 @@
const logger = require('hexo-log')();
logger.info(`--------------------------------------------------------
____ _ _____ _
/ ___| _ _| | ____ _ |_ _| |__ ___ _ __ ___ ___
\\___ \\| | | | |/ / _\` | | | | '_ \\ / _ \\ '_ \` _ \\ / _ \\
___) | |_| | < (_| | | | | | | | __/ | | | | | __/
|____/ \\__,_|_|\\_\\__,_| |_| |_| |_|\\___|_| |_| |_|\\___|
hexo-theme-suka ( https://theme-suka.skk.moe )
--------------------------------------------------------------`);

View File

@ -0,0 +1 @@
zh-CN.yml

View File

@ -0,0 +1,36 @@
home: "Home"
archive: "Archives"
category: "Category"
tag: "Tag"
search:
main: "Search"
placeholder: "Please enter a keyword..."
num: "Total %s results found"
noresult: "No results found. Try another keywords?"
trygoogle: "You can also try using Google"
nav:
prev_page: "Previous"
next_page: "Next"
share:
share: "Share"
post: "Share the post"
toTwitter: "Share to Twitter"
toFacebook: "Share to Facebook"
toLinkedIn: "Share to LinkedIn"
toTelegram: "Share to Telegram"
toGplus: "Share to Google+"
toWeibo: "Share to Weibo"
toQQ: "Share to QQ"
post:
continue: "Read more"
posted: "Published at"
edited: "Updated at"
author: "Author"
permalink: "Link to this article"
expired: "This article was last updated on %s days ago, and the information described in the article may have changed."
comment:
load_disqus_button: "Read the comment (Make sure that disqus can load properly)"
load_disqus_fully_button: "Load the fully comment (Make sure that disqus can load properly)"
load_disqus_proxy_button: "Load the basic comment"
counter:
archive: "%d posts in total"

View File

@ -0,0 +1,36 @@
home: 首页
archive: 归档
category: 分类
tag: 标签
search:
main: 搜索
placeholder: 请输入关键字....
num: "总共找到 %s 条结果"
noresult: 没有找到任何结果,请更换关键字试试~
trygoogle: 你可以试试 Google 站内搜索
nav:
prev_page: 上一页
next_page: 下一页
share:
share: 分享
post: 分享本文
toTwitter: "分享到 Twitter"
toFacebook: "分享到 Facebook"
toLinkedIn: "分享到 LinkedIn"
toTelegram: "分享到 Telegram"
toGplus: "分享到 Google+"
toWeibo: "分享到微博"
toQQ: "分享到 QQ"
post:
continue: "阅读全文"
posted: 本文发表于
edited: 最后修改于
author: 本文作者
permalink: 本文链接
expired: 本文最后更新于 %s 天前,文中所描述的信息可能已发生改变
comment:
load_disqus_button: "阅读评论(请确保 disqus 可以正常加载)"
load_disqus_fully_button: "加载完整评论(请确保 disqus 可以正常加载)"
load_disqus_proxy_button: "加载评论基本模式"
counter:
archive: "目前共计 %d 篇文章"

View File

@ -0,0 +1,67 @@
<div class="container">
<div class="main-container">
<main>
<div class="timeline">
<div class="timeline-item">
<div class="timeline-left">
<div class="timeline-icon"></div>
</div>
<div class="timeline-content">
<div class="tile">
<div class="tile-content">
<p class="tile-title">
<%= __('counter.archive', site.posts.length) %>
</p>
</div>
</div>
</div>
</div>
<% function buildArchive(posts, year, month = null) {
const time = moment([page.year, (page.month) ? page.month - 1 : null].filter(i => i !== null)); %>
<div class="timeline-item">
<div class="timeline-left">
<div class="timeline-icon icon-lg"></div>
</div>
<div class="timeline-content">
<div class="tile">
<div class="tile-content">
<p class="tile-title mb-0 h4"><%= (month === null) ? year : (time.locale((config.language) ? config.language : 'en').format('MMMM YYYY')) %></p>
</div>
</div>
</div>
</div>
<% posts.each(post => { %>
<div class="timeline-item">
<div class="timeline-left">
<div class="timeline-icon"></div>
</div>
<div class="timeline-content">
<div class="tile">
<div class="tile-content">
<span class="tile-subtitle text-gray mb-1"><%= date(post.date, 'MM-DD') %></span>
<a href="<%- url_for(post.path) %>" class="timeline-tile-title ml-1" rel="bookmark"><span class="tile-title"><%- post.title %></span></a>
</div>
</div>
</div>
</div>
<% }) %>
<% } %>
<% if (!page.year) {
let years = {};
page.posts.each(post => years[post.date.year()] = null);
for (let year of Object.keys(years).sort((a, b) => b - a)) {
let posts = page.posts.filter(p => p.date.year() == year); %>
<%- buildArchive(posts, year, null) %>
<% }
} else { %>
<%- buildArchive(page.posts, page.year, page.month) %>
<% } %>
</div>
</main>
<%- partial('_partial/pagination') %>
</div>
</div>

View File

@ -0,0 +1,17 @@
<div class="container">
<div class="main-container">
<main>
<!-- # Title # -->
<h2 class="page-title"><%= __("category") + " : " + page.category %></h2>
<!-- # Post List # -->
<div class="post-stream-container">
<% page.posts.sort('date', -1).each(function(post){ %>
<div class="grid-item">
<%- partial('_partial/post-entry', { post: post, index: true, pin: false }) %>
</div>
<% }) %>
</div>
</main>
<%- partial('_partial/pagination') %>
</div>
</div>

View File

@ -0,0 +1,26 @@
<div class="container">
<div class="link-container">
<% if (site.data.links) { %>
<div class="link-list">
<% for (const i in site.data.links) { %>
<div class="link-item">
<a href="<%= site.data.links[i].url %>" title="<%= i %>" target="_blank">
<div class="card">
<div class="tile tile-centered">
<div class="link-img">
<img src="<%= site.data.links[i].img %>" alt="<%= i %>">
</div>
<div class="tile-content link-content">
<div class="tile-title link-title"><%= i %></div>
<div class="tile-subtitle link-descr text-gray"><%- site.data.links[i].text %></div>
</div>
</div>
</div>
</a>
</div>
<% } %>
</div>
<% } %>
</div>
</div>

View File

@ -0,0 +1,40 @@
<div class="post-container pjax">
<div id="post-card" class="card">
<% if (page.thumbnail) { %>
<div class="card-image lazyload" data-bg="url('<%= page.thumbnail %>')"></div>
<% } %>
<div class="card-item-container">
<div class="card-inner-cell">
<!-- # Post Header Info # -->
<div class="card-header">
<%- partial('_partial/post/header-info') %>
</div>
<div class="card-body">
<% if (theme.toc.enable && (page.toc !== false) ) { %>
<% const toc_obj = toc(page.content, {
class: 'post-toc',
list_number: theme.toc.line_number || false
}); %>
<% if (toc_obj.length > 0) { %>
<div id="post-toc"><%- toc_obj %></div>
<% } %>
<% } %>
<article id="post-content">
<%- page.content %>
</article>
<%- partial('_partial/post/footer-info') %>
</div>
<%- partial('_partial/post/footer-pagination') %>
<% if (page.comments !== false) { %>
<!-- # Comment # -->
<% if (theme.comment.use) { %>
<div class="card-footer post-comment">
<%- partial('_plugin/comment/' + theme.comment.use + '/main') %>
</div>
<% } %>
<% } %>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,28 @@
<div class="container search-container">
<div class="main-container">
<!-- # Title # -->
<h2 class="page-title"><%= __('search.main') %></h2>
<% if (theme.search.use === 'google') { %>
<%- partial('_plugin/search/google/main') %>
<% } %>
<% if (theme.search.use === 'local') { %>
<%- partial('_plugin/search/local-search/main') %>
<% } %>
<% if (theme.search.use === 'swiftype') { %>
<%- partial('_plugin/search/swiftype/main') %>
<% } %>
</div>
</div>
<% if (theme.search.use === 'local') { %>
<%- partial('_plugin/search/local-search/common') %>
<% } %>
<% if (theme.search.use === 'swiftype') { %>
<%- partial('_plugin/search/swiftype/common') %>
<% } %>

View File

@ -0,0 +1,15 @@
<div class="container">
<div class="main-container">
<main>
<!-- # Title # -->
<h2 class="page-title"><%= __("tag") + " : " + page.tag %></h2>
<!-- # Post List # -->
<div class="post-stream-container">
<% page.posts.sort('date', -1).each(function(post){ %>
<%- partial('_partial/post-entry', { post: post, index: true, pin: false }) %>
<% }) %>
</div>
</main>
<%- partial('_partial/pagination') %>
</div>
</div>

View File

@ -0,0 +1,15 @@
<div class="container">
<main>
<div class="tagscloud">
<%- tagcloud({
min_font: .75,
max_font: 1.8,
unit: 'rem',
amount: 9999,
color: true,
start_color: '#acb3c2',
end_color: '#454d5d',
}) %>
</div>
</main>
</div>

View File

@ -0,0 +1,42 @@
<footer class="text-center">
<!-- footer copyright -->
<%- fragment_cache('footer_copyright_text', () => {
return `
<p class="footer-copyright mb-0">Copyright&nbsp;©&nbsp;<span id="copyright-year"></span>
<a class="footer-copyright-a" href="${config.url}">${config.title}</a>
</p>`
}) %>
<!-- footer custom text -->
<p class="footer-text mb-0">
<%- fragment_cache('footer_custom_text', () => {
if (theme.footer.custom_text) {
if (Array.isArray(theme.footer.custom_text)) {
return theme.footer.custom_text.join('<br>');
} else {
return theme.footer.custom_text;
}
}
}) %>
</p>
<!-- footer develop info -->
<p class="footer-develop mb-0">
<%- fragment_cache('footer_counter_text', () => {
if (theme.busuanzi.enable) return partial('_plugin/busuanzi/footer_counter');
return '';
}) %>
<% if ( (theme.valine_counter.enable) && (theme.valine_counter.site_pv.enable) ) { %>
<%- partial('_plugin/valine-counter/footer') %>
<% } %>
Powered by&nbsp;<!--
--><a href="https://hexo.io" target="_blank" class="footer-develop-a" rel="external nofollow noopener noreferrer">Hexo</a><span class="footer-develop-divider"></span>Theme&nbsp;-&nbsp;<!--
--><a href="https://github.com/SukkaW/hexo-theme-suka" target="_blank" class="footer-develop-a" rel="external noopener">Suka</a>
</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/pjax@0.2.8/pjax.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js" defer></script>
<script src="/js/blog-186.js" defer></script>
<script src="https://cdn.jsdelivr.net/gh/gijo-varghese/flying-pages@2.1.2/flying-pages.min.js" defer></script>

View File

@ -0,0 +1,18 @@
<% if (theme.analytics.google_site_id) { %>
<%- partial('_plugin/analytics/google', {}, {cache: theme.fragment_cache}) %>
<% } %>
<% if (theme.analytics.gtags_site_id) { %>
<%- partial('_plugin/analytics/gtags', {}, {cache: theme.fragment_cache}) %>
<% } %>
<% if (theme.analytics.baidu_site_id) { %>
<%- partial('_plugin/analytics/baidu', {}, {cache: theme.fragment_cache}) %>
<% } %>
<% if (theme.analytics.cnzz_site_id) { %>
<%- partial('_plugin/analytics/cnzz', {}, {cache: theme.fragment_cache}) %>
<% } %>
<% if (theme.analytics.tencent_site_id) { %>
<%- partial('_plugin/analytics/tencent', {}, {cache: theme.fragment_cache}) %>
<% } %>
<% if (theme.analytics.tencent_mta_id) { %>
<%- partial('_plugin/analytics/tencent-mta', {}, {cache: theme.fragment_cache}) %>
<% } %>

View File

@ -0,0 +1,83 @@
<style>
body {
background-color: <% if (theme.uiux.bg_color) { %><%= theme.uiux.bg_color %><% } else { %>#f8f9fa<% } %>;
}
a, a:visited {
color: <% if (theme.uiux.link_color) { %><%= theme.uiux.link_color %><% } else { %>#0070ff<% } %>;
}
a:active, a:focus, a:hover {
color: <% if (theme.uiux.link_color) { %><%= theme.uiux.link_color %><% } else { %>#0070ff<% } %>;
opacity: .75;
}
#post-content a,
#post-content a:hover,
#post-content a:focus,
#post-content a:visited {
color: <% if (theme.uiux.link_color) { %><%= theme.uiux.link_color %><% } else { %>#005eb9<% } %>;
opacity: 1;
}
<% if (theme.uiux.lazy_padding_bottom) { %>
#post-content img.lazyload {
transition: filter .35s ease 0s;
}
#post-content img.lazyload:not(.loaded) {
-webkit-filter: blur(5px);
filter: blur(5px);
}
#post-content img.lazyload:not(.loaded):not(.loading) {
padding-bottom: <%= theme.uiux.lazy_padding_bottom %>;
}
#post-content img.lazyload.error {
display: none
}
<% } %>
.post-entry .card-body a {
color: <% if (theme.uiux.primary_color) { %><%= theme.uiux.primary_color %><% } else { %>#0070ff<% } %>;
}
.avatar {
background: <% if (theme.uiux.primary_color) { %><%= theme.uiux.primary_color %><% } else { %>#444<% } %>;
}
.navbar-link,
.navbar-link:visited,
.timeline .timeline-item .timeline-icon.icon-lg {
color: <% if (theme.uiux.primary_color) { %><%= theme.uiux.primary_color %><% } else { %>#0070ff<% } %>;
}
.navbar-link:hover {
color: <% if (theme.uiux.primary_color) { %><%= theme.uiux.primary_color %><% } else { %>#0070ff<% } %>;
opacity: .8;
}
#search-input .btn,
#disqus_click_btn,
#disqus-switch-to-direct,
#disqus-loadmore-button {
background: <% if (theme.uiux.primary_color) { %><%= theme.uiux.primary_color %><% } else { %>#727e96<% } %>;
border-color: <% if (theme.uiux.primary_color) { %><%= theme.uiux.primary_color %><% } else { %>#727e96<% } %>;
color: #fff;
}
#post-toc a.post-toc-link,
#post-toc a.post-toc-link:visited,
.share-menu.menu .menu-item>a {
color: <% if (theme.uiux.primary_color) { %><%= theme.uiux.primary_color %><% } else { %>#727e96<% } %>;
}
.share-menu.menu .menu-item>a:hover,
.share-menu.menu .menu-item>a:focus,
.share-menu.menu .menu-item>a:visited {
color: #50596c;
background: <% if (theme.uiux.bg_color) { %><%= theme.uiux.bg_color %><% } else { %>#f8f9fa<% } %>;
opacity: .85;
}
</style>

View File

@ -0,0 +1,50 @@
<meta http-equiv="x-dns-prefetch-control" content="on">
<!-- busuanzi -->
<% if (theme.busuanzi.enable) { %>
<link rel="dns-prefetch" href="//busuanzi.ibruce.info">
<% } %>
<!-- comment -->
<% if (theme.comment.use === "changyan") { %>
<link rel="dns-prefetch" href="//changyan.sohu.com">
<% } %>
<% if (theme.comment.use === "disqus") { %>
<link rel="dns-prefetch" href="//disqus.com">
<link rel="dns-prefetch" href="//<%= theme.comment.disqus.shortname %>.disqus.com">
<% } %>
<% if (theme.comment.use === "gitalk") { %>
<link rel="dns-prefetch" href="//api.github.com">
<link rel="dns-prefetch" href="//cors-anywhere.herokuapp.com">
<% } %>
<% if (theme.comment.use === "gitment") { %>
<link rel="dns-prefetch" href="//imsun.github.io">
<link rel="dns-prefetch" href="//api.github.com">
<% } %>
<% if (theme.comment.use === "livere") { %>
<link rel="dns-prefetch" href="//cdn-city.livere.com">
<% } %>
<% if (theme.comment.use === "valine") { %>
<link rel="dns-prefetch" href="//cdn1.lncld.net">
<% } %>
<!-- analytics -->
<% if (theme.analytics.baidu_site_id) { %>
<link rel="dns-prefetch" href="//hm.baidu.com">
<% } %>
<% if (theme.analytics.google_site_id) { %>
<link rel="dns-prefetch" href="//www.google-analytics.com">
<% } %>
<% if (theme.analytics.gtags_site_id) { %>
<link rel="dns-prefetch" href="//www.googletagmanager.com">
<link rel="dns-prefetch" href="//www.google-analytics.com">
<% } %>
<% if (theme.analytics.cnzz_site_id) { %>
<link rel="dns-prefetch" href="//s95.cnzz.com">
<% } %>
<% if (theme.analytics.tencent_site_id) { %>
<link rel="dns-prefetch" href="//tajs.qq.com">
<% } %>
<% if (theme.analytics.tencent_mta_id) { %>
<link rel="dns-prefetch" href="//pingjs.qq.com">
<% } %>

View File

@ -0,0 +1,128 @@
<head>
<meta charset="utf-8">
<!--
hexo-theme-suka © SukkaW
GitHub: https://github.com/SukkaW/hexo-theme-suka
-->
<!-- ### Resource Hint ### -->
<!-- ## DNS Prefetch ## -->
<%- partial('_partial/head/dns-prefetch', {}, {cache: theme.fragment_cache}) %>
<!-- ## Preload ## -->
<%- partial('_partial/head/preload', {}, {cache: theme.fragment_cache}) %>
<!-- ### Meta & Title & Info ### -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, maximum-scale=5, viewport-fit=cover">
<meta name="renderer" content="webkit">
<!-- Title -->
<title><%= page_title() %></title>
<!-- Favicons -->
<%- fragment_cache('head_favicon_and_theme-color', () => {
let html = favicon();
let theme_color = '';
if (theme.head.color) {
theme_color = theme.head.color
} else if (theme.uiux.bg_color) {
theme_color = theme.uiux.bg_color
}
if (theme.head.favicon.safari_pinned_tab) {
html += `<link rel="mask-icon" href="${url_for(theme.head.favicon.safari_pinned_tab)}" color="${theme_color}">`;
}
if (theme.head.color || theme.uiux.bg_color) {
html += `<meta name="theme-color" content="${theme_color}">`;
}
return html;
}) %>
<!-- ### Import File ### -->
<%- partial('_partial/source/head') %>
<!-- ### Site Verification ### -->
<%- partial('_partial/head/site-verification', {}, {cache: theme.fragment_cache}) %>
<%- fragment_cache('head_common', () => {
let html = '';
/* RSS */
if ( (config.feed) && (config.feed.path) ) {
if (config.feed.type === 'atom') {
html += `<link rel="alternate" type="application/atom+xml" href="${url_for(config.feed.path)}">`
} else if (config.feed.type === 'rss2') {
html += `<link rel="alternate" type="application/rss+xml" href="${url_for(config.feed.path)}">`
}
}
/* WebApp */
html += '<meta name="mobile-web-app-capable" content="yes">';
html += `<meta name="application-name" content="${config.title}">`;
html += `<meta name="msapplication-starturl" content="${config.url}">`;
if (theme.head.color) {
html += `<meta name="msapplication-navbutton-color" content="${theme.head.color}">`;
} else if (theme.uiux.bg_color) {
html += `<meta name="msapplication-navbutton-color" content="${theme.uiux.bg_color}">`;
}
html += '<meta name="apple-mobile-web-app-capable" content="yes">';
html += `<meta name="apple-mobile-web-app-title" content="${config.title}">`
html += '<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">'
/* PWA Manifest */
if (theme.head.pwa_manifest) {
html += `<link rel="manifest" href="${theme.head.pwa_manifest}">`
}
/* Open Search */
if (theme.head.open_search) {
html += `<link rel="search" type="application/opensearchdescription+xml" href="${theme.head.open_search}" title="${config.title}">`
}
return html;
}) %>
<!-- ### The Open Graph & Twitter Card Protocol ### -->
<%- _open_graph() %>
<%- fragment_cache('head_facebook_admin', () => {
let html = '';
if (theme.comment.use === 'facebook') {
if (theme.comment.facebook.admin_fb_appid) {
html += `<meta property="fb:app_id" content="${theme.comment.facebook.admin_fb_appid}">`
} else if (theme.comment.facebook.admin_fb_username) {
html += `<meta property="fb:admins" content="${theme.comment.facebook.admin_fb_username}">`
}
}
return html;
}) %>
<!-- ### Canonical link ### -->
<link rel="canonical" href="<%= full_url_for(page.path).replace('index.html', '') %>">
<%- fragment_cache('head_meta_generator', _meta_generator) %>
<!-- ### Analytics ### -->
<%- partial('_partial/head/analytics', {}, {cache: theme.fragment_cache}) %>
<!-- ### Structured Data ### -->
<%- partial('_partial/head/structured-data') %>
<!-- ### Custom Head ### -->
<%- fragment_cache('head_custom_code', () => {
let html = '';
if (site.data.head) {
for (const i in site.data.head) {
if (Array.isArray(site.data.head[i])) {
html += site.data.head[i].join('');
} else if (site.data.head[i] !== null) {
html += site.data.head[i];
}
}
}
return html;
}) %>
</head>

View File

@ -0,0 +1,12 @@
<script>
window.lsVersion = "<%= theme.verison %>",
window.oldVersion = [
<% if(theme.old_verison) { %>
<% if(Array.isArray(theme.old_verison)) { %>
"<%- theme.old_verison.join('\",\"') %>"
<% } else { %>
"<%- theme.old_verison %>"
<% } %>
<% } %>
]
</script>

View File

@ -0,0 +1,9 @@
<% if (theme.busuanzi.enable) { %>
<!-- Busuanzi -->
<%- partial('_plugin/busuanzi/preload') %>
<% } %>
<% if (theme.hanabi.enable) { %>
<!-- Hanabi -->
<%- partial('_plugin/highlight/hanabi/preload') %>
<% } %>

View File

@ -0,0 +1,6 @@
<% if (theme.head.site_verification.google) { %>
<meta name="google-site-verification" content="<%= theme.head.site_verification.google %>" />
<% } %>
<% if (theme.head.site_verification.baidu) { %>
<meta name="baidu-site-verification" content="<%= theme.head.site_verification.baidu %>" />
<% } %>

View File

@ -0,0 +1,100 @@
<% if ( is_home() ) { %>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Blog",
"author": {
"@type": "Person",
"name": "<%= config.author %>",
"image": {
"@type": "ImageObject",
"url": "<%= full_url_for(theme.img.avatar) %>"
},
"description": "<%- theme.uiux.slogan %>"
},
"publisher": {
"@type": "Organization",
"name": "<%= config.title %>",
"logo": {
"@type": "ImageObject",
"url": "<%= site_logo() %>"
}
},
"url": "<%- config.url %>",
"logo": "<%= site_logo() %>",
"image": {
"@type": "ImageObject",
"url": "<%= site_logo() %>"
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "<%= config.url %>"
},
<% if ( (theme.search.use === "local") || (theme.nav.search.link) ) { %>
"potentialAction": {
"@type": "SearchAction",
"target": "<%= full_url_for(theme.nav.search.link) %>?s={search_term_string}",
"query-input": "required name=search_term_string"
},
<% } %>
"keywords": "<%= page_tags() %>",
"description": "<%= page_descr() %>"
}
</script>
<% } %>
<% if( (is_post()) ) { %>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"url": "<%= page.permalink %>",
"@type": "BlogPosting",
"logo": "<%= site_logo() %>",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "<%= page.permalink %>"
},
"headline": "<%= page_title() %>",
<% if(page.thumbnail) { %>
"image": {
"@type": "ImageObject",
"url": "<%= full_url_for(page.thumbnail) %>"
},
<% } else { %>
"image": {
"@type": "ImageObject",
"url": "<%= site_logo() %>"
},
<% } %>
"datePublished": "<%= date_xml(page.date) %>",
"dateModified": "<%= date_xml(page.updated) %>",
"author": {
"@type": "Person",
"name": "<%= config.author %>",
"image": {
"@type": "ImageObject",
"url": "<%= full_url_for(theme.img.avatar) %>"
},
"description": "<%- theme.uiux.slogan %>"
},
"publisher": {
"@type": "Organization",
"name": "<%= config.title %>",
"logo": {
"@type": "ImageObject",
"url": "<%= site_logo() %>"
}
},
<% if ( (theme.search.use === "local") || (theme.nav.search.link) ) { %>
"potentialAction": {
"@type": "SearchAction",
"target": "<%= full_url_for(theme.nav.search.link) %>?s={search_term_string}",
"query-input": "required name=search_term_string"
},
<% } %>
"keywords": "<%= page_tags() %>",
"description": "<%= page_descr() %>"
}
</script>
<% } %>

View File

@ -0,0 +1,16 @@
<!-- ## Header ##-->
<header>
<h1 class="header-title text-center"><a href="<%= config.root %>"><%= config.title %></a></h1>
<p class="text-center header-slogan">
<% if (theme.uiux.slogan) { %>
<% if (Array.isArray(theme.uiux.slogan)) { %>
<%- theme.uiux.slogan.join('<br>') %>
<% } else { %>
<%- theme.uiux.slogan %>
<% } %>
<% } %>
</p>
<%- partial('_partial/index-nav') %>
</header>

View File

@ -0,0 +1,22 @@
<nav class="navbar-section text-center">
<% if (theme.nav.home.use) { %>
<a href="<%= url_for('/') %>" class="navbar-link"><%= __('home') %></a>
<% } %>
<% if (theme.nav.archives.use) {
let archiveDir = config.archive_dir;
if (archiveDir[archiveDir.length - 1] !== '/') archiveDir += '/'; %>
<a href="<%= url_for(archiveDir) %>" class="navbar-link"><%= __('archive') %></a>
<% } %>
<% if (theme.nav.search.use) { %>
<a href="<%= theme.nav.search.link %>" class="navbar-link"><%= __('search.main') %></a>
<% } %>
<% for (const i in theme.nav.pages){ %>
<a href="<%= theme.nav.pages[i].link %>" class="navbar-link"><%= i %></a>
<% } %>
<% if (theme.nav.share.use) { %>
<%- partial('_partial/menu/index-share', {}, {cache: theme.fragment_cache}) %>
<% } %>
<% if (theme.nav.rss.use) { %>
<a href="<%= url_for(config.feed.path) %>" target="_blank" class="navbar-link">RSS</a>
<% } %>
</nav>

View File

@ -0,0 +1,62 @@
<div class="dropdown dropdown-right">
<a class="navbar-link dropdown-toggle" tabindex="0"><%= __('share.share') %></a>
<ul class="menu share-menu">
<!-- Share Weibo -->
<% if(theme.sns_share.weibo) { %>
<li class="menu-item">
<a href="http://service.weibo.com/share/share.php?appkey=&title=<%- config.title %>&url=<%- config.url %>&pic=<% if (page.thumbnail) { %><%= page.thumbnail %><% } else { %><%= site_logo() %><% } %>&searchPic=false&style=simple" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toWeibo') %></a>
</li>
<% } %>
<!-- Share Twitter -->
<% if(theme.sns_share.twitter) { %>
<li class="menu-item">
<a href="https://twitter.com/intent/tweet?text=<%- config.title %>&url=<%- config.url %>&via=<%= config.author %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toTwitter') %></a>
</li>
<% } %>
<!-- Share Facebook -->
<% if(theme.sns_share.facebook) { %>
<li class="menu-item">
<a href="https://www.facebook.com/sharer/sharer.php?u=<%= config.url %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toFacebook') %></a>
</li>
<% } %>
<!-- Share Google+ -->
<% if(theme.sns_share.googleplus) { %>
<li class="menu-item">
<a href="https://plus.google.com/share?url=<%- config.url %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toGplus') %></a>
</li>
<% } %>
<!-- Share LinkedIn -->
<% if(theme.sns_share.linkedin) { %>
<li class="menu-item">
<a href="https://www.linkedin.com/shareArticle?mini=true&url=<%- config.url %>&title=<%= page.title %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toLinkedIn') %></a>
</li>
<% } %>
<!-- Share QQ -->
<% if(theme.sns_share.qq) { %>
<li class="menu-item">
<a href="http://connect.qq.com/widget/shareqq/index.html?site=<%- config.title %>&title=<%= page.title %>&summary=<%= config.description %>&pics=<% if (page.thumbnail) { %><%= page.thumbnail %><% } else { %><%= site_logo() %><% } %>&url=<%- config.url %>" target="_blank" rel="external noopener noreferrer nofollow"> <%= __('share.toQQ') %></a>
</li>
<% } %>
<!-- Share Telegram -->
<% if(theme.sns_share.telegram) { %>
<li class="menu-item">
<a href="https://t.me/share/url?url=<%- config.url %>&text=<%= page.title %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toTelegram') %></a>
</li>
<% } %>
<!-- QRCode -->
<% if(theme.qrcode.post_share) { %>
<li class="menu-item">
<img src="<%- qrcode(url, {margin: 2, size: 4}) %>" alr="QRCode">
</li>
<% } %>
</ul>
</div>

View File

@ -0,0 +1,61 @@
<div class="dropdown dropdown-right">
<a class="dropdown-toggle" tabindex="0"><%= __('share.post') %></a>
<ul class="menu share-menu">
<!-- Share Weibo -->
<% if(theme.sns_share.weibo) { %>
<li class="menu-item">
<a href="http://service.weibo.com/share/share.php?appkey=&title=<%= page.title %>&url=<%= full_url_for(page.path).replace('index.html', '') %>&pic=<% if (page.thumbnail) { %><%= page.thumbnail %><% } else { %><%= site_logo() %><% } %>&searchPic=false&style=simple" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toWeibo') %></a>
</li>
<% } %>
<!-- Share Twitter -->
<% if(theme.sns_share.twitter) { %>
<li class="menu-item">
<a href="https://twitter.com/intent/tweet?text=<%= page.title %>&url=<%= full_url_for(page.path).replace('index.html', '') %>&via=<%= config.author %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toTwitter') %></a>
</li>
<% } %>
<!-- Share Facebook -->
<% if(theme.sns_share.facebook) { %>
<li class="menu-item">
<a href="https://www.facebook.com/sharer/sharer.php?u=<%= full_url_for(page.path).replace('index.html', '') %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toFacebook') %></a>
</li>
<% } %>
<!-- Share Google+ -->
<% if(theme.sns_share.googleplus) { %>
<li class="menu-item">
<a href="https://plus.google.com/share?url=<%= full_url_for(page.path).replace('index.html', '') %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toGplus') %></a>
</li>
<% } %>
<!-- Share LinkedIn -->
<% if(theme.sns_share.linkedin) { %>
<li class="menu-item">
<a href="https://www.linkedin.com/shareArticle?mini=true&url=<%= full_url_for(page.path).replace('index.html', '') %>&title=<%- config.title %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toLinkedIn') %></a>
</li>
<% } %>
<!-- Share QQ -->
<% if(theme.sns_share.qq) { %>
<li class="menu-item">
<a href="http://connect.qq.com/widget/shareqq/index.html?site=<%- config.title %>&title=<%- config.title %>&summary=<%= config.description %>&pics=<% if (page.thumbnail) { %><%= page.thumbnail %><% } else { %><%= site_logo() %><% } %>&url=<%= full_url_for(page.path).replace('index.html', '') %>" target="_blank" rel="external noopener noreferrer nofollow"> <%= __('share.toQQ') %></a>
</li>
<% } %>
<!-- Share Telegram -->
<% if(theme.sns_share.telegram) { %>
<li class="menu-item">
<a href="https://t.me/share/url?url=<%= full_url_for(page.path).replace('index.html', '') %>&text=<%- config.title %>" target="_blank" rel="external noopener noreferrer nofollow"><%= __('share.toTelegram') %></a>
</li>
<% } %>
<!-- QRCode -->
<% if(theme.qrcode.post_share) { %>
<li class="menu-item">
<img src="<%- qrcode(url, {margin: 2, size: 4}) %>" alt="QRCode">
</li>
<% } %>
</ul>
</div>

View File

@ -0,0 +1,22 @@
<% if (page.total > 1) { %>
<nav>
<ul class="pagination">
<% if (page.prev) { %>
<li class="page-item page-prev">
<a href="<%- url_for(page.prev_link) %>" rel="prev">
<span class="page-item-subtitle"><i class="icon icon-back" aria-hidden="true"></i></span>
<span class="page-item-title"><%= __('nav.prev_page') %></span>
</a>
</li>
<% } %>
<% if (page.next) { %>
<li class="page-item page-next">
<a href="<%- url_for(page.next_link) %>" rel="next">
<span class="page-item-title"><%= __('nav.next_page') %></span>
<span class="page-item-subtitle"><i class="icon icon-forward" aria-hidden="true"></i></span>
</a>
</li>
<% } %>
</ul>
</nav>
<% } %>

View File

@ -0,0 +1,34 @@
<% if (post.title) { %>
<h2 class="h5 mb-0 card-header"><a class="card-title" href="<%= url_for(post.path) %>" rel="bookmark"><%- post.title %></a></h2>
<% } %>
<p class="mb-0 card-body">
<% if (post.excerpt) {%>
<%- strip_html(post.excerpt) %>
<% } else { %>
<%- strip_html(truncate(post.content, { length: theme.post.entry_excerpt })) %>
<% } %><a href="<%= url_for(post.path) %>"><%= __('post.continue') %></a>
</p>
<%
const lazyloadImgSrc = (theme.vendors.lazyload_img) ? theme.vendors.lazyload_img : url_for('img/suka-lazyload.gif');
%>
<!-- Date & Category -->
<div class="card-footer post-entry-info text-gray">
<img class="author-thumb lazyload" data-src="<%= url_for(theme.img.avatar) %>" src="<%= lazyloadImgSrc %>" alt="<%= config.author %>'s Avatar">
<time><%= date(post.date, config.date_format) %></time>
<% if (post.categories && post.categories.length) { %>
<span class="suka-devide-dot"></span>
<%- list_categories(post.categories, {
show_count: false,
separator: '<span class="suka-devide-dot"></span>',
style: 'none'
}) %>
<% } %>
<% if ( (theme.valine_counter.enable) && (theme.valine_counter.index_post_pv.enable) ) { %>
<span class="suka-devide-dot"></span>
<%- partial('_plugin/valine-counter/index_post', {}, {cache: theme.fragment_cache}) %>
<% } %>
</div>

View File

@ -0,0 +1,18 @@
<article class="post-entry container px-0 card">
<div class="columns col-gapless">
<% if (post.thumbnail) { %>
<div class="column column-thumbnail col-4 col-lg-12">
<a href="<%= url_for(post.path) %>">
<div class="post-thumbnail lazyload" data-bg="url(<%= post.thumbnail %>)"></div>
</a>
</div>
<div class="column column-body col-8 col-lg-12">
<%- partial('_partial/post-entry-content') %>
</div>
<% } else { %>
<div class="column col-12">
<%- partial('_partial/post-entry-content') %>
</div>
<% } %>
</div>
</article>

View File

@ -0,0 +1,58 @@
<% if (page.hide_license !== true && theme.post.license || page.license) { %>
<blockquote class="post-license">
<p>
<strong><%- __('post.author') %>&nbsp;:&nbsp;<%= config.author %></strong>
<br>
<strong>
<% if (page.license) { %>
<%- page.license %>
<% } else { %>
<%- theme.post.license %>
<% } %></strong>
<br>
<strong><%- __('post.permalink') %>&nbsp;:&nbsp;</strong><a href="<%= page.permalink %>"><%= page.permalink %></a>
</p>
</blockquote>
<% } %>
<% if (theme.post.expire) { %>
<blockquote id="date-expire-notification" class="post-expired-notify"><%- __('post.expired', '<span id="date-expire-num"></span>') %></blockquote>
<script>
(function() {
var dateUpdate = Date.parse("<%= date(page.updated, 'YYYY-MM-DD') %>");
var nowDate = new Date();
var a = nowDate.getTime();
var b = a - dateUpdate;
var daysUpdateExpire = Math.floor(b/(24*3600*1000));
if (daysUpdateExpire >= 120) {
document.getElementById('date-expire-num').innerHTML = daysUpdateExpire;
} else {
document.getElementById('date-expire-notification').style.display = 'none';
}
})();
</script>
<% } %>
<p class="post-footer-info mb-0 pt-0"><%= __('post.posted') %>&nbsp;<time datetime="<%= date_xml(page.date) %>" itemprop="datePublished"><%= date(page.date, config.date_format) %></time>
<% if (date(page.date, 'MMM DD, YYYY') !== date(page.updated, 'MMM DD, YYYY')) { %>
, <%= __('post.edited') %>&nbsp;<time datetime="<%= date_xml(page.updated) %>" itemprop="dateModified"><%= date(page.updated, config.date_format) %></time>
<% } %>
</p>
<p class="post-footer-info mb-0 pt-2">
<% if (page.categories && page.categories.length) { %>
<span class="post-categories-list mt-2">
<% page.categories.forEach(function(category, index) { %>
<a class="post-categories-list-item" href='<%= url_for(category.path) %>'><%= category.name %></a>
<% }); %>
</span>
<% } %>
<% if (page.tags && page.tags.length){ %>
<span class="post-tags-list mt-2">
<% page.tags.forEach(function(tag, index) { %>
<a class="post-tags-list-item" href="<%= url_for(tag.path) %>" rel="tag">#&nbsp;<%= tag.name %></a>
<% }); %>
</span>
<% } %>
</p>

View File

@ -0,0 +1,23 @@
<div class="post-nav px-2 bg-gray">
<ul class="pagination">
<!-- Prev Nav -->
<% if (page.prev) { %>
<li class="page-item page-prev">
<a href="<%- url_for(page.prev.path) %>" rel="prev">
<div class="page-item-title"><i class="icon icon-back" aria-hidden="true"></i></div>
<div class="page-item-subtitle"><%= page.prev.title %></div>
</a>
</li>
<% } %>
<!-- Next Nav -->
<% if (page.next) { %>
<li class="page-item page-next">
<a href="<%- url_for(page.next.path) %>" rel="next">
<div class="page-item-title"><i class="icon icon-forward" aria-hidden="true"></i></div>
<div class="page-item-subtitle"><%= page.next.title %></div>
</a>
</li>
<% } %>
</ul>
</div>

View File

@ -0,0 +1,33 @@
<% if (page.title) { %>
<h1 class="card-title h3 mb-2"><%- page.title %></h1>
<% } %>
<%
const lazyloadImgSrc = (theme.vendors.lazyload_img) ? theme.vendors.lazyload_img : url_for('img/suka-lazyload.gif');
%>
<div class="post-header-info">
<p class="post-header-info-left text-gray">
<img class="author-thumb lazyload" data-src="<%= url_for(theme.img.avatar) %>" src="<%= lazyloadImgSrc %>" alt="<%= config.author %>'s Avatar">
<span><%= date(page.date, config.date_format) %></span>
<% if (page.categories && page.categories.length) { %>
<span class="suka-devide-dot"></span>
<%- list_categories(page.categories, {
show_count: false,
separator: '<span class="suka-devide-dot"></span>',
style: 'none'
}) %>
<% } %>
<% if ( (theme.busuanzi.enable) && (theme.busuanzi.post_pv.enable) ) { %>
<%- partial('_plugin/busuanzi/post-counter', {}, {cache: theme.fragment_cache}) %>
<% } %>
<% if ( (theme.valine_counter.enable) && (theme.valine_counter.post_pv.enable) ) { %>
<%- partial('_plugin/valine-counter/post', {}, {cache: theme.fragment_cache}) %>
<% } %>
</p>
<div class="post-header-info-right">
<% if (theme.post.share) { %>
<%- partial('_partial/menu/post-share') %>
<% } %>
</div>
</div>

View File

@ -0,0 +1,84 @@
<!-- ### Footer JS Import ### -->
<script>
<%- fragment_cache('footer_inline_js', () => {
let js = [];
/* Vanilla Lazyload Config */
js.push(`
window.lazyLoadOptions = {
elements_selector: ".lazyload",
threshold: 50
};`);
/* Copyright */
if (theme.footer.copyright_since > 0) {
js.push(`
(function() {
var copyrightNow = new Date().getFullYear();
var copyrightContent = document.getElementById('copyright-year');
var copyrightSince = ${theme.footer.copyright_since};
if (copyrightSince === copyrightNow) {
copyrightContent.textContent = copyrightNow;
} else {
copyrightContent.textContent = copyrightSince + ' - ' + copyrightNow;
}
})();`);
} else {
js.push(`document.getElementById('copyright-year').textContent = new Date().getFullYear();`);
}
/* Suka Theme Console.Log */
js.push(`console.log('\\n %c Suka Theme (hexo-theme-suka) | © SukkaW | Verision ${theme.verison} %c https://github.com/SukkaW/hexo-theme-suka \\n', 'color: #fff; background: #444; padding:5px 0;', 'background: #bbb; padding:5px 0;');`);
return js.join('\n');
}) %>
</script>
<%- fragment_cache('footer_common_js', () => {
let html = '';
/* vanilla-lazyload */
if (theme.vendors.lazyload) {
html += `<script src="${theme.vendors.lazyload}" async></script>`
} else {
html += `<script src="${url_for('lib/vanilla-lazyload/lazyload.min.js')}" async></script>`
}
/* Busuanzi */
if (theme.busuanzi.enable) html += partial('_plugin/busuanzi/import_js');
/* theme.hanabi.enable */
if (theme.hanabi.enable) html += partial('_plugin/highlight/hanabi/import_js');
return html
}) %>
<% if (theme.prettify.enable) { %>
<!-- prettify -->
<%- partial('_plugin/highlight/prettify/import_js') %>
<% } %>
<!-- Comment -->
<% if (theme.comment.use) { %>
<% if ( (is_post()) ) { %>
<%- partial('_plugin/comment/' + theme.comment.use + '/common', {}, {cache: theme.fragment_cache}) %>
<% } %>
<% } %>
<!-- ### Custom Footer ### -->
<%- fragment_cache('footer_custom_code', () => {
let html = '';
if (site.data.footer) {
for (const i in site.data.footer) {
if (Array.isArray(site.data.footer[i])) {
html += site.data.footer[i].join('');
} else if (site.data.footer[i] !== null) {
html += site.data.footer[i];
}
}
}
return html;
}) %>

View File

@ -0,0 +1,49 @@
<%- fragment_cache('head_source_common', () => {
let html = '';
/* spectre.css */
if (theme.vendors.spectre.spectre_css) {
html += `<link rel="stylesheet" href="${theme.vendors.spectre.spectre_css}">`;
} else {
html += `<link rel="stylesheet" href="${url_for('lib/spectre/spectre.min.css')}">`;
}
html += partial('_partial/head/config_style');
/* style.css */
if (theme.vendors.suka.style_css) {
html += `<link rel="stylesheet" href="${theme.vendors.suka.style_css}">`;
} else {
html += `<link rel="stylesheet" href="${url_for('css/style.min.css')}">`;
}
return html;
}) %>
<% if (theme.comment.use === 'disqusjs') { %>
<% if ( (is_post()) ) { %>
<!-- Import DisqusJS Default Theme -->
<%- partial('_plugin/comment/disqusjs/common_head', {}, {cache: theme.fragment_cache}) %>
<% } %>
<% } %>
<% if (config.suka_theme.prism.enable) { %>
<!-- prism.css -->
<%- partial('_plugin/highlight/prism/common') %>
<% } %>
<% if (theme.prettify.enable) { %>
<!-- Prettify Theme -->
<%- partial('_plugin/highlight/prettify/theme') %>
<% } %>
<% if (config.highlight.enable) { %>
<!-- Prettify Theme -->
<%- partial('_plugin/highlight/hexo-hljs/theme') %>
<% } %>
<script>
/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
!function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.addEventListener?t.removeEventListener("load",a):t.attachEvent&&t.detachEvent("onload",a),t.setAttribute("onload",null),t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this);
</script>

View File

@ -0,0 +1,8 @@
<script>
var _hmt = _hmt || [];
(function() {var hm = document.createElement('script');
hm.src = 'https://hm.baidu.com/hm.js?<%= theme.analytics.baidu_site_id %>';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
})();
</script>

View File

@ -0,0 +1,3 @@
<div hidden>
<script src="//s95.cnzz.com/z_stat.php?id=<%= theme.analytics.cnzz_site_id %>&web_id=<%= theme.analytics.cnzz_site_id %>" language="JavaScript"></script>
</div>

View File

@ -0,0 +1,7 @@
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '<%= theme.analytics.google_site_id %>', 'auto');
ga('send', 'pageview');
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>

View File

@ -0,0 +1,8 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= theme.analytics.gtags_site_id %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<%= theme.analytics.gtags_site_id %>');
</script>

View File

@ -0,0 +1,12 @@
<script>
var _mtac = {};
(function() {
var mta = document.createElement("script");
mta.src = "https://pingjs.qq.com/h5/stats.js?v2.0.4";
mta.setAttribute("name", "MTAH5");
mta.setAttribute("sid", "theme.analytics.tencent_mta_id");
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(mta, s);
})();
</script>

View File

@ -0,0 +1,8 @@
<script>
(function() {
var hm = document.createElement("script");
hm.src = "//tajs.qq.com/stats?sId=<%= theme.analytics.tencent_site_id %>";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>

View File

@ -0,0 +1,22 @@
<% if(theme.busuanzi.site_uv.enable) { %>
<!-- Busuanzi User Views -->
<span id="busuanzi_container_site_uv" hidden>
<span><%- theme.busuanzi.site_uv.before %></span>
<span id="busuanzi_value_site_uv"></span>
<span><%- theme.busuanzi.site_uv.after %></span>
<% if(theme.busuanzi.site_uv.divider) { %>
<span><%- theme.busuanzi.site_uv.divider %></span>
<% } %>
</span>
<% } %>
<% if(theme.busuanzi.site_pv.enable) { %>
<!-- Busuanzi Post Views -->
<span id="busuanzi_container_site_pv" hidden>
<span><%- theme.busuanzi.site_pv.before %></span>
<span id="busuanzi_value_site_pv"></span>
<span><%- theme.busuanzi.site_pv.after %></span>
<% if(theme.busuanzi.site_pv.divider) { %>
<span><%- theme.busuanzi.site_pv.divider %></span>
<% } %>
</span>
<% } %>

View File

@ -0,0 +1,43 @@
<% if (theme.vendors.busuanzi) { %>
<script src="<%= theme.vendors.busuanzi %>" async></script>
<% } else { %>
<script src="https://cdn.jsdelivr.net/npm/busuanzi@2.3.0/bsz.pure.mini.js" async></script>
<% } %>
<!-- Offset -->
<% if (theme.busuanzi.site_uv.offset || theme.busuanzi.site_pv.offset || page.busuanzi_offset) { %>
<script>
var int = setInterval(fixCount, 50);
function fixCount() {
<% if (theme.busuanzi.site_uv.offset) { %>
var $$bsz_site_container_uv = document.getElementById('busuanzi_container_site_uv');
var $$bsz_site_value_uv = document.getElementById('busuanzi_value_site_uv');
var busuanziSiteUVOffset = parseInt('<%= theme.busuanzi.site_uv.offset %>');
if ($$bsz_site_container_uv.ownerDocument.defaultView.getComputedStyle($$bsz_site_container_uv, null).display === 'inline') {
clearInterval(int);
$$bsz_site_value_uv.innerHTML = parseInt($$bsz_site_value_uv.innerHTML) + busuanziSiteUVOffset;
}
<% } %>
<% if (theme.busuanzi.site_pv.offset) { %>
var $$bsz_site_container_pv = document.getElementById('busuanzi_container_site_pv');
var $$bsz_site_value_pv = document.getElementById('busuanzi_value_site_pv');
var busuanziSitePVOffset = parseInt('<%= theme.busuanzi.site_pv.offset %>');
if ($$bsz_site_container_pv.ownerDocument.defaultView.getComputedStyle($$bsz_site_container_pv, null).display === 'inline') {
clearInterval(int);
$$bsz_site_value_pv.innerHTML = parseInt($$bsz_site_value_pv.innerHTML) + busuanziSitePVOffset;
}
<% } %>
<% if (page.busuanzi_offset) { %>
var $$bsz_post_container_pv = document.getElementById('busuanzi_container_page_pv');
var $$bsz_post_value_pv = document.getElementById('busuanzi_value_page_pv');
var busuanziPostPVOffset = parseInt('<%= page.busuanzi_offset %>');
if ($$bsz_post_container_pv.ownerDocument.defaultView.getComputedStyle($$bsz_post_container_pv, null).display === 'inline') {
clearInterval(int);
$$bsz_post_value_pv.innerHTML = parseInt($$bsz_post_value_pv.innerHTML) + busuanziPostPVOffset;
}
<% } %>
}
</script>
<% } %>

View File

@ -0,0 +1,7 @@
<!-- Busuanzi Post Views -->
<span id="busuanzi_container_page_pv" hidden>
<span class="suka-devide-dot"></span>
<span><%- theme.busuanzi.post_pv.before %></span>
<span id="busuanzi_value_page_pv"></span>
<span><%- theme.busuanzi.post_pv.after %></span>
</span>

View File

@ -0,0 +1,5 @@
<% if (theme.vendors.busuanzi) { %>
<link rel="preload" href="<%= theme.vendors.busuanzi %>" as="script">
<% } else { %>
<link rel="preload" href="https://cdn.jsdelivr.net/npm/busuanzi@2.3.0/bsz.pure.mini.js" as="script">
<% } %>

View File

@ -0,0 +1,4 @@
<!-- 畅言公共 js 代码 start -->
<script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=<%=theme.comment.changyan.appid%>">
</script>
<!-- 畅言公共 js 代码 end -->

View File

@ -0,0 +1,10 @@
<!--PC和WAP自适应版-->
<div id="SOHUCS" sid="<% if(theme.comment.changyan.thread_key_type == "id"){ %><%= page.id %><% } else { %><%= page.path %><% } %>"></div>
<script>
(function(){
var appid = '<%= theme.comment.changyan.appid %>';
var conf = '<%= theme.comment.changyan.conf %>';
var width = window.innerWidth || document.documentElement.clientWidth;
if (width < 960) {
window.document.write('<script id="changyan_mobile_js" charset="utf-8" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); } })();
</script>

View File

@ -0,0 +1 @@
<script id="dsq-count-scr" src="https://<%= theme.comment.disqus.shortname %>.disqus.com/count.js" async></script>

View File

@ -0,0 +1,16 @@
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '<%= page.permalink %>'; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = '<%= page.permalink %>'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
</script>
<script id="disqus-thread-script">
(function() { // DON'T EDIT BELOW THIS LINE
var d = document;
var s = d.createElement('script');
s.src = '//<%= theme.comment.disqus.shortname %>.disqus.com/embed.js';
s.setAttribute('data-timestamp', + new Date());
(d.head || d.body).appendChild(s);
})();
</script>

View File

@ -0,0 +1,45 @@
<div id="disqus_thread"></div>
<div class="btn_click_load">
<button id="disqus_click_btn" class="btn"><%= __('post.comment.load_disqus_button') %></button>
</div>
<script>
var disqus_config = function () {
this.page.url = '<%= page.permalink %>'; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = '<%= page.permalink %>'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
</script>
<script id="disqus-lazy-load-script">
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://disqus.com/next/config.json', true);
xhr.timeout = 4000;
xhr.send();
xhr.onload = function() {
if(this.status == 200||this.status == 304){
var d = document;
var s = d.createElement('script');
s.src = '//<%= theme.comment.disqus.shortname %>.disqus.com/embed.js';
s.setAttribute('data-timestamp', + new Date());
(d.head || d.body).appendChild(s);
document.getElementById('disqus_click_btn').setAttribute("style", "display:none")
}
};
xhr.ontimeout = function(e) {
document.getElementById('disqus_click_btn').setAttribute("style", "display:block");
};
xhr.onerror = function(e) {
document.getElementById('disqus_click_btn').setAttribute("style", "display:block");
};
document.getElementById('disqus_click_btn').onclick=function() { //click to load comments
(function() { // DON'T EDIT BELOW THIS LINE
var d = document;
var s = d.createElement('script');
s.src = '//<%= theme.comment.disqus.shortname %>.disqus.com/embed.js';
s.setAttribute('data-timestamp', + new Date());
(d.head || d.body).appendChild(s);
})();
document.getElementById('disqus_click_btn').setAttribute("style", "display:none")
};
</script>

View File

@ -0,0 +1 @@
<!-- No need for DisqusJS -->

View File

@ -0,0 +1 @@
<%- css_async(url_for('https://cdn.jsdelivr.net/npm/disqusjs@1.2.5/dist/disqusjs.css')) %>

View File

@ -0,0 +1,30 @@
<div id="disqus_thread"></div>
<script id="js-disqusjs" src="https://cdn.jsdelivr.net/npm/disqusjs@1.2.5/dist/disqus.js" async></script>
<script>
document.getElementById('js-disqusjs').addEventListener('load', function () {
function loadDisqusJS() {
new DisqusJS({
shortname: '<%= theme.comment.disqusjs.shortname %>',
<% if (theme.comment.disqusjs.siteName) { %>
siteName: '<%= theme.comment.disqusjs.siteName %>',
<% } %>
identifier: '<%= page.permalink %>',
url: '<%= page.permalink %>',
api: '<%= theme.comment.disqusjs.api %>',
apikey: '<%= theme.comment.disqusjs.apikey %>',
<% if (theme.comment.disqusjs.admin) { %>
admin: '<%= theme.comment.disqusjs.admin %>',
<% } %>
<% if (theme.comment.disqusjs.adminLabel) { %>
adminLabel: '<%= theme.comment.disqusjs.adminLabel %>'
<% } %>
})
}
if (document.readyState === 'complete') {
loadDisqusJS();
} else {
window.addEventListener('load', loadDisqusJS);
}
});
</script>

View File

@ -0,0 +1 @@
<!-- Nothing. Include common head right after open bodu tag -->

View File

@ -0,0 +1,16 @@
<!-- This should be right after open body tag -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
<% if(config.language) { %>
var js_lang = "<%- config.language %>";
<% } else { %>
var js_lang = "en_US";
<% } %>
js.src = 'https://connect.facebook.net/' + js_lang + '/sdk.js#xfbml=1&version=v3.1';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

View File

@ -0,0 +1 @@
<span class="fb-comments-count" data-href=""></span>

View File

@ -0,0 +1,6 @@
<div class="fb-comments"
data-href="<%= url_for(page.path) %>"
data-numposts="<%= theme.comment.facebook.numposts %>"
data-colorscheme="<%= theme.comment.facebook.colorschme %>"
data-order-by="<%= theme.comment.facebook.orderby %>">
</div>

View File

@ -0,0 +1 @@
<!-- GitTalk -->

View File

@ -0,0 +1,20 @@
<!-- Gitalk Container -->
<div id="gitalk-container"></div>
<%- css_async('https://cdn.jsdelivr.net/npm/gitalk@1.3.3/dist/gitalk.min.css') %>
<script src="https://cdn.jsdelivr.net/npm/gitalk@1.3.3/dist/gitalk.min.js"></script>
<script>
var gitalk = new Gitalk({
clientID: '<%= theme.comment.gitalk.client_id %>',
clientSecret: '<%= theme.comment.gitalk.client_secret %>',
repo: '<%= theme.comment.gitalk.repo %>',
owner: '<%= theme.comment.gitalk.owner %>',
admin: ['<%= theme.comment.gitalk.owner %>'],
// facebook-like distraction free mode
distractionFreeMode: false,
id: window.location.pathname
})
gitalk.render('gitalk-container')
</script>

View File

@ -0,0 +1 @@
<!-- Gitment -->

View File

@ -0,0 +1,23 @@
<div id="gitment-comment">
<%- partial('_widget/comment/' + theme.comment.use + '/main') %>
</div>
<style>
#gitment-comment{
background-color: #eee;
padding: 2pc;
}
</style>
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
id: window.location.pathname,
owner: '<%= theme.comment.gitment.owner %>',
repo: '<%= theme.comment.gitment.repo %>',
oauth: {
client_id: '<%= theme.comment.gitment.client_id %>',
client_secret: '<%= theme.comment.gitment.client_secret %>',
},
})
gitment.render('container')
</script>

View File

@ -0,0 +1,12 @@
<div id="lv-container" data-id="city" data-uid="<%= theme.comment.livere.data_uid %>">
<script id="livere-comment-js">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
</div>

View File

@ -0,0 +1,32 @@
<div id="vcomments"></div>
<!--<script src="https://cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/valine@latest/dist/Valine.min.js"></script>
<script>
var GUEST_INFO = ['nick', 'mail', 'link'];
var guest_info = '<%= theme.comment.valine.guest_info %>'.split(',').filter(function (item) {
return GUEST_INFO.indexOf(item) > -1
});
var notify = '<%= theme.comment.valine_notify %>' === 'true';
var verify = '<%= theme.comment.valine_verify %>' === 'true';
var valinedo = () => {
new Valine({
el: '#vcomments',
notify: notify,
verify: verify,
appId: "<%= theme.comment.valine.leancloud_appId %>",
appKey: "<%= theme.comment.valine.leancloud_appKey %>",
placeholder: "<%= theme.comment.valine.placeholder %>",
meta: guest_info,
pageSize: '<%= theme.comment.valine.pageSize %>',
avatar: '<%= theme.comment.valine.avatar %>',
lang: '<%= theme.comment.valine.lang %>',
guest_info: guest_info,
visitor: <%= theme.valine_counter.enable %>
});
};
valinestatus = true;
window.addEventListener('load',()=>{
valinedo();
});
</script>

View File

@ -0,0 +1,2 @@
<!-- wildfire -->
<script src="https://cdn.jsdelivr.net/npm/wildfire@0.3.8/dist/wildfire.auto.js"></script>

View File

@ -0,0 +1,25 @@
<style>
.wildfire_thread a {
border-bottom: none;
}
</style>
<div class="wildfire_thread"></div>
<script>
var wildfireConfig = () => ({
databaseProvider: '<%= theme.comment.wildfire.database_provider %>',
databaseConfig: {
<% if (theme.comment.wildfire.database_provider == "wilddog") { %>
siteId: '<%= theme.comment.wildfire.wilddog_site_id %>'
<% } else if (theme.comment.wildfire.database_provider == "firebase") { %>
apiKey: '<%= theme.comment.wildfire.firebase_api_key %>',
authDomain: '<%= theme.comment.wildfire.firebase_auth_domain %>',
databaseURL: '<%= theme.comment.wildfire.firebase_database_url %>',
projectId: '<%= theme.comment.wildfire.firebase_project_id %>',
storageBucket: '<%= theme.comment.wildfire.firebase_storage_bucket %>',
messagingSenderId: '<%= theme.comment.wildfire.firebase_messaging_sender_id %>'
<% } %>
},
theme: '<%= theme.comment.wildfire.theme %>',
locale: '<%= theme.comment.wildfire.locale %>',
})
</script>

View File

@ -0,0 +1,13 @@
<!-- Import Hanabi -->
<% if (theme.vendors.hanabi) { %>
<script src="<%= theme.vendors.hanabi %>"></script>
<% } else { %>
<script src="<%- url_for('lib/hanabi/hanabi.min.js') %>"></script>
<% } %>
<!-- Import Hanabi Broswser -->
<% if (theme.vendors.suka.hanabi_browser_js) { %>
<script src="<%= theme.vendors.suka.hanabi_browser_js %>"></script>
<% } else { %>
<script src="<%- url_for('js/hanabi-browser.min.js') %>"></script>
<% } %>

View File

@ -0,0 +1,13 @@
<!-- Import Hanabi -->
<% if (theme.vendors.hanabi) { %>
<link rel="preload" href="<%= theme.vendors.hanabi %>" as="script">
<% } else { %>
<link rel="preload" href="<%- url_for('lib/hanabi/hanabi.min.js') %>" as="script">
<% } %>
<!-- Import Hanabi Broswser -->
<% if (theme.vendors.suka.hanabi_browser_js) { %>
<link rel="preload" href="<%= theme.vendors.suka.hanabi_browser_js %>" as="script">
<% } else { %>
<link rel="preload" href="<%- url_for('js/hanabi-browser.min.js') %>" as="script">
<% } %>

Some files were not shown because too many files have changed in this diff Show More