1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-01-03 18:35:07 +01:00
This commit is contained in:
Matthias Kretschmann 2018-09-27 22:33:01 +02:00
parent b705afb7e9
commit 2278dfa3db
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 10 additions and 11 deletions

View File

@ -9,15 +9,11 @@ const PostLead = ({ post, index }) => {
const content = post.html const content = post.html
const separator = '<!-- more -->' const separator = '<!-- more -->'
if (post.frontmatter.type === 'post') {
if (content.includes(separator)) { if (content.includes(separator)) {
lead = content.split(separator)[0] lead = content.split(separator)[0]
} else { } else {
lead = content.split('\n')[0] lead = content.split('\n')[0]
} }
} else {
return null
}
return ( return (
<div <div

View File

@ -31,7 +31,7 @@ const Post = ({ data, location }) => {
<article className={styles.hentry}> <article className={styles.hentry}>
<PostTitle type={type} linkurl={linkurl} title={title} /> <PostTitle type={type} linkurl={linkurl} title={title} />
<PostLead post={post} /> {type === 'post' && <PostLead post={post} />}
{image && ( {image && (
<PostImage fluid={image.childImageSharp.fluid} alt={title} /> <PostImage fluid={image.childImageSharp.fluid} alt={title} />
)} )}

View File

@ -37,9 +37,12 @@ const Posts = ({ data, location, pageContext }) => {
</Link> </Link>
)} )}
{type === 'post' && <PostLead post={node} index />} {type === 'post' && (
<Fragment>
{type === 'post' && <PostMore to={slug}>Continue Reading</PostMore>} <PostLead post={node} index />
<PostMore to={slug}>Continue Reading</PostMore>
</Fragment>
)}
{type === 'link' && ( {type === 'link' && (
<Fragment> <Fragment>