Skip to content

Commit 553766c

Browse files
committed
Switch to render from astro:content instead of entry.render
Step 4 from https://docs.astro.build/en/guides/upgrade-to/v5/#updating-existing-collections > Switch to the new render() function. Entries no longer have a render() method, as they are now serializable plain objects. Instead, import the render() function from astro:content.
1 parent e1e5cb5 commit 553766c

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/components/pages/download/DownloadAccordion.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { getCollection } from 'astro:content';
2+
import { getCollection, render } from 'astro:content';
33
44
const { family = 'nix' } = Astro.props;
55
const accordionId = `download-${family}-accordion`;
@@ -13,7 +13,7 @@ let downloadOptions = (await getCollection('download')).filter(
1313
<div class="download-accordion-menu">
1414
{
1515
downloadOptions.map(async (option) => {
16-
const { Content } = await option.render();
16+
const { Content } = await render(option);
1717
const needsInstallInfix =
1818
option.data.family === 'nix' && option.data.platform !== 'more';
1919
const optionId = `${option.data.family}-${needsInstallInfix ? 'install-' : ''}${option.data.platform}`;

src/pages/blog/[category]/[year]/[id].astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { getCollection } from 'astro:content';
2+
import { getCollection, render } from 'astro:content';
33
import Container from '../../../../components/layout/Container.astro';
44
import PageHeader from '../../../../components/layout/PageHeader.astro';
55
import Layout from '../../../../layouts/Layout.astro';
@@ -17,7 +17,7 @@ export async function getStaticPaths() {
1717
}
1818
1919
const { entry } = Astro.props;
20-
const { Content } = await entry.render();
20+
const { Content } = await render(entry);
2121
---
2222

2323
<Layout title=`${entry.data.title} | Blog`>

src/pages/community/teams/[...slug].astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { getCollection } from 'astro:content';
2+
import { getCollection, render } from 'astro:content';
33
44
import Container from '../../../components/layout/Container.astro';
55
import PageHeader from '../../../components/layout/PageHeader.astro';
@@ -15,7 +15,7 @@ export async function getStaticPaths() {
1515
}
1616
1717
const { entry } = Astro.props;
18-
const { Content } = await entry.render();
18+
const { Content } = await render(entry);
1919
---
2020

2121
<Layout title={entry.data.name}>

src/pages/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { getCollection, getEntry } from 'astro:content';
2+
import { getCollection, getEntry, render } from 'astro:content';
33
import Container from '../components/layout/Container.astro';
44
import Button from '../components/ui/Button.astro';
55
import NixosSearchInput from '../components/ui/NixosSearchInput.astro';
@@ -77,7 +77,7 @@ posts
7777
<Container class="grid gap-8 md:grid-cols-3 md:gap-4">
7878
{
7979
landingFeatures.map(async (feature) => {
80-
const { Content } = await feature.render();
80+
const { Content } = await render(feature);
8181
return (
8282
<div class="flex flex-col text-center">
8383
<InlineSVG

src/pages/learn.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { getCollection } from 'astro:content';
2+
import { getCollection, render } from 'astro:content';
33
import Container from '../components/layout/Container.astro';
44
import Divider from '../components/layout/Divider.astro';
55
import PageHeader from '../components/layout/PageHeader.astro';
@@ -96,7 +96,7 @@ const learningResources = [
9696
<Container class="grid items-start gap-4 py-16 md:grid-cols-3">
9797
{
9898
learningManuals.map(async (manual) => {
99-
const { Content } = await manual.render();
99+
const { Content } = await render(manual);
100100
return (
101101
<div class="border-0.5 border-nix-blue-darker flex flex-col items-center justify-start gap-4 rounded-2xl p-4">
102102
<article>

0 commit comments

Comments
 (0)