Skip to content

Commit 540d8c3

Browse files
committed
found the routing issue
1 parent 5b05552 commit 540d8c3

File tree

14 files changed

+58
-21
lines changed

14 files changed

+58
-21
lines changed

packages/astro-theme/components/ShowcaseList.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const props = Astro.props;
1414
const product = productFromUrl(Astro.url);
1515
1616
let projects = await getCollection("showcase", ({ data }) =>
17-
data?.tags?.includes(product.name)
17+
!product || data?.tags?.includes(product.name)
1818
);
1919
if (typeof props.limit == "number") {
2020
projects = projects.slice(0, props.limit);

packages/astro-theme/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ export default function ThemeIntegration(
9696
pattern: `${docsPrefix}/[...slug]`,
9797
entrypoint: "@leaningtech/astro-theme/pages/docs/[...slug].astro",
9898
});
99+
//routing for demos showcase
100+
params.injectRoute({
101+
pattern: "showcase",
102+
entrypoint: "@leaningtech/astro-theme/pages/showcase/index.astro",
103+
});
99104
params.updateConfig({
100105
markdown: {
101106
remarkPlugins: [[remarkObsidianCallout, {}]],

packages/astro-theme/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"./content": "./content.ts",
1111
"./tailwind": "./tailwind.ts",
1212
"./pages/blog/index.astro": "./pages/blog/index.astro",
13+
"./pages/showcase/index.astro": "./pages/showcase/index.astro",
1314
"./pages/blog/[...slug].astro": "./pages/blog/[...slug].astro",
1415
"./pages/docs/index.astro": "./pages/docs/index.astro",
1516
"./pages/docs/404.astro": "./pages/docs/404.astro",
@@ -60,4 +61,4 @@
6061
},
6162
"author": "Leaning Technologies",
6263
"license": "Apache-2.0"
63-
}
64+
}

packages/astro-theme/pages/showcase/[...slug].astro

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import { CollectionEntry, getCollection } from "astro:content";
33
import BlogPost from "../../layouts/BlogPost.astro";
44
55
export async function getStaticPaths() {
6-
const posts = await getCollection("showcase");
7-
return posts.map((project) => ({
8-
params: { slug: project.slug },
9-
props: project,
6+
const posts = await getCollection("blog");
7+
return posts.map((post) => ({
8+
params: { slug: post.slug },
9+
props: post,
1010
}));
1111
}
12-
type Props = CollectionEntry<"showcase">;
12+
type Props = CollectionEntry<"blog">;
1313
14-
const project = Astro.props;
15-
const { Content, headings } = await project.render();
14+
const post = Astro.props;
15+
const { Content, headings } = await post.render();
1616
---
1717

18-
<BlogPost {...project.data} {headings} id={project.id}>
18+
<BlogPost {...post.data} {headings} id={post.id}>
1919
<Content />
2020
</BlogPost>

packages/astro-theme/pages/showcase/index.astro

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,29 @@ import Footer from "../../components/Footer.astro";
77
import BlogDoodle from "./blog-doodle.png";
88
import { productFromUrl } from "../../lib/products";
99
import ProductNav from "../../components/nav/product/Nav.astro";
10+
import type { CollectionEntry } from "astro:content";
1011
1112
const product = productFromUrl(Astro.url);
1213
13-
const [project1, project2, ...restProjects] = (
14+
type Props = CollectionEntry<"showcase">["data"] & {
15+
//redundant collection
16+
limit?: number;
17+
};
18+
const props = Astro.props;
19+
20+
let [project1, project2, ...restProjects] = (
1421
await getCollection(
1522
"showcase",
1623
({ data }) =>
17-
(!product || data?.tags?.includes(product.name))
18-
)
19-
);
24+
!product || data?.tags?.includes(product.name))
25+
);
26+
if (typeof props.limit == "number") {
27+
projects = projects.slice(0, props.limit);
28+
}
2029
---
21-
2230
<Shell
23-
title={`${product?.name ?? "Demo"} Showcase`}
24-
description="Read the latest updates from the Leaning Technologies development team about WebAssembly, compilers, and more."
31+
title={`${product?.name ?? "demo"} showcase`}
32+
description="Hall of fame for community and industry projects."
2533
>
2634
{product && <ProductNav {product} />}
2735
<header class="text-center text-stone-100 py-16">
@@ -36,11 +44,10 @@ const [project1, project2, ...restProjects] = (
3644
</div>
3745

3846
<h1 class="text-5xl font-semibold text-balance">
39-
{product?.name ?? "Engineering"} blog
47+
{product?.name ?? "demos"} showcase
4048
</h1>
4149
<p class="text-lg text-balance my-8 text-stone-400">
42-
News, technical writeups, and announcements directly from the development
43-
team.
50+
Hall of fame for community and industry projects.
4451
</p>
4552
<div
4653
class="bg-gradient-to-b from-primary-600 to-transparent opacity-20 w-full h-[40rem] absolute inset-0 -z-10"
@@ -71,4 +78,4 @@ const [project1, project2, ...restProjects] = (
7178
</section>
7279

7380
<Footer />
74-
</Shell>
81+
</Shell>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
title: HomeByME
2+
description: A home design application, compiled to the web with Cheerp.
3+
url: https://home.by.me/en/
4+
heroImage: ./homebyme.png
5+
tags:
6+
- Cheerp
242 KB
Loading
1.09 MB
Loading
84.8 KB
Loading
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
title: iText
2+
description: Edit PDFs fully client side using the industry standard iText library converted to JavaScript.
3+
url: https://cheerpjdemos.leaningtech.com/iTextDemo.html
4+
heroImage: ./itext.png
5+
tags:
6+
- CheerpJ

0 commit comments

Comments
 (0)