From 491c87244d2f3671149a0f5e887e46321f20b74c Mon Sep 17 00:00:00 2001
From: Shigma <1700011071@pku.edu.cn>
Date: Wed, 20 Mar 2019 15:48:29 +0800
Subject: [PATCH] remove plugin clean urls
---
.../@vuepress/plugin-clean-urls/.npmignore | 3 -
.../@vuepress/plugin-clean-urls/README.md | 5 --
packages/@vuepress/plugin-clean-urls/index.js | 22 -------
.../@vuepress/plugin-clean-urls/package.json | 26 --------
packages/docs/docs/guide/markdown.md | 2 +-
.../docs/plugin/official/plugin-clean-urls.md | 60 -------------------
packages/docs/docs/zh/guide/markdown.md | 2 +-
.../zh/plugin/official/plugin-clean-urls.md | 60 -------------------
8 files changed, 2 insertions(+), 178 deletions(-)
delete mode 100644 packages/@vuepress/plugin-clean-urls/.npmignore
delete mode 100644 packages/@vuepress/plugin-clean-urls/README.md
delete mode 100644 packages/@vuepress/plugin-clean-urls/index.js
delete mode 100644 packages/@vuepress/plugin-clean-urls/package.json
delete mode 100644 packages/docs/docs/plugin/official/plugin-clean-urls.md
delete mode 100644 packages/docs/docs/zh/plugin/official/plugin-clean-urls.md
diff --git a/packages/@vuepress/plugin-clean-urls/.npmignore b/packages/@vuepress/plugin-clean-urls/.npmignore
deleted file mode 100644
index 13c38ea313..0000000000
--- a/packages/@vuepress/plugin-clean-urls/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-__tests__
-__mocks__
-.temp
diff --git a/packages/@vuepress/plugin-clean-urls/README.md b/packages/@vuepress/plugin-clean-urls/README.md
deleted file mode 100644
index f9bfc3dfbb..0000000000
--- a/packages/@vuepress/plugin-clean-urls/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# @vuepress/plugin-clean-urls
-
-> clean urls plugin for vuepress
-
-See [documentation](https://vuepress.vuejs.org/plugin/official/plugin-clean-urls.html).
diff --git a/packages/@vuepress/plugin-clean-urls/index.js b/packages/@vuepress/plugin-clean-urls/index.js
deleted file mode 100644
index d09d0754e5..0000000000
--- a/packages/@vuepress/plugin-clean-urls/index.js
+++ /dev/null
@@ -1,22 +0,0 @@
-module.exports = (options = {}, context) => {
- const {
- normalSuffix = '',
- indexSuffix = '/'
- } = options
-
- return {
- extendPageData (page) {
- const { regularPath, frontmatter = {}} = page
- if (frontmatter.permalink) return
- if (regularPath.endsWith('.html')) {
- // normal path
- // e.g. foo/bar.md -> foo/bar.html
- page.path = regularPath.slice(0, -5) + normalSuffix
- } else if (regularPath.endsWith('/')) {
- // index path
- // e.g. foo/index.md -> foo/
- page.path = regularPath.slice(0, -1) + indexSuffix
- }
- }
- }
-}
diff --git a/packages/@vuepress/plugin-clean-urls/package.json b/packages/@vuepress/plugin-clean-urls/package.json
deleted file mode 100644
index 1291e5f8a7..0000000000
--- a/packages/@vuepress/plugin-clean-urls/package.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "name": "@vuepress/plugin-clean-urls",
- "version": "1.0.0-alpha.44",
- "description": "clean urls plugin for vuepress",
- "main": "index.js",
- "publishConfig": {
- "access": "public"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/vuejs/vuepress.git",
- "directory": "packages/@vuepress/plugin-clean-urls"
- },
- "keywords": [
- "documentation",
- "vue",
- "vuepress",
- "generator"
- ],
- "author": "Shigma <1700011071@pku.edu.cn>",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/vuejs/vuepress/issues"
- },
- "homepage": "https://github.com/vuejs/vuepress/packages/@vuepress/plugin-clean-urls#readme"
-}
diff --git a/packages/docs/docs/guide/markdown.md b/packages/docs/docs/guide/markdown.md
index f6ab0cb99f..e2567b112c 100644
--- a/packages/docs/docs/guide/markdown.md
+++ b/packages/docs/docs/guide/markdown.md
@@ -37,7 +37,7 @@ And providing you are in `foo/one.md`:
### Redirection for URLs
-VuePress supports redirecting to clean links. If a link `/foo` is not found, VuePress will look for a existing `/foo/` or `/foo.html`. Conversely, when one of `/foo/` or `/foo.html` is not found, VuePress will also try the other. With this feature, we can customize your website's urls with the official plugin [@vuepress/plugin-clean-urls](../plugin/official/plugin-clean-urls.md).
+VuePress supports redirecting to clean links. If a link `/foo` is not found, VuePress will look for a existing `/foo/` or `/foo.html`. Conversely, when one of `/foo/` or `/foo.html` is not found, VuePress will also try the other. With this feature, we can customize your website's urls with the official plugin [vuepress-plugin-clean-urls](https://vuepress.github.io/plugins/clean-urls/).
::: tip
Regardless of whether the permalink and clean-urls plugins are used, your relative path should be defined by the current file structure. In the above example, even though you set the path of `/foo/one.md` to `/foo/one/`, you should still access `/foo/two.md` via `./two.md`.
diff --git a/packages/docs/docs/plugin/official/plugin-clean-urls.md b/packages/docs/docs/plugin/official/plugin-clean-urls.md
deleted file mode 100644
index 45bca6da45..0000000000
--- a/packages/docs/docs/plugin/official/plugin-clean-urls.md
+++ /dev/null
@@ -1,60 +0,0 @@
----
-title: clean-urls
-metaTitle: A plugin of automatically generating clean urls | VuePress
----
-
-# [@vuepress/plugin-clean-urls](https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/plugin-clean-urls)
-
-> A plugin for automatically generating clean urls.
-
-## Install
-
-```bash
-yarn add -D @vuepress/plugin-clean-urls@next
-# OR npm install -D @vuepress/plugin-clean-urls@next
-```
-
-## Usage
-
-```javascript
-module.exports = {
- plugins: ['@vuepress/clean-urls']
-}
-```
-
-::: warning
-This plugin will always work on your dev server, but VuePress **does not have the right** to modify server identification. If you want your URLs to follow a certain pattern (e.g. `/routing` instead of `/routing.html` or `routing/`), you should make sure that your server would treat it as an HTML. This means that you may need to configure your server specifically.
-
-References:
-
-- For Netify users: [https://www.netlify.com/docs/redirects/#trailing-slash](https://www.netlify.com/docs/redirects/#trailing-slash).
-- For Surge users: [https://surge.sh/help/using-clean-urls-automatically](https://surge.sh/help/using-clean-urls-automatically).
-:::
-
-## Options
-
-### normalSuffix
-
-- Type: `string`
-- Default: `''`
-
-The suffix for normal pages. For example, `foo/bar.md` will become:
-
-- `foo/bar.html` by default (without this plugin)
-- `foo/bar/` (with `normalSuffix` set to `'/'`)
-- `foo/bar` (with `normalSuffix` set to `''`)
-
-### indexSuffix
-
-- Type: `string`
-- Default: `'/'`
-
-The suffix for index pages. For example, `foo/index.md` will become:
-
-- `foo/` by default (without this plugin)
-- `foo` (with `indexSuffix` set to `''`)
-- `foo/index.html` (with `indexSuffix` set to `'/index.html'`)
-
-::: tip
-An index page is a page with a file name of index.md or readme.md (case insensitive).
-:::
diff --git a/packages/docs/docs/zh/guide/markdown.md b/packages/docs/docs/zh/guide/markdown.md
index 68307ace16..d3810f7722 100644
--- a/packages/docs/docs/zh/guide/markdown.md
+++ b/packages/docs/docs/zh/guide/markdown.md
@@ -37,7 +37,7 @@
### 链接的重定向
-VuePress 支持重定向到干净链接。如果一个链接 `/foo` 找不到,VuePress 会自行寻找一个可用的 `/foo/` 或 `/foo.html`。反过来,当 `/foo/` 或 `/foo.html` 中的一个找不到时,VuePress 也会尝试寻找另一个。借助这种特性,我们可以通过官方插件 [@vuepress/plugin-clean-urls](../plugin/official/plugin-clean-urls.md) 定制你的网站路径。
+VuePress 支持重定向到干净链接。如果一个链接 `/foo` 找不到,VuePress 会自行寻找一个可用的 `/foo/` 或 `/foo.html`。反过来,当 `/foo/` 或 `/foo.html` 中的一个找不到时,VuePress 也会尝试寻找另一个。借助这种特性,我们可以通过官方插件 [vuepress-plugin-clean-urls](https://vuepress.github.io/plugins/clean-urls/) 定制你的网站路径。
::: tip 注意
无论是否使用了 permalink 和 clean-urls 插件,你的相对路径都应该依赖于当前的文件结构来定义。在上面的例子中,即使你将 `/foo/one.md` 的路径设为了 `/foo/one/`,你依然应该通过 `./two.md` 来访问 `/foo/two.md`。
diff --git a/packages/docs/docs/zh/plugin/official/plugin-clean-urls.md b/packages/docs/docs/zh/plugin/official/plugin-clean-urls.md
deleted file mode 100644
index e416dd84a3..0000000000
--- a/packages/docs/docs/zh/plugin/official/plugin-clean-urls.md
+++ /dev/null
@@ -1,60 +0,0 @@
----
-title: clean-urls
-metaTitle: 自动生成简洁链接的插件 | VuePress
----
-
-# [@vuepress/plugin-clean-urls](https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/plugin-clean-urls)
-
-> 用于自动生成简洁链接的插件。
-
-## 安装
-
-```bash
-yarn add -D @vuepress/plugin-clean-urls@next
-# OR npm install -D @vuepress/plugin-clean-urls@next
-```
-
-## 使用
-
-```javascript
-module.exports = {
- plugins: ['@vuepress/clean-urls']
-}
-```
-
-::: warning 注意
-这个插件在 dev 服务器上总是生效的,但 VuePress **并没有能力**去修改服务器识别链接的方式。如果你希望你的网站地址符合某种特殊的模式(比如使用 `/routing` 而不是 `/routing.html` 或者 `routing/`),你需要确保你的服务器会将这些地址认为是 HTML。这可能意味着你需要对你的服务器进行特殊的配置。
-
-参考资料:
-
-- Netify 用户: [https://www.netlify.com/docs/redirects/#trailing-slash](https://www.netlify.com/docs/redirects/#trailing-slash).
-- Surge 用户: [https://surge.sh/help/using-clean-urls-automatically](https://surge.sh/help/using-clean-urls-automatically).
-:::
-
-## 选项
-
-### normalSuffix
-
-- 类型: `string`
-- 默认值: `''`
-
-普通页面的链接后缀。举个例子,`foo/bar.md` 会自动变成:
-
-- `foo/bar.html` 在默认情况下(未安装本插件时)
-- `foo/bar/`(当 `normalSuffix` 被设为 `'/'` 时)
-- `foo/bar`(当 `normalSuffix` 被设为 `''` 时)
-
-### indexSuffix
-
-- 类型: `string`
-- 默认值: `'/'`
-
-索引页面的链接后缀。举个例子,`foo/index.md` 会自动变成:
-
-- `foo/` 在默认情况下(未安装本插件时)
-- `foo`(当 `indexSuffix` 被设为 `''` 时)
-- `foo/index.html`(当 `indexSuffix` 被设为 `'/index.html'` 时)
-
-::: tip
-索引页面是指文件名为 index.md 或者 readme.md 的页面(不区分大小写)。
-:::