feat(theme): add option for enable prevPage/nextPage, close #132

This commit is contained in:
pengzhanbo 2024-08-06 01:05:14 +08:00
parent bf4b8dcb06
commit 8fa9ec0b4a
3 changed files with 23 additions and 1 deletions

View File

@ -11,13 +11,16 @@ import { useBlogPageData } from './page.js'
export function usePrevNext() {
const route = useRoute()
const { frontmatter } = useData()
const { frontmatter, theme } = useData()
const { sidebar } = useSidebar()
const postList = usePostList() as unknown as Ref<PlumeThemeBlogPostItem[]>
const locale = usePageLang()
const { isBlogPost } = useBlogPageData()
const prevNavList = computed(() => {
if (theme.value.prevPage === false)
return null
const prevConfig = resolveFromFrontmatterConfig(frontmatter.value.prev)
if (prevConfig !== false)
return prevConfig
@ -35,6 +38,9 @@ export function usePrevNext() {
})
const nextNavList = computed(() => {
if (theme.value.nextPage === false)
return null
const nextConfig = resolveFromFrontmatterConfig(frontmatter.value.next)
if (nextConfig !== false)
return nextConfig

View File

@ -26,6 +26,8 @@ const FALLBACK_OPTIONS: PlumeThemeLocaleData = {
// page meta
editLink: true,
contributors: true,
prevPage: true,
nextPage: true,
footer: {
message:

View File

@ -211,6 +211,13 @@ export interface PlumeThemeLocaleData extends LocaleData {
*/
outlineLabel?: string
/**
*
*
* @default true
*/
prevPage?: boolean
/**
*
*
@ -218,6 +225,13 @@ export interface PlumeThemeLocaleData extends LocaleData {
*/
prevPageLabel?: string
/**
*
*
* @default true
*/
nextPage?: boolean
/**
*
*