Skip to content

Instantly share code, notes, and snippets.

@saitonakamura
Created February 19, 2018 21:14
Show Gist options
  • Save saitonakamura/890dc276f97f798c41f7c52bb104c059 to your computer and use it in GitHub Desktop.
Save saitonakamura/890dc276f97f798c41f7c52bb104c059 to your computer and use it in GitHub Desktop.
Next.js on Github Pages _document.js example
import Document, { Head, Main, NextScript } from 'next/document'
export default class MyDocument extends Document {
render() {
return (
<html>
<Head>
<link
rel="stylesheet"
href={`${this.props.__NEXT_DATA__.assetPrefix}/_next/static/style.css`}
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment