Skip to content

Commit 1be688c

Browse files
Enclose post list in <ul> and <a> in <Link>
1 parent afa2e28 commit 1be688c

File tree

2 files changed

+42
-37
lines changed

2 files changed

+42
-37
lines changed

web/pages/index.js

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -140,43 +140,47 @@ function Index({
140140
/>
141141

142142
<h2>Posts:</h2>
143-
{sortObjProperties(postsToRender, 'manual_pub_date').map(
144-
({
145-
_id,
146-
_createdAt,
147-
manual_pub_date,
148-
description,
149-
slug,
150-
title,
151-
tags
152-
}) => (
153-
<Link
154-
href='/posts/[slug]'
155-
as={`/posts/${slug.current}`}
156-
key={_id}
157-
>
158-
<PostContainer key={_id} tabIndex="0">
159-
<Title>{title}</Title>
160-
<Description>{description}</Description>
161-
<Date>
162-
{manual_pub_date
163-
? moment.utc(manual_pub_date).format("LL")
164-
: moment.utc(_createdAt).format("LL")
165-
}
166-
</Date>
167-
<ul>
168-
{sortObjProperties(tags, 'name').map(tag => {
169-
return (
170-
<TagListItem key={tag._id}>
171-
{tag.name}
172-
</TagListItem>
173-
)
174-
})}
175-
</ul>
176-
</PostContainer>
177-
</Link>
178-
)
179-
)}
143+
<ul>
144+
{sortObjProperties(postsToRender, 'manual_pub_date').map(
145+
({
146+
_id,
147+
_createdAt,
148+
manual_pub_date,
149+
description,
150+
slug,
151+
title,
152+
tags
153+
}) => (
154+
<Link
155+
href='/posts/[slug]'
156+
as={`/posts/${slug.current}`}
157+
key={_id}
158+
>
159+
<a>
160+
<PostContainer key={_id} tabIndex="0">
161+
<Title>{title}</Title>
162+
<Description>{description}</Description>
163+
<Date>
164+
{manual_pub_date
165+
? moment.utc(manual_pub_date).format("LL")
166+
: moment.utc(_createdAt).format("LL")
167+
}
168+
</Date>
169+
<ul>
170+
{sortObjProperties(tags, 'name').map(tag => {
171+
return (
172+
<TagListItem key={tag._id}>
173+
{tag.name}
174+
</TagListItem>
175+
)
176+
})}
177+
</ul>
178+
</PostContainer>
179+
</a>
180+
</Link>
181+
)
182+
)}
183+
</ul>
180184
</Layout>
181185
)
182186
}

web/pages/posts/[slug].js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ function Post(props) {
359359
postContent.push(
360360
<UL key={listGroupKey}>{list}</UL>
361361
)
362+
// Clear list tracking variables so that subsequent lists will render correctly:
362363
list = []
363364
listGroupKey = ''
364365
}

0 commit comments

Comments
 (0)