From 383b976ddd38da269fe5a9e4883ba5dcf6e7eae7 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Sat, 24 Dec 2016 11:33:48 +0800 Subject: [PATCH 1/7] Update docs --- docs/README.md | 8 ++++++++ docs/zh-cn.md | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/docs/README.md b/docs/README.md index 8e293e50f..8dda6acdd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -89,6 +89,14 @@ Code in `404.html` ``` +### Hash router +`404.html` is not SEO friendly, you can replace it use `index.html` and `data-router` [issue#7](https://github.com/QingWei-Li/docsify/issues/7) + +index.html + +```html + +``` ### CDN - UNPKG [https://unpkg.com/docsify/](https://unpkg.com/docsify/) diff --git a/docs/zh-cn.md b/docs/zh-cn.md index 745440a61..7897cb14a 100644 --- a/docs/zh-cn.md +++ b/docs/zh-cn.md @@ -94,6 +94,15 @@ docsify serve docs ``` +### Hash router +`404.html` 对 SEO 不友好, 你可以用 `index.html` 代替并开启 `hash router` 功能。 [issue#7](https://github.com/QingWei-Li/docsify/issues/7) + +index.html + +```html + +``` + ### CDN - UNPKG [https://unpkg.com/docsify/](https://unpkg.com/docsify/) From 67f9083ff731c03c6e027195cc4b2cba09d338e4 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Sat, 24 Dec 2016 19:50:04 +0800 Subject: [PATCH 2/7] Remove 404.html --- README.md | 6 ------ docs/README.md | 23 +++++++---------------- docs/zh-cn.md | 26 +++++++++----------------- 3 files changed, 16 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 6b15d722c..70c0e1e08 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,6 @@ index.html ``` -Or create a `404.html` and `README.md` into `/docs`. Just remove `data-router` - -```html - -``` - ## CDN - UNPKG [https://unpkg.com/docsify/](https://unpkg.com/docsify/) - jsDelivr [http://www.jsdelivr.com/projects/docsify](http://www.jsdelivr.com/projects/docsify) diff --git a/docs/README.md b/docs/README.md index 8dda6acdd..2513e46fb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,7 +8,7 @@ mkdir docs && cd docs ``` ### Create entry file -Create a `404.html` file +Create a `index.html` file ```html @@ -20,7 +20,7 @@ Create a `404.html` file
- + ``` @@ -77,27 +77,18 @@ Minified files ## More ### Multiple pages -If you need other pages, directly create the markdown file, such as `guide.md` is `/guide`. +If you need other pages, directly create the markdown file, such as `guide.md` is `/#/guide`. ### Navbar -Code in `404.html` +Code in `index.html` ```html ``` -### Hash router -`404.html` is not SEO friendly, you can replace it use `index.html` and `data-router` [issue#7](https://github.com/QingWei-Li/docsify/issues/7) - -index.html - -```html - -``` - ### CDN - UNPKG [https://unpkg.com/docsify/](https://unpkg.com/docsify/) - jsDelivr [http://www.jsdelivr.com/projects/docsify](http://www.jsdelivr.com/projects/docsify) @@ -242,7 +233,7 @@ If you write a sub level list, it will generate a dropdown list. #### router -Hash router. You can replace `404.html` with `index.html`. +Hash router. ```html diff --git a/docs/zh-cn.md b/docs/zh-cn.md index 7897cb14a..bf9295dc4 100644 --- a/docs/zh-cn.md +++ b/docs/zh-cn.md @@ -14,7 +14,7 @@ mkdir docs && cd docs ``` ### 创建入口文件 -创建一个 `404.html` 文件,内容为 +创建一个 `index.html` 文件,内容为 ```html @@ -25,7 +25,7 @@ mkdir docs && cd docs
- + ``` @@ -66,7 +66,7 @@ docsify serve docs 更多选项参考 [docsify-cli](https://github.com/QingWei-Li/docsify-cli) ## 主题 -目前提供 vue.css 和 buble.css,直接修改 `404.html` 里的 cdn 地址即可 +目前提供 vue.css 和 buble.css,直接修改 `index.html` 里的 cdn 地址即可 ```html @@ -82,26 +82,18 @@ docsify serve docs ## 更多功能 ### 多页面 -`README.md` 作为主页面,如果需要其他页面,直接在文档目录下创建对应的 `*.md` 文件,例如创建一个 `guide.md` 那么对应的路由就是 `/guide`。 +`README.md` 作为主页面,如果需要其他页面,直接在文档目录下创建对应的 `*.md` 文件,例如创建一个 `guide.md` 那么对应的路由就是 `/#/guide`。 ### 导航 -导航需要自己写在 `404.html` 文件里,效果参考本文档 +导航需要自己写在 `index.html` 文件里,效果参考本文档 ```html ``` -### Hash router -`404.html` 对 SEO 不友好, 你可以用 `index.html` 代替并开启 `hash router` 功能。 [issue#7](https://github.com/QingWei-Li/docsify/issues/7) - -index.html - -```html - -``` ### CDN @@ -133,7 +125,7 @@ index.html ### 配置参数 #### repo -参考本文档的右上角的 GitHub 图标,如果要开启的话,将 `404.html` 里的 script 改成 +参考本文档的右上角的 GitHub 图标,如果要开启的话,将 `index.html` 里的 script 改成 ```html @@ -246,7 +238,7 @@ Sidebar 开关按钮 #### router -开启 hash router 功能,此时可以创建 `index.html` 作为入口文件,同时多页面切换不会重新加载资源。资源路径会被替换成 `/#/` 的形式。 +开启 hash router 功能,同时多页面切换不会重新加载资源。资源路径会被替换成 `/#/` 的形式。 ```html From 6e81e66441f989d8b86c5c1d43776ec498ad8811 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Sat, 24 Dec 2016 19:50:41 +0800 Subject: [PATCH 3/7] 404.dev => dev --- app.js | 4 ++-- 404.dev.html => dev.html | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename 404.dev.html => dev.html (100%) diff --git a/app.js b/app.js index e960cf44d..ecce40197 100644 --- a/app.js +++ b/app.js @@ -4,8 +4,8 @@ var fs = require('fs') http.createServer(function (req, res) { serveStatic('.')(req, res, function () { - res.writeHead(404, { 'Content-Type': 'text/html' }) - res.end(fs.readFileSync('404.dev.html')) + res.writeHead(200, { 'Content-Type': 'text/html' }) + res.end(fs.readFileSync('dev.html')) }) }).listen(3000, '0.0.0.0') diff --git a/404.dev.html b/dev.html similarity index 100% rename from 404.dev.html rename to dev.html From bd354094c09353ab0139800b2f7152ffe5e059d0 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Sat, 24 Dec 2016 20:32:04 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=8E=84=20=20Merry=20Christmas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/_media/snow.js | 56 +++++++++++++++++++++++++++++++++++++++++++++ docs/index.html | 1 + 2 files changed, 57 insertions(+) create mode 100644 docs/_media/snow.js diff --git a/docs/_media/snow.js b/docs/_media/snow.js new file mode 100644 index 000000000..b0c20e505 --- /dev/null +++ b/docs/_media/snow.js @@ -0,0 +1,56 @@ +// Fork https://github.com/HermannBjorgvin/SnowJs/blob/master/snow.js +(function(){ + var canvas = document.createElement("canvas"); + var ctx = canvas.getContext("2d"); + var flakeArray = []; + + canvas.style.pointerEvents = "none"; + canvas.style.position = "absolute"; + canvas.style.top = 0; + canvas.style.left = 0; + canvas.style.width = "100vw"; + canvas.style.height = "100vh"; + document.body.appendChild(canvas); + + function canvasResize(){ + canvas.height = canvas.offsetHeight; + canvas.width = canvas.offsetWidth; + } + canvasResize(); + + window.onresize = function() { + canvasResize(); + }; + + var MyMath = Math; + + setInterval(function() { + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.beginPath(); + + var random = MyMath.random(); + var distance = .05 + .95 * random; + + flake = {}; + flake.x = 1.5 * canvas.width * MyMath.random() - .5 * canvas.width; + flake.y = -9; + flake.velX = 2 * distance * (MyMath.random() / 2 + .5); + flake.velY = (4 + 2 * MyMath.random()) * distance; + flake.radius = MyMath.pow(5 * random, 2) / 5; + flake.update = function() { + var t = this; + t.x += t.velX; + t.y += t.velY; + ctx.beginPath(); + ctx.arc(t.x, t.y, t.radius, 0, 2 * MyMath.PI, !1); + ctx.fillStyle = "#FFF"; + ctx.fill() + }; + + flakeArray.push(flake); + + for (b = 0; b < flakeArray.length; b++) { + flakeArray[b].y > canvas.height ? flakeArray.splice(b, 1) : flakeArray[b].update() + } + }, 16); +})(); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 615ba0c70..1bb458e72 100644 --- a/docs/index.html +++ b/docs/index.html @@ -15,6 +15,7 @@
+