starshard/peafowl
Template
1
Fork 0
mirror of https://github.com/starshardstudio/peafowl.git synced 2024-11-21 20:44:19 +00:00

Add generators for anime pages

This commit is contained in:
Steffo 2024-11-05 13:45:08 +01:00
parent a479d15993
commit 918e51e030
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -20,6 +20,7 @@ site.data("date", "Git Created")
site.data("layout", "index.tsx", "/index.md") site.data("layout", "index.tsx", "/index.md")
site.data("tags", ["index"], "/index.md") site.data("tags", ["index"], "/index.md")
site.data("url", "/games/index.html", "/list-games.md") site.data("url", "/games/index.html", "/list-games.md")
site.data("layout", "list-games.tsx", "/list-games.md") site.data("layout", "list-games.tsx", "/list-games.md")
site.data("tags", ["list", "list-games"], "/list-games.md") site.data("tags", ["list", "list-games"], "/list-games.md")
@ -40,6 +41,7 @@ site.use(fileData({
}) })
} }
})) }))
site.use(fileData({ site.use(fileData({
query: "list-games", query: "list-games",
urlizer(_data) { urlizer(_data) {
@ -52,6 +54,7 @@ site.use(fileData({
}) })
} }
})) }))
site.use(fileData({ site.use(fileData({
query: "game", query: "game",
urlizer(data) { urlizer(data) {
@ -60,6 +63,7 @@ site.use(fileData({
contentizer(data) { contentizer(data) {
return JSON.stringify({ return JSON.stringify({
name: data.name ?? null, name: data.name ?? null,
name_sort: data.name_sort ?? null,
rating: data.rating ?? null, rating: data.rating ?? null,
content: data.content ?? null, content: data.content ?? null,
active: data.active ?? null, active: data.active ?? null,
@ -74,6 +78,7 @@ site.use(fileData({
}) })
} }
})) }))
site.use(feed({ site.use(feed({
output: ["/games/feed.rss", "/games/feed.json"], output: ["/games/feed.rss", "/games/feed.json"],
query: "game", query: "game",
@ -86,4 +91,60 @@ site.use(feed({
} }
})) }))
site.data("url", "/anime/index.html", "/list-anime.md")
site.data("layout", "list-anime.tsx", "/list-anime.md")
site.data("tags", ["list", "list-anime"], "/list-anime.md")
site.data("layout", "anime.tsx", "/anime")
site.data("tags", ["review", "anime"], "/anime")
site.use(fileData({
query: "list-anime",
urlizer(_data) {
return "/anime/index.json"
},
contentizer(data) {
return JSON.stringify({
content: data.content,
items: site.search.pages("anime").map((data) => data.url.replace(".html", ".json"))
})
}
}))
site.use(fileData({
query: "anime",
urlizer(data) {
return data.url.replace(".html", ".json")
},
contentizer(data) {
return JSON.stringify({
name: data.name ?? null,
name_sort: data.name_sort ?? null,
name_original: data.name_original ?? null,
rating: data.rating ?? null,
content: data.content ?? null,
active: data.active ?? null,
progress: data.progress ?? null,
started_on: data.started_on ?? null,
completed_on: data.completed_on ?? null,
mastered_on: data.mastered_on ?? null,
identifiers: data.identifiers ?? null,
})
}
}))
site.use(feed({
output: ["/anime/feed.rss", "/anime/feed.json"],
query: "anime",
limit: 10,
info: {
title: "Anime", // TODO: Change this to your site's anime section's name!
},
items: {
title: "=name"
}
}))
export default site; export default site;