starshard/peafowl
Template
1
Fork 0
mirror of https://github.com/starshardstudio/peafowl.git synced 2024-11-24 05:54:19 +00:00
peafowl/_config.ts

203 lines
4.5 KiB
TypeScript
Raw Permalink Normal View History

2024-06-16 11:49:13 +00:00
import {default as lume} from "lume/mod.ts";
import {default as jsx} from "lume/plugins/jsx.ts"
import {default as feed} from "lume/plugins/feed.ts"
import fileData from "./_plugins/fileData.ts"
import Site from "lume/core/site.ts";
2024-06-16 11:49:13 +00:00
2024-11-21 04:28:20 +00:00
let location: URL | undefined = undefined
try {
location = new URL("") // TODO: Enter the base URL of your website here, or links won't work!
}
catch (e) {
if(e instanceof TypeError) {
// pass safely
}
else {
throw e
}
}
const site: Site = lume({
2024-06-16 11:49:13 +00:00
prettyUrls: false,
2024-11-21 04:28:20 +00:00
location,
2024-06-16 11:49:13 +00:00
})
2024-11-21 04:28:20 +00:00
export default site
2024-06-16 11:49:13 +00:00
site.use(jsx({}))
site.copy("_static")
site.data("styles", ["/_static/styles/base.css"])
site.data("lang", "en")
site.data("date", "Git Created")
2024-06-16 11:49:13 +00:00
2024-11-21 04:28:20 +00:00
/*===== list of lists =====*/
2024-06-16 11:49:13 +00:00
site.data("layout", "index.tsx", "/index.md")
site.data("tags", ["index"], "/index.md")
site.use(fileData({
query: "index",
urlizer(data) {
return data.url.replace(".html", ".json")
},
contentizer(data) {
return JSON.stringify({
title: data.title,
subtitle: data.subtitle,
lists: site.search.pages("list").map((data) => data.url.replace(".html", ".json"))
2024-06-16 11:49:13 +00:00
})
}
}))
2024-11-05 12:45:08 +00:00
2024-11-21 04:28:20 +00:00
/*===== list of all reviews =====*/
site.data("url", "/all/index.html", "/list-all.md")
site.data("layout", "list-all.tsx", "/list-all.md")
site.data("tags", ["list", "list-all"], "/list-all.md")
site.use(fileData({
query: "list-all",
urlizer(_data) {
return "/all/index.json"
},
contentizer(data) {
return JSON.stringify({
content: data.content,
items: site.search.pages("review").map((data) => data.url.replace(".html", ".json"))
})
}
}))
site.use(feed({
output: ["/all/feed.rss", "/all/feed.json"],
query: "review",
limit: 10,
info: {
title: "Reviews", // TODO: Change this to your site's videogame section's name!
},
items: {
title: "=name"
}
}))
/*===== list of games =====*/
site.data("url", "/games/index.html", "/list-games.md")
site.data("layout", "list-games.tsx", "/list-games.md")
site.data("tags", ["list", "list-games"], "/list-games.md")
2024-06-16 11:49:13 +00:00
site.use(fileData({
query: "list-games",
urlizer(_data) {
2024-06-16 11:49:13 +00:00
return "/games/index.json"
},
contentizer(data) {
return JSON.stringify({
content: data.content,
items: site.search.pages("game").map((data) => data.url.replace(".html", ".json"))
2024-06-16 11:49:13 +00:00
})
}
}))
2024-11-05 12:45:08 +00:00
2024-11-21 04:28:20 +00:00
site.use(feed({
output: ["/games/feed.rss", "/games/feed.json"],
query: "game",
limit: 10,
info: {
title: "Videogames", // TODO: Change this to your site's videogame section's name!
},
items: {
title: "=name"
}
}))
/*===== game =====*/
site.data("layout", "game.tsx", "/games")
site.data("tags", ["review", "game"], "/games")
2024-06-16 11:49:13 +00:00
site.use(fileData({
query: "game",
urlizer(data) {
return data.url.replace(".html", ".json")
},
contentizer(data) {
return JSON.stringify({
name: data.name ?? null,
2024-11-05 12:45:08 +00:00
name_sort: data.name_sort ?? null,
2024-06-16 11:49:13 +00:00
rating: data.rating ?? null,
content: data.content ?? null,
active: data.active ?? null,
progress: data.progress ?? null,
hours_played: data.hours_played ?? null,
purchased_on: data.purchased_on ?? null,
started_on: data.started_on ?? null,
beaten_on: data.beaten_on ?? null,
completed_on: data.completed_on ?? null,
mastered_on: data.mastered_on ?? null,
identifiers: data.identifiers ?? null,
})
}
}))
2024-11-05 12:45:08 +00:00
2024-11-21 04:28:20 +00:00
/*===== list of anime =====*/
2024-11-05 12:45:08 +00:00
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.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"))
})
}
}))
2024-11-21 04:28:20 +00:00
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"
}
}))
/*===== anime =====*/
site.data("layout", "anime.tsx", "/anime")
site.data("tags", ["review", "anime"], "/anime")
2024-11-05 12:45:08 +00:00
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,
})
}
}))