|
|
@@ -1,6 +1,40 @@
|
|
|
---
|
|
|
+import articles from "feeds.js";
|
|
|
+
|
|
|
import Nav from "@components/nav.astro";
|
|
|
+import Sidebar from "@components/sidebar.astro";
|
|
|
import Layout from "@layouts/layout.astro";
|
|
|
+import Article from "@components/article.astro";
|
|
|
+
|
|
|
+import Parser from "rss-parser";
|
|
|
+
|
|
|
+let parser = new Parser();
|
|
|
+
|
|
|
+let { cat } = Astro.params;
|
|
|
+
|
|
|
+cat = !cat ? "/" : cat;
|
|
|
+
|
|
|
+const catagory: string | undefined = Object.keys(articles).find(
|
|
|
+ (catagory) => articles[catagory as keyof typeof articles].path == cat,
|
|
|
+);
|
|
|
+
|
|
|
+const feedList = articles[catagory as keyof typeof articles].feeds;
|
|
|
+
|
|
|
+console.log(feedList);
|
|
|
---
|
|
|
|
|
|
-<Layout> <Nav /> </Layout>
|
|
|
+<Layout>
|
|
|
+ <Nav {cat} {articles} />
|
|
|
+ <Sidebar {catagory} {articles} {parser} />
|
|
|
+
|
|
|
+ {
|
|
|
+ feedList.map(async (feed) =>
|
|
|
+ (await parser.parseURL(feed)).items.forEach((item) => {
|
|
|
+ {
|
|
|
+ console.log(item.title);
|
|
|
+ }
|
|
|
+ <Article article={item} />;
|
|
|
+ }),
|
|
|
+ )
|
|
|
+ }
|
|
|
+</Layout>
|