Fix titles to posts

This commit is contained in:
Kyle Mathews 2015-07-22 13:27:21 -07:00
parent 2286041789
commit a896447db1
3 changed files with 36 additions and 24 deletions

View file

@ -1,15 +1,23 @@
React = require 'react' React = require 'react'
Typography = require 'typography' Typography = require 'typography'
DocumentTitle = require 'react-document-title'
typography = new Typography() typography = new Typography()
{TypographyStyle} = typography {TypographyStyle} = typography
module.exports = React.createClass module.exports = React.createClass
getDefaultProps: -> getDefaultProps: ->
title: "Default title"
body: "" body: ""
render: -> render: ->
title = DocumentTitle.rewind()
if @props.title then title = @props.title
if __GH_PAGES__? and __GH_PAGES__
urlPrefix = @props.config.ghPagesURLPrefix
else
urlPrefix = ""
<html lang="en"> <html lang="en">
<head> <head>
<meta charSet="utf-8"/> <meta charSet="utf-8"/>
@ -36,6 +44,6 @@ module.exports = React.createClass
</head> </head>
<body className="landing-page"> <body className="landing-page">
<div id="react-mount" dangerouslySetInnerHTML={{__html: @props.body}} /> <div id="react-mount" dangerouslySetInnerHTML={{__html: @props.body}} />
<script src="/bundle.js"/> <script src={urlPrefix + "/bundle.js"}/>
</body> </body>
</html> </html>

View file

@ -2,6 +2,7 @@ React = require 'react'
Router = require 'react-router' Router = require 'react-router'
{RouteHandler, Link} = Router {RouteHandler, Link} = Router
sortBy = require 'lodash/collection/sortBy' sortBy = require 'lodash/collection/sortBy'
DocumentTitle = require 'react-document-title'
{link} = require 'gatsby-helpers' {link} = require 'gatsby-helpers'
module.exports = React.createClass module.exports = React.createClass
@ -26,25 +27,27 @@ module.exports = React.createClass
</li> </li>
) )
<div> <DocumentTitle title="#{@props.config.blogTitle}">
<p <div>
style={{ <p
marginBottom: rhythm(2.5)
}}
>
<img
src="./kyle-round-small-pantheon.jpg"
style={{ style={{
float: 'left' marginBottom: rhythm(2.5)
marginRight: rhythm(1/4)
marginBottom: 0
width: rhythm(2)
height: rhythm(2)
}} }}
/> >
Written by <strong>{@props.config.authorName}</strong> who lives and works in San Francisco building useful things. <a href="https://twitter.com/kylemathews">You should follow him on Twitter</a> <img
</p> src="./kyle-round-small-pantheon.jpg"
<ul> style={{
{pageLinks} float: 'left'
</ul> marginRight: rhythm(1/4)
</div> marginBottom: 0
width: rhythm(2)
height: rhythm(2)
}}
/>
Written by <strong>{@props.config.authorName}</strong> who lives and works in San Francisco building useful things. <a href="https://twitter.com/kylemathews">You should follow him on Twitter</a>
</p>
<ul>
{pageLinks}
</ul>
</div>
</DocumentTitle>

View file

@ -2,6 +2,7 @@ React = require 'react'
require '../css/zenburn.css' require '../css/zenburn.css'
moment = require 'moment' moment = require 'moment'
DocumentTitle = require 'react-document-title' DocumentTitle = require 'react-document-title'
{link} = require 'gatsby-helpers'
ReadNext = require '../components/ReadNext' ReadNext = require '../components/ReadNext'
@ -12,7 +13,7 @@ module.exports = React.createClass
{rhythm} = @props.typography {rhythm} = @props.typography
post = @props.page.data post = @props.page.data
<DocumentTitle title="Name of blog | #{post.title}"> <DocumentTitle title="#{post.title} | #{@props.config.blogTitle}">
<div className="markdown"> <div className="markdown">
<h1>{post.title}</h1> <h1>{post.title}</h1>
<div dangerouslySetInnerHTML={{__html: post.body}}/> <div dangerouslySetInnerHTML={{__html: post.body}}/>
@ -32,7 +33,7 @@ module.exports = React.createClass
<ReadNext post={post} {...@props}/> <ReadNext post={post} {...@props}/>
<p> <p>
<img <img
src="/kyle-round-small-pantheon.jpg" src={link("/kyle-round-small-pantheon.jpg")}
style={{ style={{
float: 'left' float: 'left'
marginRight: rhythm(1/4) marginRight: rhythm(1/4)