From 1bcfd21dffa42aabc68d145c67da839103f58bf0 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 14 Jun 2019 10:59:31 +0200 Subject: [PATCH] fix: publicUrl behaviour #261 (#263) * fix: #261 * fix: absolute paths/urls only * docs: elaborate publicUrl * use __PUBLIC_URL__ * tweaks --- packages/saber/vue-renderer/app/router.js | 1 + website/pages/docs/saber-config.md | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/saber/vue-renderer/app/router.js b/packages/saber/vue-renderer/app/router.js index 6d626b1fd..8572a3316 100644 --- a/packages/saber/vue-renderer/app/router.js +++ b/packages/saber/vue-renderer/app/router.js @@ -35,6 +35,7 @@ export default () => { new Router({ mode: 'history', routes, + base: __PUBLIC_URL__, scrollBehavior(to, from, savedPosition) { // if the returned position is falsy or an empty object, // will retain current scroll position. diff --git a/website/pages/docs/saber-config.md b/website/pages/docs/saber-config.md index 2e25bedb3..e89615e46 100644 --- a/website/pages/docs/saber-config.md +++ b/website/pages/docs/saber-config.md @@ -60,7 +60,7 @@ The directory to output HTML files and other static assets. - Type: `string` - Default: `/` -The base URL your application will be deployed at. If your website is located at a sub directory, e.g. `https://example.com/blog`, you should set this option to `/blog/` (trailing slash is optional). +The base URL your application will be deployed at. If your website is located at a sub directory, e.g. `https://example.com/blog`, you should set this option to either an absolute path (like `/blog`, leading slash is required) or an absolute URL (like `https://example.com/blog`). ### extractCSS @@ -138,13 +138,13 @@ You can use the [limax](https://github.com/lovell/limax) which provides CJK supp Options for the internal markdown-it plugin for generating markdown headings and heading anchors. -|Property|Type|Default|Description| -|---|---|---|---| -|`injectMarkdownHeadings`|`boolean`|`true`|Inject markdown headings as `page.markdownHeadings`| -|`permalink`|`boolean`|`false`|Generating permalinks.| -|`permalinkComponent`|`string`|`saber-link`|| -|`permalinkBefore`|`bolean`|`true`|Inject permalink before heading text.| -|`permalinkSymbol`|`string`|`#`|The permalink symbol.| +| Property | Type | Default | Description | +| ------------------------ | --------- | ------------ | --------------------------------------------------- | +| `injectMarkdownHeadings` | `boolean` | `true` | Inject markdown headings as `page.markdownHeadings` | +| `permalink` | `boolean` | `false` | Generating permalinks. | +| `permalinkComponent` | `string` | `saber-link` | | +| `permalinkBefore` | `bolean` | `true` | Inject permalink before heading text. | +| `permalinkSymbol` | `string` | `#` | The permalink symbol. | ### options