Use Gatby's new link prefixing format.
This commit is contained in:
parent
1043f18f0c
commit
8f1b58c801
3 changed files with 8 additions and 13 deletions
|
|
@ -1,3 +1,3 @@
|
|||
blogTitle = "My Awesome Blog"
|
||||
authorName = "Kyle Mathews"
|
||||
ghPagesURLPrefix = "/gatsby-starter-blog"
|
||||
linkPrefix = "/gatsby-starter-blog"
|
||||
|
|
|
|||
13
html.jsx
13
html.jsx
|
|
@ -1,21 +1,16 @@
|
|||
import React from 'react';
|
||||
import Typography from 'typography';
|
||||
import DocumentTitle from 'react-document-title';
|
||||
|
||||
let TypographyStyle = new Typography().TypographyStyle;
|
||||
import { link } from 'gatsby-helpers'
|
||||
import { TypographyStyle } from 'utils/typography'
|
||||
|
||||
export default class Html extends React.Component {
|
||||
render() {
|
||||
let title, urlPrefix;
|
||||
let title;
|
||||
title = DocumentTitle.rewind();
|
||||
if (this.props.title) {
|
||||
title = this.props.title;
|
||||
}
|
||||
if ((typeof __GH_PAGES__ !== "undefined" && __GH_PAGES__ !== null) && __GH_PAGES__) {
|
||||
urlPrefix = this.props.config.ghPagesURLPrefix;
|
||||
} else {
|
||||
urlPrefix = "";
|
||||
}
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
|
|
@ -46,7 +41,7 @@ export default class Html extends React.Component {
|
|||
</head>
|
||||
<body className="landing-page">
|
||||
<div id="react-mount" dangerouslySetInnerHTML={{__html: this.props.body}} />
|
||||
<script src={urlPrefix + "/bundle.js"}/>
|
||||
<script src={link("/bundle.js")}/>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default class extends React.Component {
|
|||
for (i = 0, len = ref.length; i < len; i++) {
|
||||
page = ref[i];
|
||||
title = ((ref1 = page.data) != null ? ref1.title : void 0) || page.path;
|
||||
if (page.path !== link("/") && !((ref2 = page.data) != null ? ref2.draft : void 0)) {
|
||||
if (page.path !== "/" && !((ref2 = page.data) != null ? ref2.draft : void 0)) {
|
||||
pageLinks.push(
|
||||
<li
|
||||
key={page.path}
|
||||
|
|
@ -29,7 +29,7 @@ export default class extends React.Component {
|
|||
marginBottom: rhythm(1/4)
|
||||
}}
|
||||
>
|
||||
<Link to={page.path}>{title}</Link>
|
||||
<Link to={link(page.path)}>{title}</Link>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
|
@ -61,4 +61,4 @@ export default class extends React.Component {
|
|||
</DocumentTitle>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue