Skip to content

Commit d4e480a

Browse files
committed
fix: fixed shortLink type boolean | string
1 parent 4ad992c commit d4e480a

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"jest": "^24.9.0"
5555
},
5656
"dependencies": {
57-
"@micro-app/cli": "^0.3.11",
57+
"@micro-app/cli": "^0.3.15",
5858
"@vssue/api-github-v4": "^1.4.0",
5959
"@vssue/vuepress-plugin-vssue": "^1.4.3",
6060
"@vuepress/plugin-back-to-top": "^1.4.0",

theme/plugins/shortLinks/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ module.exports = (options = {}, ctx) => ({
44
extendPageData($page) {
55
const themeConfig = ctx.themeConfig || {};
66

7-
let prefix = '';
7+
let suffix = '.html';
88
if (typeof themeConfig.shortLinks === 'string') {
9-
prefix = themeConfig.shortLinks;
9+
suffix = themeConfig.shortLinks;
10+
}
11+
if (suffix && !suffix.startsWith('.')) {
12+
suffix = `.${suffix}`;
1013
}
1114

1215
const key = $page.key;
1316
if (key) {
1417
const frontmatter = $page.frontmatter = $page.frontmatter || {};
1518
const shortLink = frontmatter.shortLink;
1619
if (shortLink !== false) {
17-
$page.shortLink = frontmatter.shortLink = '/s' + (shortLink || `/${$page.key.replace(/^v\-/, prefix)}`);
20+
$page.shortLink = frontmatter.shortLink = '/s' + (shortLink || `/${$page.key.replace(/^v\-/, '')}${suffix}`);
1821
}
1922
}
2023
},

yarn.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,22 +1063,22 @@
10631063
"@types/istanbul-reports" "^1.1.1"
10641064
"@types/yargs" "^13.0.0"
10651065

1066-
"@micro-app/cli@^0.3.11":
1067-
version "0.3.11"
1068-
resolved "https://registry.yarnpkg.com/@micro-app/cli/-/cli-0.3.11.tgz#b570284d25950fd3bf3cec9922a19b75a547def7"
1069-
integrity sha512-BOUBSBaSjNWbg6jd3SvjJ5W6mXQr9m4sZjGf33eLoh6GpVcf7XF2XGnwKyLVQwcVKj7oJ75aL/+9vrxkc/utNA==
1066+
"@micro-app/cli@^0.3.15":
1067+
version "0.3.15"
1068+
resolved "https://registry.yarnpkg.com/@micro-app/cli/-/cli-0.3.15.tgz#3cbcb455675deda5bb8dbcae2f42e6c60d71d87b"
1069+
integrity sha512-RUvrH5e0KtWZAd2dlR3K5fWmovXLzM01wM9yEm347zwZceeBQgMlSv5GRBTCS5HNjVFsfpsfpVWEWk4E+B3NJA==
10701070
dependencies:
1071-
"@micro-app/core" "^0.3.20"
1071+
"@micro-app/core" "^0.3.23"
10721072
"@zkochan/cmd-shim" "^4.3.0"
10731073
read-cmd-shim "^2.0.0"
10741074
update-notifier "^4.1.0"
10751075

1076-
"@micro-app/core@^0.3.20":
1077-
version "0.3.21"
1078-
resolved "https://registry.yarnpkg.com/@micro-app/core/-/core-0.3.21.tgz#43315fa1713580d7500900f5ef90e183b9455b56"
1079-
integrity sha512-k7KOtQ6pxJbRAaMW8xF3jmuJxOQXjHXLCHtLNayU3ma1SNxOTGBbGbF7VyOBoo7V1sGlC40UjMaMJiqfvdE5lw==
1076+
"@micro-app/core@^0.3.23":
1077+
version "0.3.23"
1078+
resolved "https://registry.yarnpkg.com/@micro-app/core/-/core-0.3.23.tgz#7e8d425021875ee27d1a2e30170502ff022c70dc"
1079+
integrity sha512-BBLN2dOCCOJDsmCoCzx73C6M2eHB0K3JeEIFmbQSoY/E8EoTRfWNW+IAmFMm8WgSXOtMsb/4V678lBoLq7fLKA==
10801080
dependencies:
1081-
"@micro-app/shared-utils" "^0.1.16"
1081+
"@micro-app/shared-utils" "^0.1.17"
10821082
dotenv "^8.2.0"
10831083
dotenv-expand "^5.1.0"
10841084

@@ -1090,10 +1090,10 @@
10901090
"@release-it/conventional-changelog" "^1.1.0"
10911091
release-it "^13.1.1"
10921092

1093-
"@micro-app/shared-utils@^0.1.16":
1094-
version "0.1.16"
1095-
resolved "https://registry.yarnpkg.com/@micro-app/shared-utils/-/shared-utils-0.1.16.tgz#4952238c8caf17156548e33a43990ef42368e363"
1096-
integrity sha512-n4/E5gRFAijnMa33slUBF+REKVoPZ3SczY3xim3cRT0xI0vqG1uhyLZjEAwUq9mStGORgcllYN4ygUuJx0ki0Q==
1093+
"@micro-app/shared-utils@^0.1.17":
1094+
version "0.1.17"
1095+
resolved "https://registry.yarnpkg.com/@micro-app/shared-utils/-/shared-utils-0.1.17.tgz#e99b9aa4385cf4eefe5f96f0f553162ab9342743"
1096+
integrity sha512-XI1uFnvjPaFZvLLMoARZeUqUya2i2z4aJ1oT23bahQL+5dHgXj2p1o/1agJ7G0K1KStasLRjPXNuHEpBpK1Weg==
10971097
dependencies:
10981098
ajv "^6.10.2"
10991099
ajv-keywords "^3.4.1"

0 commit comments

Comments
 (0)