Skip to content

Commit

Permalink
fix: make first posts that aren't featured take up feature slot. fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfisher committed Sep 29, 2024
1 parent eeaf956 commit bc0b3b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions site/src/components/list-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const Layout = ({ children, featured={}, slug}) => {
const excerpt = frontmatter.excerpt || fields.excerpt || featured?.excerpt || '';
const url = `/${pathDate(frontmatter.date)}/${frontmatter.slug}/`;

const {title, date} = frontmatter;
const {title, date, imageby} = frontmatter;
const featuredImage = frontmatter?.featureimage || null;
const {imageby} = frontmatter;
const featurePost = frontmatter.featured || false;

return (
<>
<Header featured='true' title={title} date={date}
<Header featured={featurePost} title={title} date={date}
excerpt={excerpt} url={url}
featuredimage={featuredImage} featuredImageBy={imageby}
smalltitle={frontmatter.small_title} largetitle={frontmatter.large_title}
Expand Down
1 change: 1 addition & 0 deletions site/src/templates/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function Template({ pageContext, data}) {
// get the first one from the list instead and shift it off the front of the
// main post list.
[featuredPost, ...filteredPosts] = posts?.edges;
featuredPost = featuredPost.node;
}

const pluralPosts = (filteredPosts?.length > 1) ? 'posts' : 'post';
Expand Down

0 comments on commit bc0b3b3

Please sign in to comment.