Skip to content

Commit

Permalink
fix(<ContentDoc>): render blink in SSG
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Oct 14, 2022
1 parent 4a2937c commit 05762af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,14 +570,14 @@ export default defineNuxtModule<ModuleOptions>({
// Disable cache in dev mode
integrity: nuxt.options.dev ? undefined : Date.now()
},
navigation: contentContext.navigation,
navigation: contentContext.navigation as any,
base: options.base,
// Tags will use in markdown renderer for component replacement
tags: contentContext.markdown.tags as any,
highlight: options.highlight as any,
wsUrl: '',
// Document-driven configuration
documentDriven: options.documentDriven as ModuleOptions['documentDriven'],
documentDriven: options.documentDriven as any,
// Anchor link generation config
anchorLinks: options.markdown.anchorLinks
})
Expand Down
9 changes: 7 additions & 2 deletions src/runtime/components/ContentDoc.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { PropType, defineComponent, h, useSlots } from 'vue'
import { withTrailingSlash } from 'ufo'
import type { QueryBuilderParams } from '../types'
import ContentRenderer from './ContentRenderer'
import ContentQuery from './ContentQuery'
Expand Down Expand Up @@ -42,7 +43,7 @@ export default defineComponent({
path: {
type: String,
required: false,
default: () => useRoute().path
default: undefined
},
/**
Expand Down Expand Up @@ -78,7 +79,11 @@ export default defineComponent({
const { tag, excerpt, path, query, head } = ctx
// Merge local `path` props and apply `findOne` query default.
const contentQueryProps = Object.assign(query || {}, { path, find: 'one' })
const contentQueryProps = {
...query || {},
path: path || query?.path || withTrailingSlash(useRoute().path),
find: 'one'
}
const emptyNode = (slot: string, data: any) => h('pre', null, JSON.stringify({ message: 'You should use slots with <ContentDoc>', slot, data }, null, 2))
Expand Down

0 comments on commit 05762af

Please sign in to comment.