Integration examples
Integration example - Next.js
The webpage generated by Publish Bot can be injected during Next.js’
Server-side Rendering (SSR)
.
For example:
This is how docs.publish-bot.com is implemented.
For example:
export default function Page({ html }) {
return <div
dangerouslySetInnerHTML={{__html: html}}
/>
}
// This gets called on every request
export async function getServerSideProps() {
// Fetch rendered document from Publish Bot
const res = await fetch(`https://pb-b.com/blabla`)
const html = await res.text()
// Pass data to the page via props
return { props: { html } }
}
This is how docs.publish-bot.com is implemented.