first commit
This commit is contained in:
6
e2e/fixture/src/live.config.ts
Normal file
6
e2e/fixture/src/live.config.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { defineLiveCollection } from "astro:content";
|
||||
import { emdashLoader } from "emdash/runtime";
|
||||
|
||||
export const collections = {
|
||||
_emdash: defineLiveCollection({ loader: emdashLoader() }),
|
||||
};
|
||||
21
e2e/fixture/src/pages/index.astro
Normal file
21
e2e/fixture/src/pages/index.astro
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
import { getEmDashCollection } from "emdash";
|
||||
const { entries: posts } = await getEmDashCollection("posts");
|
||||
---
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<h1>Posts</h1>
|
||||
<ul id="post-list">
|
||||
{
|
||||
posts.map((p) => (
|
||||
<li>
|
||||
<a href={`/posts/${p.id}`}>{p.data.title}</a>
|
||||
{p.data.excerpt && <span class="excerpt">{p.data.excerpt}</span>}
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
{posts.length === 0 && <p id="empty">No posts</p>}
|
||||
</body>
|
||||
</html>
|
||||
21
e2e/fixture/src/pages/posts/[slug].astro
Normal file
21
e2e/fixture/src/pages/posts/[slug].astro
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
import { getEmDashEntry } from "emdash";
|
||||
import { PortableText, Comments, CommentForm } from "emdash/ui";
|
||||
|
||||
const { slug } = Astro.params;
|
||||
if (!slug) return Astro.redirect("/404");
|
||||
const { entry: post } = await getEmDashEntry("posts", slug);
|
||||
if (!post) return new Response("Not found", { status: 404 });
|
||||
---
|
||||
|
||||
<html>
|
||||
<body>
|
||||
<article>
|
||||
<h1 id="title">{post.data.title}</h1>
|
||||
{post.data.excerpt && <p id="excerpt">{post.data.excerpt}</p>}
|
||||
<div id="body"><PortableText value={post.data.body} /></div>
|
||||
</article>
|
||||
<Comments collection="posts" contentId={post.data.id} threaded />
|
||||
<CommentForm collection="posts" contentId={post.data.id} />
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user