mirror of
https://github.com/tachiyomiorg/website.git
synced 2024-12-21 07:31:58 +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[];
|
declare const data: News[];
|
||||||
export { data };
|
export { data };
|
||||||
|
|
||||||
export default defineLoader({
|
export default createContentLoader("news/*.md", {
|
||||||
async load(): Promise<News[]> {
|
excerpt: true,
|
||||||
const articles = await createContentLoader("news/*.md", { excerpt: true }).load();
|
transform(articles) {
|
||||||
|
|
||||||
return articles
|
return articles
|
||||||
.filter(({ url }) => url !== "/news/")
|
.filter(({ url }) => url !== "/news/")
|
||||||
.map(
|
.map(
|
||||||
@ -26,5 +25,5 @@ export default defineLoader({
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.sort((a, b) => b.date.localeCompare(a.date));
|
.sort((a, b) => b.date.localeCompare(a.date));
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user