diff --git a/antwar.config.js b/antwar.config.js index 47df708..f68d225 100644 --- a/antwar.config.js +++ b/antwar.config.js @@ -5,6 +5,9 @@ module.exports = () => ({ apiUrl: "http://api.react-finland.fi/graphql-2018", template: { file: path.resolve(__dirname, "templates/page.ejs"), + context: { + helmet: {}, + }, }, renderPage: require("./utils/render-page"), output: "build", diff --git a/components/AnchorHeader.js b/components/AnchorHeader.js index 19e44dc..990e909 100644 --- a/components/AnchorHeader.js +++ b/components/AnchorHeader.js @@ -2,7 +2,7 @@ import React from "react"; import PropTypes from "prop-types"; const AnchorHeader = ({ level, anchor, children }, { getId }) => { - let id = getId(anchor, children); + let id = getId && getId(anchor, children); return React.createElement(`h${level}`, { className: "heading" }, [ , diff --git a/components/Meta.js b/components/Meta.js new file mode 100644 index 0000000..1878da2 --- /dev/null +++ b/components/Meta.js @@ -0,0 +1,38 @@ +import React from "react"; +import Helmet from "react-helmet-async"; +import PropTypes from "prop-types"; + +const Meta = ({ siteName, title, description, keywords = [] }) => ( + + + + + + {siteName} - {title} + + + + + + + + + + + + + + + +); +Meta.propTypes = { + siteName: PropTypes.string, + title: PropTypes.string, + description: PropTypes.string, + keywords: PropTypes.array, +}; + +export default Meta; diff --git a/components/index.js b/components/index.js index c072077..1f56eab 100644 --- a/components/index.js +++ b/components/index.js @@ -7,6 +7,7 @@ export { default as Header } from "./Header"; export { default as Link } from "./Link"; export { default as Navigation } from "./Navigation"; export { default as Markdown } from "./Markdown"; +export { default as Meta } from "./Meta"; export { default as Organizer } from "./Organizer"; export { default as Schedule } from "./Schedule"; export { default as SessionSpeakers } from "./SessionSpeakers"; diff --git a/layouts/SiteBody.js b/layouts/SiteBody.js index a38bdcc..850a092 100644 --- a/layouts/SiteBody.js +++ b/layouts/SiteBody.js @@ -1,91 +1,110 @@ import React from "react"; import { hot } from "react-hot-loader"; import PropTypes from "prop-types"; +import { HelmetProvider } from "react-helmet-async"; import { AnchorHeader, AnchorProvider, Contacts, - Header, Footer, + Header, + Meta, Sponsor, Subscribe, connect, } from "../components"; +import * as tweakSponsors from "./tweak-sponsors"; import "normalize.css/normalize.css"; import "../styles/fontello-codes.css"; import "../styles/fontello-embedded.css"; import "../styles/style.scss"; -const SiteBody = ({ - children, - location: { pathname }, - page: { file: { title } }, - partners = [], - goldSponsors = [], - silverSponsors = [], - bronzeSponsors = [], -}) => ( - -
-
-
-
- {children} -
- -
- - 🥈 Silver Sponsors - -
- - {silverSponsors.length < 3 && ( - Become a sponsor - )} -
+const siteName = "React Finland"; + +const SiteBody = ( + { + children, + location: { pathname }, + page: { file: { title, description, keywords } }, + partners = [], + goldSponsors = [], + silverSponsors = [], + bronzeSponsors = [], + }, + { router } +) => ( + + + +
+
+
+
+ {children} +
+
+ + 🥇 Gold Sponsors + +
+ + {goldSponsors.length < 2 && ( + Become a sponsor + )} +
+
+
+ + 🥈 Silver Sponsors + +
+ + {silverSponsors.length < 3 && ( + Become a sponsor + )} +
+
+ + Partners +
+
+ + {bronzeSponsors.length < 4 && ( + Become a sponsor + )} +
+
-
- - 🥉 Bronze Sponsors - + + Partners +
- - {bronzeSponsors.length < 4 && ( - Become a sponsor - )} +
-
- - Partners -
-
- -
-
-
-
- -
-
-
+
+
+ +
+ + ); SiteBody.propTypes = { children: PropTypes.node, @@ -97,44 +116,6 @@ SiteBody.propTypes = { bronzeSponsors: PropTypes.array, }; -function tweakSilverSponsors(sponsors) { - // Tweak Nitor - return sponsors.map(sponsor => { - if (sponsor.name === "Nitor") { - return { - ...sponsor, - logoProps: { - style: { - background: "black", - padding: "1.5em", - }, - }, - }; - } - - return sponsor; - }); -} - -function tweakBronzeSponsors(sponsors) { - // Tweak Rohea - return sponsors.map(sponsor => { - if (sponsor.name === "Rohea") { - return { - ...sponsor, - logoProps: { - style: { - background: "black", - padding: "1em", - }, - }, - }; - } - - return sponsor; - }); -} - const sponsorQuery = `{ name, social { homepage }, about, image }`; export default hot(module)( connect(` diff --git a/layouts/tweak-sponsors.js b/layouts/tweak-sponsors.js new file mode 100644 index 0000000..7f14120 --- /dev/null +++ b/layouts/tweak-sponsors.js @@ -0,0 +1,39 @@ +function tweakSilverSponsors(sponsors) { + // Tweak Nitor + return sponsors.map(sponsor => { + if (sponsor.name === "Nitor") { + return { + ...sponsor, + logoProps: { + style: { + background: "black", + padding: "1.5em", + }, + }, + }; + } + + return sponsor; + }); +} + +function tweakBronzeSponsors(sponsors) { + // Tweak Rohea + return sponsors.map(sponsor => { + if (sponsor.name === "Rohea") { + return { + ...sponsor, + logoProps: { + style: { + background: "black", + padding: "1em", + }, + }, + }; + } + + return sponsor; + }); +} + +export { tweakSilverSponsors as silver, tweakBronzeSponsors as bronze }; diff --git a/package-lock.json b/package-lock.json index b888892..00dbdc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1888,11 +1888,11 @@ } }, "@react-finland/content-2018": { - "version": "12.0.4", + "version": "12.0.5", "resolved": - "https://registry.npmjs.org/@react-finland/content-2018/-/content-2018-12.0.4.tgz", + "https://registry.npmjs.org/@react-finland/content-2018/-/content-2018-12.0.5.tgz", "integrity": - "sha512-kT0DeY2vhyHC5g9MFF/LyfTJRuv8cs4ootzdhGIuSgwtKBwqhQPk67Zg0ezL1OwdHs98E73U8MzBK4i7ySBsPw==" + "sha512-IwqBpu8yv/Q+KgCL85khDT+Fb+Oq+F9P2qQKFOs/pdGgjAmv2W5m+UZxGf/d3ZNhyX+jkXcO8ApJLxfLd00qWg==" }, "@types/async": { "version": "2.0.47", @@ -2047,10 +2047,10 @@ } }, "antwar": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/antwar/-/antwar-0.25.0.tgz", + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/antwar/-/antwar-0.25.4.tgz", "integrity": - "sha512-tEzW8jhIfZ1Gf1zdg00dIA3ADJU6whC/UQMBIxqmV2Y3q6XbKvDNCcaXJGUMvr9dhZcRFqErZ11WOKzEMIQYxg==", + "sha512-n10DnolGUqzBh6CRuLGD0aVH0w5vij5myW+y1r6AaDlNeBK03og2Ggrr2RvLbh1vh+VwMai1Vj4I8Ue5Ti+EAA==", "requires": { "chalk": "2.3.1", "cheerio": "1.0.0-rc.2", @@ -4096,8 +4096,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", - "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", - "dev": true + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" }, "deep-is": { "version": "0.1.3", @@ -5337,13 +5336,15 @@ "dependencies": { "abbrev": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", + "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=", "dev": true, "optional": true }, "ajv": { "version": "4.11.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", "dev": true, "optional": true, "requires": { @@ -5353,18 +5354,23 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "aproba": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.1.tgz", + "integrity": "sha1-ldNgDwdxCqDpKYxyatXs8urLq6s=", "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.4", - "bundled": true, + "resolved": + "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", "dev": true, "optional": true, "requires": { @@ -5374,42 +5380,54 @@ }, "asn1": { "version": "0.2.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", "dev": true, "optional": true }, "assert-plus": { "version": "0.2.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", "dev": true, "optional": true }, "asynckit": { "version": "0.4.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true, "optional": true }, "aws-sign2": { "version": "0.6.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", "dev": true, "optional": true }, "aws4": { "version": "1.6.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", "dev": true, "optional": true }, "balanced-match": { "version": "0.4.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", + "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", "dev": true }, "bcrypt-pbkdf": { "version": "1.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", "dev": true, "optional": true, "requires": { @@ -5418,7 +5436,9 @@ }, "block-stream": { "version": "0.0.9", - "bundled": true, + "resolved": + "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", "dev": true, "requires": { "inherits": "2.0.3" @@ -5426,7 +5446,8 @@ }, "boom": { "version": "2.10.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "dev": true, "requires": { "hoek": "2.16.3" @@ -5434,7 +5455,9 @@ }, "brace-expansion": { "version": "1.1.7", - "bundled": true, + "resolved": + "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", + "integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", "dev": true, "requires": { "balanced-match": "0.4.2", @@ -5443,29 +5466,38 @@ }, "buffer-shims": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=", "dev": true }, "caseless": { "version": "0.12.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true, "optional": true }, "co": { "version": "4.6.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "combined-stream": { "version": "1.0.5", - "bundled": true, + "resolved": + "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", "dev": true, "requires": { "delayed-stream": "1.0.0" @@ -5473,22 +5505,30 @@ }, "concat-map": { "version": "0.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true }, "core-util-is": { "version": "1.0.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, "cryptiles": { "version": "2.0.5", - "bundled": true, + "resolved": + "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", "dev": true, "requires": { "boom": "2.10.1" @@ -5496,7 +5536,9 @@ }, "dashdash": { "version": "1.14.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "optional": true, "requires": { @@ -5505,7 +5547,9 @@ "dependencies": { "assert-plus": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, "optional": true } @@ -5513,7 +5557,8 @@ }, "debug": { "version": "2.6.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", "dev": true, "optional": true, "requires": { @@ -5522,30 +5567,40 @@ }, "deep-extend": { "version": "0.4.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", "dev": true, "optional": true }, "delayed-stream": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, "delegates": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true, "optional": true }, "detect-libc": { "version": "1.0.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.2.tgz", + "integrity": "sha1-ca1dIEvxempsqPRQxhRUBm70YeE=", "dev": true, "optional": true }, "ecc-jsbn": { "version": "0.1.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", "dev": true, "optional": true, "requires": { @@ -5554,24 +5609,31 @@ }, "extend": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", "dev": true, "optional": true }, "extsprintf": { "version": "1.0.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", + "integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=", "dev": true }, "forever-agent": { "version": "0.6.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", "dev": true, "optional": true }, "form-data": { "version": "2.1.4", - "bundled": true, + "resolved": + "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", "dev": true, "optional": true, "requires": { @@ -5582,12 +5644,15 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, "fstream": { "version": "1.0.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true, "requires": { "graceful-fs": "4.1.11", @@ -5598,7 +5663,9 @@ }, "fstream-ignore": { "version": "1.0.5", - "bundled": true, + "resolved": + "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", + "integrity": "sha1-nDHa40dnAY/h0kmyTa2mfQktoQU=", "dev": true, "optional": true, "requires": { @@ -5609,7 +5676,8 @@ }, "gauge": { "version": "2.7.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "optional": true, "requires": { @@ -5625,7 +5693,8 @@ }, "getpass": { "version": "0.1.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "optional": true, "requires": { @@ -5634,7 +5703,9 @@ "dependencies": { "assert-plus": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, "optional": true } @@ -5642,7 +5713,9 @@ }, "glob": { "version": "7.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": + "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -5655,18 +5728,24 @@ }, "graceful-fs": { "version": "4.1.11", - "bundled": true, + "resolved": + "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, "har-schema": { "version": "1.0.5", - "bundled": true, + "resolved": + "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", "dev": true, "optional": true }, "har-validator": { "version": "4.2.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", "dev": true, "optional": true, "requires": { @@ -5676,13 +5755,16 @@ }, "has-unicode": { "version": "2.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "dev": true, "optional": true }, "hawk": { "version": "3.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", "dev": true, "requires": { "boom": "2.10.1", @@ -5693,12 +5775,15 @@ }, "hoek": { "version": "2.16.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", "dev": true }, "http-signature": { "version": "1.1.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", "dev": true, "optional": true, "requires": { @@ -5709,7 +5794,9 @@ }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": + "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { "once": "1.4.0", @@ -5718,18 +5805,23 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, + "resolved": + "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "ini": { "version": "1.3.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", + "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "requires": { "number-is-nan": "1.0.1" @@ -5737,24 +5829,31 @@ }, "is-typedarray": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true, "optional": true }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, "isstream": { "version": "0.1.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true, "optional": true }, "jodid25519": { "version": "1.0.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz", + "integrity": "sha1-BtSRIlUJNBlHfUJWM2BuDpB4KWc=", "dev": true, "optional": true, "requires": { @@ -5763,19 +5862,24 @@ }, "jsbn": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "dev": true, "optional": true }, "json-schema": { "version": "0.2.3", - "bundled": true, + "resolved": + "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", "dev": true, "optional": true }, "json-stable-stringify": { "version": "1.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true, "optional": true, "requires": { @@ -5784,19 +5888,23 @@ }, "json-stringify-safe": { "version": "5.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true, "optional": true }, "jsonify": { "version": "0.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", "dev": true, "optional": true }, "jsprim": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", + "integrity": "sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg=", "dev": true, "optional": true, "requires": { @@ -5808,7 +5916,9 @@ "dependencies": { "assert-plus": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, "optional": true } @@ -5816,12 +5926,15 @@ }, "mime-db": { "version": "1.27.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz", + "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=", "dev": true }, "mime-types": { "version": "2.1.15", - "bundled": true, + "resolved": + "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", + "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", "dev": true, "requires": { "mime-db": "1.27.0" @@ -5829,7 +5942,10 @@ }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": + "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": + "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "1.1.7" @@ -5837,12 +5953,15 @@ }, "minimist": { "version": "0.0.8", - "bundled": true, + "resolved": + "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { "minimist": "0.0.8" @@ -5850,13 +5969,17 @@ }, "ms": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true, "optional": true }, "node-pre-gyp": { "version": "0.6.39", - "bundled": true, + "resolved": + "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz", + "integrity": + "sha512-OsJV74qxnvz/AMGgcfZoDaeDXKD3oY3QVIbBmwszTFkRisTSXbMQyn4UWzUMOtA5SVhrBZOTp0wcoSBgfMfMmQ==", "dev": true, "optional": true, "requires": { @@ -5875,7 +5998,8 @@ }, "nopt": { "version": "4.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "dev": true, "optional": true, "requires": { @@ -5885,7 +6009,9 @@ }, "npmlog": { "version": "4.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.0.tgz", + "integrity": + "sha512-ocolIkZYZt8UveuiDS0yAkkIjid1o7lPG8cYm05yNYzBn8ykQtaiPMEGp8fY9tKdDgm8okpdKzkvu1y9hUYugA==", "dev": true, "optional": true, "requires": { @@ -5897,24 +6023,31 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "oauth-sign": { "version": "0.8.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", "dev": true, "optional": true }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, "optional": true }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1.0.2" @@ -5922,19 +6055,24 @@ }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true, "optional": true }, "osenv": { "version": "0.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", + "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", "dev": true, "optional": true, "requires": { @@ -5944,35 +6082,45 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, "performance-now": { "version": "0.2.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", "dev": true, "optional": true }, "process-nextick-args": { "version": "1.0.7", - "bundled": true, + "resolved": + "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "dev": true }, "punycode": { "version": "1.4.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", "dev": true, "optional": true }, "qs": { "version": "6.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", + "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", "dev": true, "optional": true }, "rc": { "version": "1.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", + "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", "dev": true, "optional": true, "requires": { @@ -5984,7 +6132,9 @@ "dependencies": { "minimist": { "version": "1.2.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true, "optional": true } @@ -5992,7 +6142,9 @@ }, "readable-stream": { "version": "2.2.9", - "bundled": true, + "resolved": + "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "integrity": "sha1-z3jsb0ptHrQ9JkiMrJfwQudLf8g=", "dev": true, "requires": { "buffer-shims": "1.0.0", @@ -6006,7 +6158,8 @@ }, "request": { "version": "2.81.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", + "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", "dev": true, "optional": true, "requires": { @@ -6036,7 +6189,8 @@ }, "rimraf": { "version": "2.6.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", "dev": true, "requires": { "glob": "7.1.2" @@ -6044,30 +6198,38 @@ }, "safe-buffer": { "version": "5.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", + "integrity": "sha1-0mPKVGls2KMGtcplUekt5XkY++c=", "dev": true }, "semver": { "version": "5.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true, "optional": true }, "sntp": { "version": "1.0.9", - "bundled": true, + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", "dev": true, "requires": { "hoek": "2.16.3" @@ -6075,7 +6237,8 @@ }, "sshpk": { "version": "1.13.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.0.tgz", + "integrity": "sha1-/yo+T9BEl1Vf7Zezmg/YL6+zozw=", "dev": true, "optional": true, "requires": { @@ -6092,7 +6255,9 @@ "dependencies": { "assert-plus": { "version": "1.0.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, "optional": true } @@ -6100,7 +6265,9 @@ }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { "code-point-at": "1.1.0", @@ -6110,7 +6277,9 @@ }, "string_decoder": { "version": "1.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", + "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", "dev": true, "requires": { "safe-buffer": "5.0.1" @@ -6118,13 +6287,17 @@ }, "stringstream": { "version": "0.0.5", - "bundled": true, + "resolved": + "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", "dev": true, "optional": true }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { "ansi-regex": "2.1.1" @@ -6132,13 +6305,16 @@ }, "strip-json-comments": { "version": "2.0.1", - "bundled": true, + "resolved": + "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, "optional": true }, "tar": { "version": "2.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { "block-stream": "0.0.9", @@ -6148,7 +6324,9 @@ }, "tar-pack": { "version": "3.4.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/tar-pack/-/tar-pack-3.4.0.tgz", + "integrity": "sha1-I74tf2cagzk3bL2wuP4/3r8xeYQ=", "dev": true, "optional": true, "requires": { @@ -6164,7 +6342,9 @@ }, "tough-cookie": { "version": "2.3.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", "dev": true, "optional": true, "requires": { @@ -6173,7 +6353,9 @@ }, "tunnel-agent": { "version": "0.6.0", - "bundled": true, + "resolved": + "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "optional": true, "requires": { @@ -6182,30 +6364,38 @@ }, "tweetnacl": { "version": "0.14.5", - "bundled": true, + "resolved": + "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "dev": true, "optional": true }, "uid-number": { "version": "0.0.6", - "bundled": true, + "resolved": + "https://registry.npmjs.org/uid-number/-/uid-number-0.0.6.tgz", + "integrity": "sha1-DqEOgDXo61uOREnwbaHHMGY7qoE=", "dev": true, "optional": true }, "util-deprecate": { "version": "1.0.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, "uuid": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz", + "integrity": "sha1-ZUS7ot/ajBzxfmKaOjBeK7H+5sE=", "dev": true, "optional": true }, "verror": { "version": "1.3.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", + "integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=", "dev": true, "optional": true, "requires": { @@ -6214,7 +6404,10 @@ }, "wide-align": { "version": "1.1.2", - "bundled": true, + "resolved": + "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", + "integrity": + "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", "dev": true, "optional": true, "requires": { @@ -6223,7 +6416,8 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true } } @@ -12216,6 +12410,19 @@ "prop-types": "15.6.0" } }, + "react-helmet-async": { + "version": "0.0.5", + "resolved": + "https://registry.npmjs.org/react-helmet-async/-/react-helmet-async-0.0.5.tgz", + "integrity": + "sha512-O6neLxFoxp1fOziF+HEfIqlDkEmC9IAPJRQMG25y5BqDCxY/FTa2n9jUmN1zBmlSjHvDbIUlc5SokjojIJ96wg==", + "requires": { + "deep-equal": "1.0.1", + "invariant": "2.2.2", + "prop-types": "15.6.0", + "shallowequal": "1.0.2" + } + }, "react-hot-loader": { "version": "4.0.0-rc.0", "resolved": @@ -13156,8 +13363,7 @@ "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.0.2.tgz", "integrity": - "sha512-zlVXeVUKvo+HEv1e2KQF/csyeMKx2oHvatQ9l6XjCUj3agvC8XGf6R9HvIPDSmp8FNPvx7b5kaEJTRi7CqxtEw==", - "dev": true + "sha512-zlVXeVUKvo+HEv1e2KQF/csyeMKx2oHvatQ9l6XjCUj3agvC8XGf6R9HvIPDSmp8FNPvx7b5kaEJTRi7CqxtEw==" }, "shebang-command": { "version": "1.2.0", diff --git a/package.json b/package.json index 2e3c511..141eb72 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ }, "homepage": "https://github.com/ReactFinland/site#readme", "dependencies": { - "@react-finland/content-2018": "^12.0.4", - "antwar": "^0.25.0", + "@react-finland/content-2018": "^12.0.5", + "antwar": "^0.25.4", "antwar-interactive": "^0.21.0", "apollo-client": "^2.2.5", "classnames": "^2.2.5", @@ -46,6 +46,7 @@ "react-country-flag": "^0.1.12", "react-dom": "^16.2.0", "react-image-lightbox": "^4.5.0", + "react-helmet-async": "0.0.5", "react-markdown": "^3.2.0", "react-photo-gallery": "^6.0.22", "react-router-dom": "^4.2.2" diff --git a/templates/page.ejs b/templates/page.ejs index 766f9f8..f2f76b6 100644 --- a/templates/page.ejs +++ b/templates/page.ejs @@ -1,38 +1,20 @@ - +> - - - - - - - - - - - - - React Finland - <%= htmlWebpackPlugin.options.context.title %> - <% if (htmlWebpackPlugin.options.context.rss) { %> - - <% } %> - - + <%- htmlWebpackPlugin.options.context.helmet.title %> + <%- htmlWebpackPlugin.options.context.helmet.meta %> + <%- htmlWebpackPlugin.options.context.helmet.link %> + <%- htmlWebpackPlugin.options.context.helmet.style %> <% for (var file of htmlWebpackPlugin.options.context.cssFiles) { %> <% } %> - + > <%- webpackConfig.html %> + <%- htmlWebpackPlugin.options.context.helmet.noscript %> + <%- htmlWebpackPlugin.options.context.helmet.script %> <% for (var script of htmlWebpackPlugin.options.context.jsFiles) { %> diff --git a/utils/render-page.js b/utils/render-page.js index 2ca9cdb..b01c35d 100644 --- a/utils/render-page.js +++ b/utils/render-page.js @@ -4,13 +4,19 @@ const { getDataFromTree } = require("react-apollo"); const { Route, StaticRouter } = require("react-router"); module.exports = function renderDefault({ location, content: component }, cb) { + const helmetContext = {}; const page = React.createElement( StaticRouter, - { location, context: {} }, + { location, context: { helmetContext } }, React.createElement(Route, { component }) ); getDataFromTree(page) - .then(() => cb(null, { html: ReactDOMServer.renderToStaticMarkup(page) })) + .then(() => + cb(null, { + html: ReactDOMServer.renderToStaticMarkup(page), + context: { helmet: helmetContext.helmet }, + }) + ) .catch(cb); };