-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* prepare publishing of gatsby-plugin-hooked-head * adjust readme * make 0.1.0 the first version * Update packages/gatsby-plugin-hooked-head/gatsby-ssr.js Co-Authored-By: Gustav Pursche <[email protected]> * fix syntax issue Co-authored-by: Gustav Pursche <[email protected]>
- Loading branch information
1 parent
d97ec11
commit 2f16169
Showing
8 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ example | |
yarn.lock | ||
.rpt2_cache | ||
coverage | ||
packages | ||
typings.d.ts | ||
Dockerfile | ||
mangle.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# 0.1.1 | ||
|
||
Fix syntax error | ||
|
||
# 0.1.0 | ||
|
||
Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# gatsby-plugin-hooked-head | ||
|
||
A [Gatsby](https://github.com/gatsbyjs/gatsby) plugin for | ||
[Hooked-head](https://github.com/JoviDeCroock/hooked-head) with ssr-support. | ||
|
||
## Install | ||
|
||
```sh | ||
npm i --save hooked-head gatsby-plugin-hooked-head | ||
## OR | ||
yarn add hooked-head gatsby-plugin-hooked-head | ||
``` | ||
|
||
## How to use | ||
|
||
Edit `gatsby-config.js` | ||
|
||
```js | ||
module.exports = { | ||
plugins: [`gatsby-plugin-hooked-head`], | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { createElement } from 'react'; | ||
import { toStatic } from 'hooked-head'; | ||
|
||
export const onRenderBody = ({ setHeadComponents, setHtmlAttributes }) => { | ||
const { title, metas, lang, links } = toStatic(); | ||
|
||
if (lang) { | ||
setHtmlAttributes({ lang }); | ||
} | ||
|
||
setHeadComponents( | ||
[ | ||
title && createElement('title', null, title), | ||
...metas.map((meta) => createElement('meta', meta, null)), | ||
...links.map((link) => createElement('link', link, null)), | ||
].filter(Boolean) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "gatsby-plugin-hooked-head", | ||
"version": "0.1.1", | ||
"description": "Gatsby plugin to add support for hooked-head", | ||
"author": "jdecroock <[email protected]> (https://twitter.com/JoviDeC)", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"scripts": {}, | ||
"keywords": [ | ||
"hooked-head", | ||
"gatsby", | ||
"gatsby-plugin", | ||
"head", | ||
"seo" | ||
], | ||
"files": [ | ||
"gatsby-ssr.js", | ||
"index.js", | ||
"package.json", | ||
"README.md" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"peerDependencies": { | ||
"hooked-head": "^0.4.0", | ||
"gatsby": "^2.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/JoviDeCroock/hooked-head.git", | ||
"directory": "packages/gatsby-plugin-hooked-head" | ||
} | ||
} |