Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions layouts/Post/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ export default function PostLayout({
readingTime,
children,
}) {
const { authors = [], date, category } = metadata;

// `basename` is the slug (filename without extension), matching the listing.
const index = posts.findIndex(post => post.slug === metadata.basename);
const current = posts[index];
const { authors = [], date, category } = current;
const next = index > 0 ? posts[index - 1] : undefined;
const previous = index >= 0 ? posts[index + 1] : undefined;

Expand Down
Loading