docs icon indicating copy to clipboard operation
docs copied to clipboard

content-collections: Add example to render list of contents

Open tordans opened this issue 1 year ago • 2 comments

Description (required)

I was looking all over for an example on how to use the render() function to render a list of blog posts like on any old WordPress index page.

It turns out, one can just pass the Content component in a custom object and render this as <Content/> just like always.

I think it would be great to mention this somewhere. I cannot be the only one searching for this? :-D.

Please feel free to change this PR as you see fit.

=> This is the section in the preview

Related issues & labels (optional)

./.

tordans avatar May 21 '24 09:05 tordans

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview May 22, 2024 2:26pm

vercel[bot] avatar May 21 '24 09:05 vercel[bot]

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en guides/content-collections.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

astrobot-houston avatar May 21 '24 09:05 astrobot-houston

We've discussed this PR and don't think this fits our needs in that section, which is only meant to show the functions used, and not the various ways in which they can be used. So I'll be closing this PR, but thank you as always for contributing! 🙌

sarah11918 avatar Jun 14 '24 19:06 sarah11918

@sarah11918 thank you for your feedback. Can you help me understand where in the docs I can find information on how to render a list of full posts like I would do with any WordPress side? In case I am right and there is none, do you consider it a trivial thing to find out by oneself … or do you consider it a non-relevant use case for Astro to render full lists of content?

tordans avatar Jun 14 '24 20:06 tordans

Reverse ping https://github.com/withastro/docs/issues/10317 which will show how to create a list of content for RSS.

tordans avatar Dec 09 '24 16:12 tordans