2018-10-03 00:08:57 +02:00
|
|
|
/* eslint-disable */
|
|
|
|
import React, { Component } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
2019-02-25 23:00:14 +01:00
|
|
|
import { htmlEscapeJsonString } from '../server/htmlescape'
|
2018-10-03 00:08:57 +02:00
|
|
|
import flush from 'styled-jsx/server'
|
2019-02-25 23:00:14 +01:00
|
|
|
import {
|
|
|
|
CLIENT_STATIC_FILES_RUNTIME_AMP,
|
|
|
|
CLIENT_STATIC_FILES_RUNTIME_WEBPACK,
|
|
|
|
} from 'next-server/constants'
|
2018-10-03 00:08:57 +02:00
|
|
|
|
|
|
|
export default class Document extends Component {
|
|
|
|
static childContextTypes = {
|
2019-02-03 01:12:49 +01:00
|
|
|
_documentProps: PropTypes.any,
|
|
|
|
_devOnlyInvalidateCacheQueryString: PropTypes.string,
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
static getInitialProps({ renderPage }) {
|
2018-12-13 01:00:46 +01:00
|
|
|
const { html, head } = renderPage()
|
2018-10-03 00:08:57 +02:00
|
|
|
const styles = flush()
|
2018-12-13 01:00:46 +01:00
|
|
|
return { html, head, styles }
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
getChildContext() {
|
2019-02-03 01:12:49 +01:00
|
|
|
return {
|
|
|
|
_documentProps: this.props,
|
|
|
|
// In dev we invalidate the cache by appending a timestamp to the resource URL.
|
|
|
|
// This is a workaround to fix https://github.com/zeit/next.js/issues/5860
|
|
|
|
// TODO: remove this workaround when https://bugs.webkit.org/show_bug.cgi?id=187726 is fixed.
|
2019-03-01 20:51:13 +01:00
|
|
|
_devOnlyInvalidateCacheQueryString:
|
|
|
|
process.env.NODE_ENV !== 'production' ? '?ts=' + Date.now() : '',
|
2019-02-03 01:12:49 +01:00
|
|
|
}
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
|
2019-02-20 15:46:29 +01:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Html>
|
|
|
|
<Head />
|
|
|
|
<body>
|
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</Html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Html extends Component {
|
|
|
|
static contextTypes = {
|
|
|
|
_documentProps: PropTypes.any,
|
|
|
|
}
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
children: PropTypes.node.isRequired,
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { amphtml } = this.context._documentProps
|
2019-02-21 00:42:53 +01:00
|
|
|
const { children, ...props } = this.props
|
|
|
|
return (
|
|
|
|
<html {...props} amp={amphtml ? '' : null}>
|
|
|
|
{children}
|
|
|
|
</html>
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Head extends Component {
|
|
|
|
static contextTypes = {
|
2019-02-03 01:12:49 +01:00
|
|
|
_documentProps: PropTypes.any,
|
|
|
|
_devOnlyInvalidateCacheQueryString: PropTypes.string,
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static propTypes = {
|
2018-11-13 21:36:09 +01:00
|
|
|
nonce: PropTypes.string,
|
2019-03-01 20:51:13 +01:00
|
|
|
crossOrigin: PropTypes.string,
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
getCssLinks() {
|
2018-10-03 00:08:57 +02:00
|
|
|
const { assetPrefix, files } = this.context._documentProps
|
2019-03-01 20:51:13 +01:00
|
|
|
if (!files || files.length === 0) {
|
2018-10-03 00:08:57 +02:00
|
|
|
return null
|
|
|
|
}
|
2018-11-01 14:05:39 +01:00
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
return files.map(file => {
|
2018-10-03 00:08:57 +02:00
|
|
|
// Only render .css files here
|
2019-03-01 20:51:13 +01:00
|
|
|
if (!/\.css$/.exec(file)) {
|
2018-10-03 00:08:57 +02:00
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
return (
|
|
|
|
<link
|
|
|
|
key={file}
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
rel="stylesheet"
|
|
|
|
href={`${assetPrefix}/_next/${file}`}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
getPreloadDynamicChunks() {
|
2018-10-03 00:08:57 +02:00
|
|
|
const { dynamicImports, assetPrefix } = this.context._documentProps
|
2019-02-03 01:12:49 +01:00
|
|
|
const { _devOnlyInvalidateCacheQueryString } = this.context
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
return dynamicImports.map(bundle => {
|
|
|
|
return (
|
|
|
|
<link
|
|
|
|
rel="preload"
|
|
|
|
key={bundle.file}
|
|
|
|
href={`${assetPrefix}/_next/${
|
|
|
|
bundle.file
|
|
|
|
}${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
as="script"
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
getPreloadMainLinks() {
|
2018-10-03 00:08:57 +02:00
|
|
|
const { assetPrefix, files } = this.context._documentProps
|
2019-02-03 01:12:49 +01:00
|
|
|
if (!files || files.length === 0) {
|
2018-10-03 00:08:57 +02:00
|
|
|
return null
|
|
|
|
}
|
2019-02-03 01:12:49 +01:00
|
|
|
const { _devOnlyInvalidateCacheQueryString } = this.context
|
2018-11-01 14:05:39 +01:00
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
return files.map(file => {
|
2018-10-03 00:08:57 +02:00
|
|
|
// Only render .js files here
|
2019-03-01 20:51:13 +01:00
|
|
|
if (!/\.js$/.exec(file)) {
|
2018-10-03 00:08:57 +02:00
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
return (
|
|
|
|
<link
|
|
|
|
key={file}
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
rel="preload"
|
|
|
|
href={`${assetPrefix}/_next/${file}${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
as="script"
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
ampEnabled,
|
|
|
|
head,
|
|
|
|
styles,
|
|
|
|
amphtml,
|
|
|
|
assetPrefix,
|
|
|
|
__NEXT_DATA__,
|
|
|
|
} = this.context._documentProps
|
2019-02-03 01:12:49 +01:00
|
|
|
const { _devOnlyInvalidateCacheQueryString } = this.context
|
2018-10-10 21:58:15 +02:00
|
|
|
const { page, buildId } = __NEXT_DATA__
|
2018-10-03 00:08:57 +02:00
|
|
|
|
|
|
|
let children = this.props.children
|
|
|
|
// show a warning if Head contains <title> (only in development)
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
2019-03-01 20:51:13 +01:00
|
|
|
children = React.Children.map(children, child => {
|
2018-10-03 00:08:57 +02:00
|
|
|
if (child && child.type === 'title') {
|
2019-03-01 20:51:13 +01:00
|
|
|
console.warn(
|
|
|
|
"Warning: <title> should not be used in _document.js's <Head>. https://err.sh/next.js/no-document-title"
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
return child
|
|
|
|
})
|
2019-03-01 20:51:13 +01:00
|
|
|
if (this.props.crossOrigin)
|
|
|
|
console.warn(
|
|
|
|
'Warning: `Head` attribute `crossOrigin` is deprecated. https://err.sh/next.js/doc-crossorigin-deprecated'
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
2019-03-01 20:51:13 +01:00
|
|
|
return (
|
|
|
|
<head {...this.props}>
|
|
|
|
{children}
|
|
|
|
{head}
|
|
|
|
{amphtml && (
|
|
|
|
<>
|
|
|
|
<meta
|
|
|
|
name="viewport"
|
|
|
|
content="width=device-width,minimum-scale=1,initial-scale=1"
|
|
|
|
/>
|
|
|
|
<link rel="canonical" href={page} />
|
|
|
|
{/* https://www.ampproject.org/docs/fundamentals/optimize_amp#optimize-the-amp-runtime-loading */}
|
|
|
|
<link
|
|
|
|
rel="preload"
|
|
|
|
as="script"
|
|
|
|
href="https://cdn.ampproject.org/v0.js"
|
|
|
|
/>
|
|
|
|
{/* Add custom styles before AMP styles to prevent accidental overrides */}
|
|
|
|
{styles && (
|
|
|
|
<style
|
|
|
|
amp-custom=""
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: styles
|
|
|
|
.map(style => style.props.dangerouslySetInnerHTML.__html)
|
|
|
|
.join(''),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<style
|
|
|
|
amp-boilerplate=""
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: `body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<noscript>
|
|
|
|
<style
|
|
|
|
amp-boilerplate=""
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: `body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</noscript>
|
|
|
|
<script async src="https://cdn.ampproject.org/v0.js" />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
{!amphtml && (
|
|
|
|
<>
|
|
|
|
{ampEnabled && <link rel="amphtml" href={`${page}?amp=1`} />}
|
|
|
|
{page !== '/_error' && (
|
|
|
|
<link
|
|
|
|
rel="preload"
|
|
|
|
href={`${assetPrefix}/_next/static/${buildId}/pages${getPagePathname(
|
|
|
|
page
|
|
|
|
)}${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
as="script"
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<link
|
|
|
|
rel="preload"
|
|
|
|
href={`${assetPrefix}/_next/static/${buildId}/pages/_app.js${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
as="script"
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
{this.getPreloadDynamicChunks()}
|
|
|
|
{this.getPreloadMainLinks()}
|
|
|
|
{this.getCssLinks()}
|
|
|
|
{styles || null}
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</head>
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Main extends Component {
|
|
|
|
static contextTypes = {
|
2019-02-03 01:12:49 +01:00
|
|
|
_documentProps: PropTypes.any,
|
|
|
|
_devOnlyInvalidateCacheQueryString: PropTypes.string,
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
render() {
|
2018-10-03 00:08:57 +02:00
|
|
|
const { html } = this.context._documentProps
|
2019-03-01 20:51:13 +01:00
|
|
|
return <div id="__next" dangerouslySetInnerHTML={{ __html: html }} />
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class NextScript extends Component {
|
|
|
|
static contextTypes = {
|
2019-02-03 01:12:49 +01:00
|
|
|
_documentProps: PropTypes.any,
|
|
|
|
_devOnlyInvalidateCacheQueryString: PropTypes.string,
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static propTypes = {
|
2018-11-13 21:36:09 +01:00
|
|
|
nonce: PropTypes.string,
|
2019-03-01 20:51:13 +01:00
|
|
|
crossOrigin: PropTypes.string,
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
getDynamicChunks() {
|
2018-10-03 00:08:57 +02:00
|
|
|
const { dynamicImports, assetPrefix } = this.context._documentProps
|
2019-02-03 01:12:49 +01:00
|
|
|
const { _devOnlyInvalidateCacheQueryString } = this.context
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
return dynamicImports.map(bundle => {
|
|
|
|
return (
|
|
|
|
<script
|
|
|
|
async
|
|
|
|
key={bundle.file}
|
|
|
|
src={`${assetPrefix}/_next/${
|
|
|
|
bundle.file
|
|
|
|
}${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
getScripts() {
|
2018-10-03 00:08:57 +02:00
|
|
|
const { assetPrefix, files } = this.context._documentProps
|
2019-02-03 01:12:49 +01:00
|
|
|
if (!files || files.length === 0) {
|
2018-10-03 00:08:57 +02:00
|
|
|
return null
|
|
|
|
}
|
2019-02-03 01:12:49 +01:00
|
|
|
const { _devOnlyInvalidateCacheQueryString } = this.context
|
2018-11-01 14:05:39 +01:00
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
return files.map(file => {
|
2018-10-03 00:08:57 +02:00
|
|
|
// Only render .js files here
|
2019-03-01 20:51:13 +01:00
|
|
|
if (!/\.js$/.exec(file)) {
|
2018-10-03 00:08:57 +02:00
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
return (
|
|
|
|
<script
|
|
|
|
key={file}
|
|
|
|
src={`${assetPrefix}/_next/${file}${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
async
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
static getInlineScriptSource(documentProps) {
|
|
|
|
const { __NEXT_DATA__ } = documentProps
|
2019-01-27 16:12:17 +01:00
|
|
|
try {
|
|
|
|
const data = JSON.stringify(__NEXT_DATA__)
|
|
|
|
return htmlEscapeJsonString(data)
|
2019-03-01 20:51:13 +01:00
|
|
|
} catch (err) {
|
|
|
|
if (err.message.indexOf('circular structure')) {
|
|
|
|
throw new Error(
|
|
|
|
`Circular structure in "getInitialProps" result of page "${
|
|
|
|
__NEXT_DATA__.page
|
|
|
|
}". https://err.sh/zeit/next.js/circular-structure`
|
|
|
|
)
|
2019-01-27 16:12:17 +01:00
|
|
|
}
|
|
|
|
throw err
|
|
|
|
}
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
staticMarkup,
|
|
|
|
assetPrefix,
|
|
|
|
amphtml,
|
|
|
|
devFiles,
|
|
|
|
__NEXT_DATA__,
|
|
|
|
} = this.context._documentProps
|
2019-02-03 01:12:49 +01:00
|
|
|
const { _devOnlyInvalidateCacheQueryString } = this.context
|
2019-02-14 16:22:57 +01:00
|
|
|
|
2019-02-25 23:00:14 +01:00
|
|
|
if (amphtml) {
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
const devFiles = [
|
|
|
|
CLIENT_STATIC_FILES_RUNTIME_AMP,
|
|
|
|
CLIENT_STATIC_FILES_RUNTIME_WEBPACK,
|
|
|
|
]
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{staticMarkup ? null : (
|
|
|
|
<script
|
|
|
|
id="__NEXT_DATA__"
|
|
|
|
type="application/json"
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: NextScript.getInlineScriptSource(
|
|
|
|
this.context._documentProps
|
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{devFiles
|
|
|
|
? devFiles.map(file => (
|
|
|
|
<script
|
|
|
|
key={file}
|
|
|
|
src={`${assetPrefix}/_next/${file}${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
))
|
|
|
|
: null}
|
|
|
|
</>
|
|
|
|
)
|
2019-02-14 16:22:57 +01:00
|
|
|
}
|
|
|
|
|
2018-10-10 21:58:15 +02:00
|
|
|
const { page, buildId } = __NEXT_DATA__
|
2018-10-03 00:08:57 +02:00
|
|
|
|
2018-12-13 01:05:21 +01:00
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
2019-03-01 20:51:13 +01:00
|
|
|
if (this.props.crossOrigin)
|
|
|
|
console.warn(
|
|
|
|
'Warning: `NextScript` attribute `crossOrigin` is deprecated. https://err.sh/next.js/doc-crossorigin-deprecated'
|
|
|
|
)
|
2018-12-13 01:05:21 +01:00
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{devFiles
|
|
|
|
? devFiles.map(file => (
|
|
|
|
<script
|
|
|
|
key={file}
|
|
|
|
src={`${assetPrefix}/_next/${file}${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
))
|
|
|
|
: null}
|
|
|
|
{staticMarkup ? null : (
|
|
|
|
<script
|
|
|
|
id="__NEXT_DATA__"
|
|
|
|
type="application/json"
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: NextScript.getInlineScriptSource(
|
|
|
|
this.context._documentProps
|
|
|
|
),
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{page !== '/_error' && (
|
|
|
|
<script
|
|
|
|
async
|
|
|
|
id={`__NEXT_PAGE__${page}`}
|
|
|
|
src={`${assetPrefix}/_next/static/${buildId}/pages${getPagePathname(
|
|
|
|
page
|
|
|
|
)}${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<script
|
|
|
|
async
|
|
|
|
id={`__NEXT_PAGE__/_app`}
|
|
|
|
src={`${assetPrefix}/_next/static/${buildId}/pages/_app.js${_devOnlyInvalidateCacheQueryString}`}
|
|
|
|
nonce={this.props.nonce}
|
|
|
|
crossOrigin={this.props.crossOrigin || process.crossOrigin}
|
|
|
|
/>
|
|
|
|
{staticMarkup ? null : this.getDynamicChunks()}
|
|
|
|
{staticMarkup ? null : this.getScripts()}
|
|
|
|
</>
|
|
|
|
)
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-01 20:51:13 +01:00
|
|
|
function getPagePathname(page) {
|
2018-10-10 21:58:15 +02:00
|
|
|
if (page === '/') {
|
2018-10-03 00:08:57 +02:00
|
|
|
return '/index.js'
|
|
|
|
}
|
|
|
|
|
2018-10-10 21:58:15 +02:00
|
|
|
return `${page}.js`
|
2018-10-03 00:08:57 +02:00
|
|
|
}
|