Advanced

Hooks

Modify your content using Nuxt build time hooks

content:file:beforeParse

This hook is called before the content is parsed.

It can be used to modify the raw content from a file before it is transformed or modify the transform options.

import type { FileBeforeParseHook } from '@nuxt/content'

export default defineNuxtConfig({
  hooks: {
    'content:file:beforeParse'(ctx: FileBeforeParseHook) {
      // ...
    }
  }
})

content:file:afterParse

This hook is called after the content is parsed and before it is saved to the database.

import type { FileAfterParseHook } from '@nuxt/content'

export default defineNuxtConfig({
  hooks: {
    'content:file:afterParse'(ctx: FileAfterParseHook) {
      // ...
    }
  }
})