-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Din
authored
Jan 24, 2024
1 parent
3629aae
commit cf1d138
Showing
11 changed files
with
924 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
import { getCollection } from 'astro:content' | ||
|
||
export async function getCategories() { | ||
const posts = await getCollection('blog') | ||
|
||
const categories = [...new Set([].concat.apply(posts.map((post) => post.data.category)))] | ||
|
||
return categories | ||
} | ||
|
||
export async function getPosts() { | ||
const posts = (await getCollection('blog')).sort( | ||
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(), | ||
) | ||
|
||
return posts | ||
} | ||
|
||
export async function getPostsByCategory(category: string) { | ||
const posts = (await getCollection('blog')) | ||
.filter((post) => post.data.category === category) | ||
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()) | ||
|
||
return posts | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"$schema": "https://unpkg.com/knip@4/schema.json", | ||
"workspaces": { | ||
"@api": { | ||
"entry": ["core/*.{ts,tsx}"], | ||
"project": "**/*.{ts,tsx}" | ||
}, | ||
"@content": { | ||
"entry": ["pages/**/*.{ts,tsx,astro}", "content/**/*.{ts,md,mdx}"], | ||
"project": "**/*.{ts,tsx,astro}" | ||
}, | ||
"@extension": { | ||
"entry": [ | ||
"background/index.ts", | ||
"content/*.ts", | ||
"popup/main.tsx", | ||
"popup/pages/*.tsx", | ||
"sidepanel/main.tsx", | ||
"sidepanel/pages/*.tsx", | ||
"vite.config.ts" | ||
], | ||
"project": "**/*.{ts,tsx,astro}", | ||
"vite": false | ||
}, | ||
"@web": { | ||
"entry": ["core/*.{ts,tsx}", "pages/*.tsx", "components/ui/**.{ts,tsx}"], | ||
"project": "**/*.{ts,tsx}" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.