summaryrefslogtreecommitdiff
path: root/examples/portfolio/src
diff options
context:
space:
mode:
authorGravatar Fred K. Schott <fkschott@gmail.com> 2021-07-21 07:11:57 -0700
committerGravatar GitHub <noreply@github.com> 2021-07-21 07:11:57 -0700
commitf67e8f5f559ecb37db71fbea1b60b570bc6bfd47 (patch)
tree21678a7af13c256bf8c7fa8b539cbf7c3765ea38 /examples/portfolio/src
parent5fcd466d95f9694a758239d254e3d81f4ed289fa (diff)
downloadastro-f67e8f5f559ecb37db71fbea1b60b570bc6bfd47.tar.gz
astro-f67e8f5f559ecb37db71fbea1b60b570bc6bfd47.tar.zst
astro-f67e8f5f559ecb37db71fbea1b60b570bc6bfd47.zip
New Collections API (#703)
* updated createCollection API * Update examples/portfolio/src/pages/projects.astro Co-authored-by: Caleb Jasik <calebjasik@jasik.xyz> * Update docs/reference/api-reference.md Co-authored-by: Caleb Jasik <calebjasik@jasik.xyz> * fix(docs): collection doc typos (#758) * keep cleaning up docs and adding tests Co-authored-by: Caleb Jasik <calebjasik@jasik.xyz> Co-authored-by: Mark Pinero <markspinero@gmail.com>
Diffstat (limited to 'examples/portfolio/src')
-rw-r--r--examples/portfolio/src/pages/projects.astro (renamed from examples/portfolio/src/pages/$projects.astro)15
1 files changed, 4 insertions, 11 deletions
diff --git a/examples/portfolio/src/pages/$projects.astro b/examples/portfolio/src/pages/projects.astro
index 60f2ac84f..6da3b423f 100644
--- a/examples/portfolio/src/pages/$projects.astro
+++ b/examples/portfolio/src/pages/projects.astro
@@ -4,16 +4,9 @@ import Footer from '../components/Footer/index.jsx';
import Nav from '../components/Nav/index.jsx';
import PortfolioPreview from '../components/PortfolioPreview/index.jsx';
-let { collection } = Astro.props;
-export async function createCollection() {
- return {
- async data() {
- const projects = Astro.fetchContent('./project/*.md');
- projects.sort((a, b) => new Date(b.published_at) - new Date(a.published_at));
- return projects.filter(({ published_at }) => !!published_at);
- }
- }
-}
+const projects = Astro.fetchContent('./project/*.md')
+ .filter(({ published_at }) => !!published_at)
+ .sort((a, b) => new Date(b.published_at) - new Date(a.published_at));
---
<html lang="en">
@@ -31,7 +24,7 @@ export async function createCollection() {
<div class="wrapper">
<h1 class="title mt4 mb4">All Projects</h1>
<div class="grid">
- {collection.data.map((project) => (
+ {projects.map((project) => (
<PortfolioPreview project={project} />
))}
</div>