Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use with react-helmet #1246

Closed
cia48621793 opened this issue Feb 22, 2017 · 7 comments
Closed

Unable to use with react-helmet #1246

cia48621793 opened this issue Feb 22, 2017 · 7 comments

Comments

@cia48621793
Copy link
Contributor

The node was not even rendered...

@albinekb
Copy link
Contributor

albinekb commented Feb 22, 2017

Have you looked at the docs?
https://github.com/nfl/react-helmet#server-usage

What version of next?

@cia48621793
Copy link
Contributor Author

@albinekb where should I put my Helmet.rewind?

@cia48621793
Copy link
Contributor Author

@albinekb latest

@cia48621793
Copy link
Contributor Author

@albinekb
I have the _document.js set up like this tho:

import Document, { Head, Main, NextScript } from 'next/document'
import Helmet from 'react-helmet'

export default class MyDocument extends Document {
  render () {
    return (
     <html>
       <Head>
         <Helmet
           link={[
             {rel:'stylesheet', href: "https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css"},
             {rel:'stylesheet', href: "https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/4.0.2/bootstrap-material-design.min.css"}
           ]}
         />
       </Head>
       <body>
         <Main />
         <NextScript />
       </body>
     </html>
    )
  }
}

I couldn't however find anywhere to put Helmet.rewind, where's the post render function?

@impronunciable
Copy link
Contributor

@cia48621793 this is a valid question, although we recommend using next/head for dealing with the page <head> https://github.com/zeit/next.js#populating-head

@impronunciable
Copy link
Contributor

@cia48621793 About the Helmet.rewind you do it inside the getInitialProps document class method like in this example https://github.com/zeit/next.js/blob/master/examples/with-styled-components/pages/_document.js#L7, then you can pass the head as a initial prop to the document to inject into the page.

@cia48621793
Copy link
Contributor Author

Closed as of #1264

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants