summaryrefslogtreecommitdiff
path: root/examples/starlog/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/starlog/src')
-rw-r--r--examples/starlog/src/content.config.ts3
-rw-r--r--examples/starlog/src/pages/index.astro6
-rw-r--r--examples/starlog/src/pages/releases/[slug].astro6
3 files changed, 9 insertions, 6 deletions
diff --git a/examples/starlog/src/content.config.ts b/examples/starlog/src/content.config.ts
index 5cc4c697f..26986525a 100644
--- a/examples/starlog/src/content.config.ts
+++ b/examples/starlog/src/content.config.ts
@@ -1,6 +1,9 @@
+import { glob } from 'astro/loaders';
import { defineCollection, z } from 'astro:content';
const releases = defineCollection({
+ // Load Markdown files in the src/content/releases directory.
+ loader: glob({ base: './src/content/releases', pattern: '**/*.md' }),
// Type-check frontmatter using a schema
schema: ({ image }) =>
z.object({
diff --git a/examples/starlog/src/pages/index.astro b/examples/starlog/src/pages/index.astro
index b7e6ea0f5..3cf04af62 100644
--- a/examples/starlog/src/pages/index.astro
+++ b/examples/starlog/src/pages/index.astro
@@ -1,5 +1,5 @@
---
-import { getCollection } from 'astro:content';
+import { getCollection, render } from 'astro:content';
import FormattedDate from '../components/FormattedDate.astro';
import Layout from '../layouts/IndexLayout.astro';
@@ -17,14 +17,14 @@ posts.sort((a, b) => +b.data.date - +a.data.date);
<li class="post">
<div class="version_wrapper">
<div class="version_info">
- <a href={`/releases/${post.slug}`}>
+ <a href={`/releases/${post.id}`}>
<div class="version_number">{post.data.versionNumber}</div>
<FormattedDate class="date" date={post.data.date} />
</a>
</div>
</div>
<div class="content">
- {post.render().then(({ Content }) => (
+ {render(post).then(({ Content }) => (
<Content />
))}
</div>
diff --git a/examples/starlog/src/pages/releases/[slug].astro b/examples/starlog/src/pages/releases/[slug].astro
index 88fa74d3c..8c3119a8f 100644
--- a/examples/starlog/src/pages/releases/[slug].astro
+++ b/examples/starlog/src/pages/releases/[slug].astro
@@ -1,19 +1,19 @@
---
-import { getCollection } from 'astro:content';
+import { getCollection, render } from 'astro:content';
import Layout from '../../layouts/PostLayout.astro';
export async function getStaticPaths() {
const releases = await getCollection('releases');
return releases.map((release) => ({
- params: { slug: release.slug },
+ params: { slug: release.id },
props: { release },
}));
}
const { release } = Astro.props;
-const { Content } = await release.render();
+const { Content } = await render(release);
---
<Layout {release}>