Docs menu
Add comments to a VitePress site
doc-after slot so each docs
page ends with a comment thread. VitePress changes pages without a reload, and each page still gets its own thread.
Before you start
- A Disfora project for your site. Create a free account, start a project and enter your domain. You'll verify it once the code is live.
1. Load the script
Add it to head in your config. VitePress puts it in the <head> of every page:
export default defineConfig({
// …your existing config
head: [
['script', { src: 'https://disfora.com/public/disfora.js', async: '' }],
],
})
2. Add the comment box to docs pages
Wrap the default theme's layout in a component that fills the slot after each page's content:
<script setup>
import DefaultTheme from 'vitepress/theme'
import { useData } from 'vitepress'
const { Layout } = DefaultTheme
const { frontmatter } = useData()
</script>
<template>
<Layout>
<template #doc-after>
<div v-if="frontmatter.comments !== false" data-disfora-comments></div>
</template>
</Layout>
</template>
Then use it as the theme's layout. If you already have this file, add Layout to what it exports:
import DefaultTheme from 'vitepress/theme'
import Layout from './Layout.vue'
export default {
extends: DefaultTheme,
Layout,
}
The slot only exists on docs pages, so your home page doesn't get a comment box, and a page with
comments: false in its front matter skips it. When a reader moves between pages in the sidebar,
Disfora loads the thread for the new page.
Check it on your site
Disfora only loads on the domain in your project, so localhost:5173 won't show it. Deploy, then
verify your domain if you haven't yet, and open a docs page on your
live site.
Ask a question
Something missing or unclear? Ask here and we'll answer in the thread.
Updated November 2026