Skip to content

Commit

Permalink
inlining return value of getCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
yuheiy committed Jul 9, 2024
1 parent 6c3fe46 commit 1ef8b8a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/pages/blog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { renderDateToHtml } from '../lib/render-date-to-html';
const title = 'ブログ';
const entries = await getCollection('blog');
const items = await Promise.all(
entries
(await getCollection('blog'))
.toSorted((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf())
.map(async (entry) => {
const description = await getBlogDescription(entry);
Expand Down
3 changes: 1 addition & 2 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ const projectItems = [
},
] satisfies DetailsListItem[];
const entries = await getCollection('blog');
const latestBlogItems = await Promise.all(
entries
(await getCollection('blog'))
.toSorted((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf())
.slice(0, 3)
.map(async (entry) => ({
Expand Down
3 changes: 1 addition & 2 deletions src/pages/rss.xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ export async function GET(context: APIContext) {

const renderers = await loadRenderers([getContainerRenderer()]);
const container = await AstroContainer.create({ renderers });
const entries = await getCollection('blog');
const items = await Promise.all(
entries
(await getCollection('blog'))
.toSorted((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf())
.map(async (entry) => ({
link: `/${entry.slug}`,
Expand Down

0 comments on commit 1ef8b8a

Please sign in to comment.