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

An example with react-helmet #1264

Merged
merged 13 commits into from
Mar 15, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/with-react-helmet/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
**/yarn.lock
node_modules/
Copy link
Member

@timneutkens timneutkens Feb 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant all of them 😅 Sorry was on my phone then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the whole .gitignore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the parent .gitignore already takes care of ignoring node_modules. As for ignoring the .DS_Store, you could put it in your own ~/.gitignore_global as it's specific to your system (after having removed the files from this PR).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn.lock is also caught by the .gitignore in the examples directory btw.

**/.DS_Store
10 changes: 6 additions & 4 deletions examples/with-react-helmet/pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import Helmet from 'react-helmet'

export default class extends Document {
static async getInitialProps ({ renderPage }) {
const page = renderPage()

// see https://github.com/nfl/react-helmet#server-usage for more information
// 'head' was occupied by 'page.head', we cannot use it
return { ...page, helmet: Helmet.rewind() }
// 'head' was occupied by 'renderPage().head', we cannot use it
return { ...renderPage(), helmet: Helmet.rewind() }
}

// should render on <html>
Expand All @@ -24,7 +22,11 @@ export default class extends Document {

get helmetJsx () {
return (<Helmet
htmlAttributes={{lang: 'en'}}
title='Hello next.js!'
meta={[
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
]}
/>)
}

Expand Down