Skip to content

Commit 8a1cb68

Browse files
committed
fix: improve author and date display formatting in blog posts
1 parent a929fef commit 8a1cb68

File tree

4 files changed

+39
-20
lines changed

4 files changed

+39
-20
lines changed

website/src/content/blog-posts/trieve-is-being-acquired-by-mintlify/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ summary: >-
66
author: Nicholas Khami
77
createdAt: 2025-07-16T21:28:00.000Z
88
lastUpdatedAt: 2025-07-16T21:28:00.000Z
9-
isDraft: true
9+
isDraft: false
1010
categories:
1111
- announcements
1212
- news

website/src/content/singles/blog/index.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ featuredPosts:
55
title: |
66
*Featured* posts
77
posts:
8-
- build-agentic-rag-for-any-pdf-in-10-minutes-with-chunkr-and-trieve
9-
- ai-sales-agent-on-shopify-flaviar
10-
- cheating-at-search-with-llms
8+
- trieve-is-being-acquired-by-mintlify
119
furtherReadingsTitle: |
1210
Further *readings*

website/src/pages/blog/[slug]/index.astro

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,33 @@ const ogImage = new URL(i18n.coverImage.src, site).href;
6666
<p class="md:flex-1/2 text-xl max-w-[40ch]">{i18n.summary}</p>
6767

6868
{
69-
i18n.author || i18n.lastUpdatedAt || i18n.createdAt ? (
70-
<p class="text-black">
71-
{i18n.author ? `Written by ${i18n.author}.` : null}
72-
{i18n.lastUpdatedAt
73-
? `${i18n.lastUpdatedAt.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`
69+
(i18n.author || i18n.lastUpdatedAt || i18n.createdAt) && (
70+
<div class="flex flex-wrap items-center gap-2 text-sm text-gray-700">
71+
{i18n.author && (
72+
<span class="font-medium">{`Written by ${i18n.author}`}</span>
73+
)}
74+
{(i18n.lastUpdatedAt || i18n.createdAt) && (
75+
<>
76+
<span class="mx-1 text-gray-400">•</span>
77+
<span>
78+
{(i18n.lastUpdatedAt
79+
? i18n.lastUpdatedAt
7480
: i18n.createdAt
75-
? `${i18n.createdAt.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`
76-
: null}
77-
</p>
78-
) : null
81+
)
82+
? (i18n.lastUpdatedAt
83+
? i18n.lastUpdatedAt
84+
: i18n.createdAt
85+
)?.toLocaleDateString("en-US", {
86+
month: "short",
87+
day: "numeric",
88+
year: "numeric",
89+
})
90+
: ""}
91+
</span>
92+
</>
93+
)}
94+
</div>
95+
)
7996
}
8097

8198
<div class="flex flex-row gap-2">

website/src/pages/rss.xml.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ export async function GET(context) {
1111
description:
1212
"Sell more and answer every question with Conversational Discovery. Trieve uses GenAI to show your users what they're looking for every time",
1313
site: context.site,
14-
items: blog.map((post) => ({
15-
link: `/blog/${post.id}/`,
16-
content: sanitizeHtml(parser.render(post.body), {
17-
allowedTags: sanitizeHtml.defaults.allowedTags.concat(["img"]),
18-
}),
19-
...post.data,
20-
})),
14+
items: blog
15+
.filter((post) => !(post.data.isDraft ?? false))
16+
.sort((a, b) => new Date(b.data.date) - new Date(a.data.date))
17+
.map((post) => ({
18+
link: `/blog/${post.id}/`,
19+
content: sanitizeHtml(parser.render(post.body), {
20+
allowedTags: sanitizeHtml.defaults.allowedTags.concat(["img"]),
21+
}),
22+
pubDate: post.data.lastUpdatedAt,
23+
...post.data,
24+
})),
2125
customData: `<language>en-us</language>`,
2226
});
2327
}

0 commit comments

Comments
 (0)