Skip to content

Commit

Permalink
feat($theme-default): external links in prev/next (close #1962)(#1984)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sun Haoran authored and meteorlxy committed Dec 3, 2019
1 parent ceccca3 commit 9f28814
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/@vuepress/theme-default/components/PageNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
<p class="inner">
<span v-if="prev" class="prev">
<router-link v-if="prev" class="prev" :to="prev.path">{{ prev.title || prev.path }}</router-link>
<a v-if="prev.type === 'external'" class="prev" :href="prev.path" target="_blank" rel='noopener noreferrer'>{{ prev.title || prev.path }}<OutboundLink /></a>
<router-link v-else class="prev" :to="prev.path">{{ prev.title || prev.path }}</router-link>
</span>

<span v-if="next" class="next">
<router-link v-if="next" :to="next.path">{{ next.title || next.path }}</router-link>
<a v-if="next.type === 'external'" :href="next.path" target="_blank" rel='noopener noreferrer'>{{ next.title || next.path }}<OutboundLink /></a>
<router-link v-else :to="next.path">{{ next.title || next.path }}</router-link>
</span>
</p>
Expand Down Expand Up @@ -98,6 +100,7 @@ function flatten (items, res) {
}
}
</script>

<style lang="stylus">
@require '../styles/wrapper.styl'
Expand Down
14 changes: 14 additions & 0 deletions packages/docs/docs/guide/frontmatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,17 @@ See: [Default Theme Config > Disable the Navbar](../theme/default-theme-config.m
- Default: `undefined`

See: [Default Theme Config > Sidebar](../theme/default-theme-config.md#sidebar).

### prev

- Type: `boolean|string`
- Default: `undefined`

See: [Default Theme Config > Prev / Next Links](../theme/default-theme-config.md#prev-next-links).

### next

- Type: `boolean|string`
- Default: `undefined`

See: [Default Theme Config > Prev / Next Links](../theme/default-theme-config.md#prev-next-links).
14 changes: 14 additions & 0 deletions packages/docs/docs/zh/guide/frontmatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,17 @@ meta:
- 默认值: `undefined`

参考: [默认值 Theme Config > Sidebar](../theme/default-theme-config.md#侧边栏).

### prev

- 类型: `boolean|string`
- 默认值: `undefined`

参考: [默认值 Theme Config > Prev / Next Links](../theme/default-theme-config.md#上-下一篇链接).

### next

- 类型: `boolean|string`
- 默认值: `undefined`

参考: [默认值 Theme Config > Prev / Next Links](../theme/default-theme-config.md#上-下一篇链接).

0 comments on commit 9f28814

Please sign in to comment.