mirror of
https://github.com/tachiyomiorg/website.git
synced 2024-10-31 23:15:05 +01:00
Rewrite the news data loading (#23)
This commit is contained in:
parent
1d1bf5fba9
commit
3e437da62d
@ -10,10 +10,9 @@ export interface News {
|
||||
declare const data: News[];
|
||||
export { data };
|
||||
|
||||
export default defineLoader({
|
||||
async load(): Promise<News[]> {
|
||||
const articles = await createContentLoader("news/*.md", { excerpt: true }).load();
|
||||
|
||||
export default createContentLoader("news/*.md", {
|
||||
excerpt: true,
|
||||
transform(articles) {
|
||||
return articles
|
||||
.filter(({ url }) => url !== "/news/")
|
||||
.map(
|
||||
@ -26,5 +25,5 @@ export default defineLoader({
|
||||
}
|
||||
)
|
||||
.sort((a, b) => b.date.localeCompare(a.date));
|
||||
},
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user