diff --git a/scripts/helper/uk-paginator.js b/scripts/helper/uk-paginator.js
new file mode 100644
index 0000000..af09fa1
--- /dev/null
+++ b/scripts/helper/uk-paginator.js
@@ -0,0 +1,61 @@
+hexo.extend.helper.register("uk_paginator", function(option) {
+ const options = Object.assign({
+ base: "/",
+ pagePath: "page/%d/",
+ total: 1,
+ current: 1,
+ space: "...",
+ sideSize: 5,
+ midSize: 10,
+ mainClasses: [],
+ itemClasses: [],
+ }, option);
+ console.dir(options);
+
+ let pageStructure = [];
+ pageStructure.push(`
`);
+
+ if (options.total > 0 && options.current > 1) {
+ pageStructure.push(` `);
+ } else {
+ pageStructure.push(` `)
+ }
+
+ let pageGroups = [];
+ // 生成起始页范围
+ for (let p = 1; p <= Math.min(options.sideSize, options.total); p++) {
+ pageGroups.push(p);
+ }
+ // 生成中间页范围
+ if (options.current > options.sideSize && options.current < (options.total - options.sideSize + 1)) {
+ for (let p = Math.max(pageGroups[pageGroups.length - 1] + 1, options.current - options.midSize / 2); p <= Math.min(options.total, options.current + options.midSize / 2); p++) {
+ pageGroups.push(p);
+ }
+ }
+ // 生成结束页范围
+ for (let p = Math.max(pageGroups[pageGroups.length - 1] + 1, options.total - options.sideSize + 1); p <= options.total; p++) {
+ pageGroups.push(p);
+ }
+ console.dir(pageGroups);
+
+ pageGroups.forEach(function(page, index) {
+ if (index > 0 && page - pageGroups[index - 1] > 1) {
+ pageStructure.push(`- ${options.space}
`);
+ }
+ if (page === options.current) {
+ pageStructure.push(`- ${page}
`)
+ } else {
+ pageStructure.push(`- ${page}
`)
+ }
+ });
+
+ if (options.total > 0 && options.current + 1 <= options.total) {
+ pageStructure.push(` `)
+ } else {
+ pageStructure.push(` `)
+ }
+
+ pageStructure.push(`
`);
+
+ return pageStructure.join("\n");
+});
\ No newline at end of file