Use Gatby's new link prefixing format.

This commit is contained in:
Kyle Mathews 2015-11-21 16:59:25 -08:00
parent 1043f18f0c
commit 8f1b58c801
3 changed files with 8 additions and 13 deletions

View file

@ -1,3 +1,3 @@
blogTitle = "My Awesome Blog" blogTitle = "My Awesome Blog"
authorName = "Kyle Mathews" authorName = "Kyle Mathews"
ghPagesURLPrefix = "/gatsby-starter-blog" linkPrefix = "/gatsby-starter-blog"

View file

@ -1,21 +1,16 @@
import React from 'react'; import React from 'react';
import Typography from 'typography'; import Typography from 'typography';
import DocumentTitle from 'react-document-title'; import DocumentTitle from 'react-document-title';
import { link } from 'gatsby-helpers'
let TypographyStyle = new Typography().TypographyStyle; import { TypographyStyle } from 'utils/typography'
export default class Html extends React.Component { export default class Html extends React.Component {
render() { render() {
let title, urlPrefix; let title;
title = DocumentTitle.rewind(); title = DocumentTitle.rewind();
if (this.props.title) { if (this.props.title) {
title = 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 ( return (
<html lang="en"> <html lang="en">
@ -46,7 +41,7 @@ export default class Html extends React.Component {
</head> </head>
<body className="landing-page"> <body className="landing-page">
<div id="react-mount" dangerouslySetInnerHTML={{__html: this.props.body}} /> <div id="react-mount" dangerouslySetInnerHTML={{__html: this.props.body}} />
<script src={urlPrefix + "/bundle.js"}/> <script src={link("/bundle.js")}/>
</body> </body>
</html> </html>
); );

View file

@ -21,7 +21,7 @@ export default class extends React.Component {
for (i = 0, len = ref.length; i < len; i++) { for (i = 0, len = ref.length; i < len; i++) {
page = ref[i]; page = ref[i];
title = ((ref1 = page.data) != null ? ref1.title : void 0) || page.path; 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( pageLinks.push(
<li <li
key={page.path} key={page.path}
@ -29,7 +29,7 @@ export default class extends React.Component {
marginBottom: rhythm(1/4) marginBottom: rhythm(1/4)
}} }}
> >
<Link to={page.path}>{title}</Link> <Link to={link(page.path)}>{title}</Link>
</li> </li>
); );
} }