From 836a24683a19eefbc98d6c448c26e3696a679e7c Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Sat, 2 Jul 2022 18:00:26 +0530 Subject: [PATCH] feat(theme): custom prev/next labels and text (#897) --- docs/config/theme-configs.md | 26 ++++++++++++++++- docs/guide/theme-prev-next-link.md | 28 ++++++++++++++++++- .../theme-default/components/VPDocFooter.vue | 4 +-- .../theme-default/composables/prev-next.ts | 10 +++++-- types/default-theme.d.ts | 23 +++++++++++++++ 5 files changed, 84 insertions(+), 7 deletions(-) diff --git a/docs/config/theme-configs.md b/docs/config/theme-configs.md index 4ebfdc8723c1..eb40afdf9db1 100644 --- a/docs/config/theme-configs.md +++ b/docs/config/theme-configs.md @@ -247,9 +247,33 @@ export default { ```ts export interface CarbonAds { - code: string, + code: string placement: string } ``` 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 +} +``` diff --git a/docs/guide/theme-prev-next-link.md b/docs/guide/theme-prev-next-link.md index c248d1f3a318..e52f9057c731 100644 --- a/docs/guide/theme-prev-next-link.md +++ b/docs/guide/theme-prev-next-link.md @@ -1,3 +1,29 @@ # Prev Next Link -Documentation coming soon... +You can customize the text of previous and next links. This is helpful if you want to show different text on previous/next links than what you have on your sidebar. + +## prev + +- Type: `string` + +- Details: + + Specify the text to show on the link to the previous page. + + If you don't set this in frontmatter, the text will be inferred from the sidebar config. + +- Example: + +```yaml +--- +prev: 'Get Started | Markdown' +--- +``` + +## next + +- Type: `string` + +- Details: + + Same as `prev` but for the next page. diff --git a/src/client/theme-default/components/VPDocFooter.vue b/src/client/theme-default/components/VPDocFooter.vue index 29890e7514fb..48d01d68a450 100644 --- a/src/client/theme-default/components/VPDocFooter.vue +++ b/src/client/theme-default/components/VPDocFooter.vue @@ -36,13 +36,13 @@ const hasLastUpdated = computed(() => {