1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 17:23:50 +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,14 +9,10 @@ const PostLead = ({ post, index }) => {
const content = post.html
const separator = '<!-- more -->'
if (post.frontmatter.type === 'post') {
if (content.includes(separator)) {
lead = content.split(separator)[0]
} else {
lead = content.split('\n')[0]
}
if (content.includes(separator)) {
lead = content.split(separator)[0]
} else {
return null
lead = content.split('\n')[0]
}
return (

View File

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

View File

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