diff options
author | 2022-12-16 19:22:01 +0000 | |
---|---|---|
committer | 2022-12-16 19:22:01 +0000 | |
commit | 04feb4b88290a3059f80e588473daafbfea9a3fd (patch) | |
tree | 5652c76d6846cd5d186c50df8f0d51ba42709471 /examples/with-content/src/pages/blog | |
parent | 5ec0f6ed55b0a14a9663a90a03428345baf126bd (diff) | |
download | astro-04feb4b88290a3059f80e588473daafbfea9a3fd.tar.gz astro-04feb4b88290a3059f80e588473daafbfea9a3fd.tar.zst astro-04feb4b88290a3059f80e588473daafbfea9a3fd.zip |
[ci] format
Diffstat (limited to 'examples/with-content/src/pages/blog')
-rw-r--r-- | examples/with-content/src/pages/blog/[...slug].astro | 6 | ||||
-rw-r--r-- | examples/with-content/src/pages/blog/index.astro | 28 |
2 files changed, 18 insertions, 16 deletions
diff --git a/examples/with-content/src/pages/blog/[...slug].astro b/examples/with-content/src/pages/blog/[...slug].astro index c8e86c487..0d656a153 100644 --- a/examples/with-content/src/pages/blog/[...slug].astro +++ b/examples/with-content/src/pages/blog/[...slug].astro @@ -1,10 +1,10 @@ --- -import { CollectionEntry, getCollection } from "astro:content"; -import BlogPost from "../../layouts/BlogPost.astro"; +import { CollectionEntry, getCollection } from 'astro:content'; +import BlogPost from '../../layouts/BlogPost.astro'; export async function getStaticPaths() { const posts = await getCollection('blog'); - return posts.map(post => ({ + return posts.map((post) => ({ params: { slug: post.slug }, props: post, })); diff --git a/examples/with-content/src/pages/blog/index.astro b/examples/with-content/src/pages/blog/index.astro index e4f769f8a..c46f23dea 100644 --- a/examples/with-content/src/pages/blog/index.astro +++ b/examples/with-content/src/pages/blog/index.astro @@ -7,7 +7,7 @@ import { getCollection } from 'astro:content'; const posts = (await getCollection('blog')).sort( (a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf() -) +); --- <!DOCTYPE html> @@ -37,18 +37,20 @@ const posts = (await getCollection('blog')).sort( <main> <section> <ul> - {posts.map((post) => ( - <li> - <time datetime={post.data.pubDate.toISOString()}> - {post.data.pubDate.toLocaleDateString('en-us', { - year: 'numeric', - month: 'short', - day: 'numeric', - })} - </time> - <a href={'/blog/' + post.slug}>{post.data.title}</a> - </li> - ))} + { + posts.map((post) => ( + <li> + <time datetime={post.data.pubDate.toISOString()}> + {post.data.pubDate.toLocaleDateString('en-us', { + year: 'numeric', + month: 'short', + day: 'numeric', + })} + </time> + <a href={'/blog/' + post.slug}>{post.data.title}</a> + </li> + )) + } </ul> </section> </main> |