@@ -13,6 +13,8 @@ import Header from "../../../components/Header";
1313import Footer from "../../../components/Footer";
1414import Post from "../../../components/ecosystem/Post";
1515import { getAllPosts, getPostBySlug } from "../../../lib/lib";
16+import fs from "fs";
17+import path from "path";
1618
1719export default function BasicPage({ post, markdown, search, index = false }) {
1820 const router = useRouter();
@@ -46,8 +48,47 @@ export async function getStaticProps({ params }) {
4648 ["title", "slug", "date", "featured-1", "featured-2", "featured-3"],
4749 "ecosystem/spotlight"
4850 );
51+ const marketplaces = getAllPosts(["title", "image", "slug"], "marketplaces");
52+ const podcasts = getAllPosts(
53+ ["title", "image", "date", "podcast", "slug"],
54+ "podcasts",
55+ "date"
56+ );
57+ const organizations = getAllPosts(
58+ ["title", "image", "slug"],
59+ "organizations"
60+ );
61+ const applications = fs
62+ .readdirSync(path.join(process.cwd(), "content/applications"), {
63+ withFileTypes: true,
64+ })
65+ .filter((f) => f.isDirectory())
66+ .map((dir) =>
67+ getAllPosts(
68+ ["title", "bgColor", "image", "slug", "description"],
69+ `applications/${dir.name}`
70+ )
71+ .map((e) => ({ ...e, ship: dir.name }))
72+ .flat()
73+ )
74+ .flat()
75+ .sort((a, b) => {
76+ const nameA = a.title.toLowerCase();
77+ const nameB = b.title.toLowerCase();
78+ return nameA < nameB ? -1 : 1;
79+ });
80+
4981 ["featured-1", "featured-2", "featured-3"].forEach((feat) => {
5082 if (post?.[feat]) {
83+ const matchedPost = [
84+ ...applications.map((e) => ({ ...e, type: "Application" })),
85+ ...organizations.map((e) => ({ ...e, type: "Organization" })),
86+ ...podcasts.map((e) => ({ ...e, type: "Podcast" })),
87+ ...marketplaces.map((e) => ({ ...e, type: "Marketplace" })),
88+ ].filter((e) => e.title === post[feat].title)?.[0];
89+ post[feat].image = post[feat]?.image || matchedPost?.image || null;
90+ post[feat].type = matchedPost?.type || "Podcast";
91+ post[feat].matchedPost = matchedPost || null;
5192 post[feat].content = JSON.stringify(
5293 Markdown.parse({
5394 post: { content: post[feat].content },