@@ -5,23 +5,33 @@ import { config } from 'config'; // eslint-disable-line
55import { TweetThis , FacebookShare } from '../components/Social' ;
66import ReadNext from '../components/ReadNext' ;
77import Bio from '../components/Bio' ;
8- import { isBlogPost , getBlogPosts , getNextPosts , getPostsFromPaths } from '../utils/blog-helpers' ;
8+ import {
9+ isBlogPost ,
10+ getBlogPosts ,
11+ getNextPosts ,
12+ getPostsFromPaths
13+ } from '../utils/blog-helpers' ;
914import avatar from '../../images/avatar.jpg' ;
1015
1116import '../css/tomorrow-night.css' ;
1217
1318export default class MarkdownWrapper extends Component {
1419 render ( ) {
1520 const { route } = this . props ;
16- const { page : { data : post } } = route ;
17- const path = post . path = route . path ;
18- const thumbnail = post . thumbnail ? `https://yuppi.es${ path } ${ post . thumbnail } ` : `https://yuppi.es/${ avatar } ` ;
21+ const {
22+ page : { data : post }
23+ } = route ;
24+ const path = ( post . path = route . path ) ;
25+ const thumbnail = post . thumbnail
26+ ? `https://yuppi.es${ path } ${ post . thumbnail } `
27+ : `https://yuppi.es/${ avatar } ` ;
1928 const posts = getBlogPosts ( route ) ;
2029
2130 if ( isBlogPost ( post ) ) {
2231 const docTitle = `${ post . title } - ${ config . blogTitle } ` ;
23- const nextPosts = post . readNext ? getPostsFromPaths ( post . readNext , posts )
24- : getNextPosts ( path , posts ) ;
32+ const nextPosts = post . readNext
33+ ? getPostsFromPaths ( post . readNext , posts )
34+ : getNextPosts ( path , posts ) ;
2535 return (
2636 < section className = 'content' >
2737 < Helmet
@@ -31,8 +41,14 @@ export default class MarkdownWrapper extends Component {
3141 { property : 'og:type' , content : 'article' } ,
3242 { property : 'og:title' , content : docTitle } ,
3343 { property : 'og:image' , content : thumbnail } ,
34- { property : 'article:author' , content : 'https://facebook.com/f0rr0' } ,
35- { property : 'article:published_time' , content : `${ moment ( post . date , 'MM/DD/YYYY' ) . format ( ) } ` } ,
44+ {
45+ property : 'article:author' ,
46+ content : 'https://facebook.com/f0rr0'
47+ } ,
48+ {
49+ property : 'article:published_time' ,
50+ content : `${ moment ( post . date , 'MM/DD/YYYY' ) . format ( ) } `
51+ } ,
3652 { name : 'twitter:description' , content : post . description } ,
3753 { name : 'twitter:title' , content : docTitle }
3854 ] }
@@ -41,15 +57,25 @@ export default class MarkdownWrapper extends Component {
4157 < header className = 'blog-header' >
4258 < h2 > { post . title } </ h2 >
4359 < div >
44- < time > { moment ( post . date , 'MM/DD/YYYY' ) . format ( 'MMMM D, YYYY' ) } </ time > · { post . words } words · { post . readTime }
60+ < time >
61+ { moment ( post . date , 'MM/DD/YYYY' ) . format ( 'MMMM D, YYYY' ) }
62+ </ time > { ' ' }
63+ · { post . words } words · { post . readTime }
4564 </ div >
4665 </ header >
47- < div className = 'post-content' dangerouslySetInnerHTML = { { __html : post . body } } />
66+ < div
67+ className = 'post-content'
68+ dangerouslySetInnerHTML = { { __html : post . body } }
69+ />
4870 </ article >
4971 < aside className = 'post-footer' >
5072 < ul >
51- < li > < TweetThis { ...post } /> </ li >
52- < li > < FacebookShare { ...post } /> </ li >
73+ < li >
74+ < TweetThis { ...post } />
75+ </ li >
76+ < li >
77+ < FacebookShare { ...post } />
78+ </ li >
5379 </ ul >
5480 < ReadNext posts = { nextPosts } />
5581 < hr />
@@ -67,20 +93,27 @@ export default class MarkdownWrapper extends Component {
6793 { name : 'description' , content : config . description } ,
6894 { property : 'og:type' , content : 'article' } ,
6995 { property : 'og:title' , content : post . title } ,
70- { property : 'article:author' , content : 'https://facebook.com/f0rr0' } ,
71- { property : 'article:published_time' , content : `${ moment ( post . date , 'MM/DD/YYYY' ) . format ( ) } ` } ,
96+ {
97+ property : 'article:author' ,
98+ content : 'https://facebook.com/f0rr0'
99+ } ,
100+ {
101+ property : 'article:published_time' ,
102+ content : `${ moment ( post . date , 'MM/DD/YYYY' ) . format ( ) } `
103+ } ,
72104 { name : 'twitter:description' , content : config . description } ,
73105 { name : 'twitter:title' , content : post . title }
74106 ] }
75107 />
76- {
77- post . title ?
78- < header >
79- < h2 > { post . title } </ h2 >
80- </ header >
81- : null
82- }
83- < div className = 'post-content' dangerouslySetInnerHTML = { { __html : post . body } } />
108+ { post . title ? (
109+ < header >
110+ < h2 > { post . title } </ h2 >
111+ </ header >
112+ ) : null }
113+ < div
114+ className = 'post-content'
115+ dangerouslySetInnerHTML = { { __html : post . body } }
116+ />
84117 </ section >
85118 ) ;
86119 }
0 commit comments