feat: allow changing prev/next placeholders

pull/897/head
Divyansh Singh 3 years ago
parent e9b2766b5b
commit d1a896c856

@ -247,9 +247,33 @@ export default {
```ts ```ts
export interface CarbonAds { export interface CarbonAds {
code: string, code: string
placement: string placement: string
} }
``` ```
Learn more in [Theme: Carbon Ads](../guide/theme-carbon-ads) Learn more in [Theme: Carbon Ads](../guide/theme-carbon-ads)
## docFooter
- Type: `DocFooter`
Can be used to customize text appearing above previous and next links. Helpful if not writing docs in English.
```js
export default {
themeConfig: {
docFooter: {
prev: 'Pagina prior',
next: 'Proxima pagina'
}
}
}
```
```ts
export interface DocFooter {
prev?: string
next?: string
}
```

@ -36,13 +36,13 @@ const hasLastUpdated = computed(() => {
<div v-if="control.prev || control.next" class="prev-next"> <div v-if="control.prev || control.next" class="prev-next">
<div class="pager"> <div class="pager">
<a v-if="control.prev" class="pager-link prev" :href="normalizeLink(control.prev.link)"> <a v-if="control.prev" class="pager-link prev" :href="normalizeLink(control.prev.link)">
<span class="desc">Previous page</span> <span class="desc">{{ theme.docFooter?.prev ?? 'Previous page' }}</span>
<span class="title">{{ control.prev.text }} </span> <span class="title">{{ control.prev.text }} </span>
</a> </a>
</div> </div>
<div class="pager" :class="{ 'has-prev': control.prev }"> <div class="pager" :class="{ 'has-prev': control.prev }">
<a v-if="control.next" class="pager-link next" :href="normalizeLink(control.next.link)"> <a v-if="control.next" class="pager-link next" :href="normalizeLink(control.next.link)">
<span class="desc">Next page</span> <span class="desc">{{ theme.docFooter?.next ?? 'Next page' }}</span>
<span class="title">{{ control.next.text }}</span> <span class="title">{{ control.next.text }}</span>
</a> </a>
</div> </div>

@ -43,6 +43,11 @@ export namespace DefaultTheme {
*/ */
lastUpdatedText?: string lastUpdatedText?: string
/**
* Set custom prev/next placeholders.
*/
docFooter?: DocFooter
/** /**
* The social links to be displayed at the end of the nav bar. Perfect for * The social links to be displayed at the end of the nav bar. Perfect for
* placing links to social services such as GitHub, Twitter, Facebook, etc. * placing links to social services such as GitHub, Twitter, Facebook, etc.
@ -157,6 +162,24 @@ export namespace DefaultTheme {
text?: string text?: string
} }
// prev-next -----------------------------------------------------------------
export interface DocFooter {
/**
* Custom text for previous page placeholder.
*
* @default 'Previous Page'
*/
prev?: string
/**
* Custom text for next page placeholder.
*
* @default 'Next Page'
*/
next?: string
}
// social link --------------------------------------------------------------- // social link ---------------------------------------------------------------
export interface SocialLink { export interface SocialLink {

Loading…
Cancel
Save