diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/pages/index.tsx | 7 | ||||
| -rw-r--r-- | src/pages/releases/[version].tsx | 6 | ||||
| -rw-r--r-- | src/pages/releases/feed.ts | 7 | ||||
| -rw-r--r-- | src/pages/releases/index.tsx | 7 | ||||
| -rw-r--r-- | src/pages/sitemap.ts | 4 | ||||
| -rw-r--r-- | src/ui/base/BaseLayout.tsx | 23 | ||||
| -rw-r--r-- | src/ui/components/SiteFooter.tsx | 2 |
7 files changed, 25 insertions, 31 deletions
diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 0ade408..52d54e2 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx | |||
| @@ -10,10 +10,9 @@ import { Heading } from "$/ui/objects/Heading.tsx"; | |||
| 10 | import { Icon } from "$/ui/objects/Icon.tsx"; | 10 | import { Icon } from "$/ui/objects/Icon.tsx"; |
| 11 | import site from "@/corvos.config.ts"; | 11 | import site from "@/corvos.config.ts"; |
| 12 | 12 | ||
| 13 | export const template = site.$.template({ type: "home" }, (page, pages) => { | 13 | export const template = site.$.template({ type: "home" }, async (page, pages) => { |
| 14 | const query = site.$.query(pages); | 14 | const releasesIndex = await pages.type(".html").match({ type: "releases-index" }).one(); |
| 15 | const releasesIndex = query.type(".html").match({ type: "releases-index" }).one(); | 15 | const releases = await pages.type(".html").match({ type: "release" }).array(); |
| 16 | const releases = query.type(".html").match({ type: "release" }).many().toArray(); | ||
| 17 | 16 | ||
| 18 | return ( | 17 | return ( |
| 19 | <BaseLayout page={page} pages={pages}> | 18 | <BaseLayout page={page} pages={pages}> |
diff --git a/src/pages/releases/[version].tsx b/src/pages/releases/[version].tsx index 16f1ba5..35a9834 100644 --- a/src/pages/releases/[version].tsx +++ b/src/pages/releases/[version].tsx | |||
| @@ -31,10 +31,8 @@ export const pages = site.$.pageGenerator(async function* () { | |||
| 31 | } | 31 | } |
| 32 | }); | 32 | }); |
| 33 | 33 | ||
| 34 | export const template = site.$.template({ type: "release" }, (page, pages) => { | 34 | export const template = site.$.template({ type: "release" }, async (page, pages) => { |
| 35 | const query = site.$.query(pages); | 35 | const feed = await pages.type(".rss").match({ type: "releases" }).one(); |
| 36 | |||
| 37 | const feed = query.type(".rss").match({ type: "releases" }).one(); | ||
| 38 | 36 | ||
| 39 | return ( | 37 | return ( |
| 40 | <SplitLayout | 38 | <SplitLayout |
diff --git a/src/pages/releases/feed.ts b/src/pages/releases/feed.ts index b430ca5..46070b1 100644 --- a/src/pages/releases/feed.ts +++ b/src/pages/releases/feed.ts | |||
| @@ -2,12 +2,11 @@ import type { FeedItem } from "corvos/plugins/feeds.ts"; | |||
| 2 | 2 | ||
| 3 | import site from "@/corvos.config.ts"; | 3 | import site from "@/corvos.config.ts"; |
| 4 | 4 | ||
| 5 | export const feeds = site.$.feedGenerator(function* (pages) { | 5 | export const feeds = site.$.feedGenerator(async function* (pages) { |
| 6 | const items = site.$.query(pages) | 6 | const items = await pages |
| 7 | .match({ type: "release" }) | 7 | .match({ type: "release" }) |
| 8 | .many() | ||
| 9 | .take(20) | 8 | .take(20) |
| 10 | .map( | 9 | .array( |
| 11 | (page): FeedItem => ({ | 10 | (page): FeedItem => ({ |
| 12 | title: page.data.title, | 11 | title: page.data.title, |
| 13 | url: page.url, | 12 | url: page.url, |
diff --git a/src/pages/releases/index.tsx b/src/pages/releases/index.tsx index 9e5a3db..30e4f5d 100644 --- a/src/pages/releases/index.tsx +++ b/src/pages/releases/index.tsx | |||
| @@ -9,10 +9,9 @@ import { Icon } from "$/ui/objects/Icon.tsx"; | |||
| 9 | import { PlaceholderBox } from "$/ui/objects/PlaceholderBox.tsx"; | 9 | import { PlaceholderBox } from "$/ui/objects/PlaceholderBox.tsx"; |
| 10 | import site from "@/corvos.config.ts"; | 10 | import site from "@/corvos.config.ts"; |
| 11 | 11 | ||
| 12 | export const template = site.$.template({ type: "releases-index" }, (page, pages) => { | 12 | export const template = site.$.template({ type: "releases-index" }, async (page, pages) => { |
| 13 | const query = site.$.query(pages); | 13 | const items = await pages.type(".html").match({ type: "release" }).array(); |
| 14 | const items = query.type(".html").match({ type: "release" }).many().toArray(); | 14 | const feed = await pages.type(".rss").match({ type: "releases" }).one(); |
| 15 | const feed = query.type(".rss").match({ type: "releases" }).one(); | ||
| 16 | 15 | ||
| 17 | return ( | 16 | return ( |
| 18 | <BaseLayout page={page} pages={pages}> | 17 | <BaseLayout page={page} pages={pages}> |
diff --git a/src/pages/sitemap.ts b/src/pages/sitemap.ts index 378a9ed..7aadf5e 100644 --- a/src/pages/sitemap.ts +++ b/src/pages/sitemap.ts | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | import site from "@/corvos.config.ts"; | 1 | import site from "@/corvos.config.ts"; |
| 2 | 2 | ||
| 3 | export const sitemap = site.$.sitemap((pages) => ({ | 3 | export const sitemap = site.$.sitemap(async (pages) => ({ |
| 4 | items: pages.map((page) => ({ | 4 | items: await pages.array((page) => ({ |
| 5 | loc: page.url, | 5 | loc: page.url, |
| 6 | lastmod: page.data.modifiedAt, | 6 | lastmod: page.data.modifiedAt, |
| 7 | })), | 7 | })), |
diff --git a/src/ui/base/BaseLayout.tsx b/src/ui/base/BaseLayout.tsx index 2fb999d..617bb99 100644 --- a/src/ui/base/BaseLayout.tsx +++ b/src/ui/base/BaseLayout.tsx | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | // @ts-types="corvos/mod.ts" | 1 | import type { Query } from "corvos/mod.ts"; |
| 2 | |||
| 2 | import { getGenerator, type Select } from "corvos/mod.ts"; | 3 | import { getGenerator, type Select } from "corvos/mod.ts"; |
| 3 | 4 | ||
| 4 | import site from "@/corvos.config.ts"; | 5 | import site from "@/corvos.config.ts"; |
| @@ -9,7 +10,7 @@ import { Lightbox } from "../objects/Lightbox.tsx"; | |||
| 9 | 10 | ||
| 10 | export interface Props { | 11 | export interface Props { |
| 11 | page: Select<typeof site, ".html">; | 12 | page: Select<typeof site, ".html">; |
| 12 | pages: readonly Select<typeof site>[]; | 13 | pages: Query<Select<typeof site>>; |
| 13 | image?: string; | 14 | image?: string; |
| 14 | theme?: "l1" | "l2" | null; | 15 | theme?: "l1" | "l2" | null; |
| 15 | children?: JSX.Element; | 16 | children?: JSX.Element; |
| @@ -24,17 +25,15 @@ export const BaseLayout = async ({ | |||
| 24 | children, | 25 | children, |
| 25 | class: cls, | 26 | class: cls, |
| 26 | }: Props) => { | 27 | }: Props) => { |
| 27 | const query = site.$.query(pages); | 28 | const stylesheet = await site.load("styles/style.scss").one(); |
| 28 | 29 | const script = await site.load("scripts/script.ts").one(); | |
| 29 | const stylesheet = await site.load("styles/style.scss"); | 30 | const fonts = await site.glob("assets/**.woff2").array(); |
| 30 | const script = await site.load("scripts/script.ts"); | 31 | const favicon = await site.load("assets/favicon.svg").one(); |
| 31 | const fonts = await site.glob("assets/**.woff2"); | 32 | const image = await site |
| 32 | const favicon = await site.load("assets/favicon.svg"); | 33 | .load(imageUrl ?? "https://strapi.volpeon.ink/uploads/icon_7999cf625e.png") |
| 33 | const image = await site.load( | 34 | .one(); |
| 34 | imageUrl ?? "https://strapi.volpeon.ink/uploads/icon_7999cf625e.png", | ||
| 35 | ); | ||
| 36 | 35 | ||
| 37 | const feeds = query.type(".rss").many(); | 36 | const feeds = await pages.type(".rss").array(); |
| 38 | 37 | ||
| 39 | return ( | 38 | return ( |
| 40 | <> | 39 | <> |
diff --git a/src/ui/components/SiteFooter.tsx b/src/ui/components/SiteFooter.tsx index 8bada2e..9accfbe 100644 --- a/src/ui/components/SiteFooter.tsx +++ b/src/ui/components/SiteFooter.tsx | |||
| @@ -5,7 +5,7 @@ import { Divider } from "../objects/Divider.tsx"; | |||
| 5 | import { Logo } from "./Logo.tsx"; | 5 | import { Logo } from "./Logo.tsx"; |
| 6 | 6 | ||
| 7 | export const SiteFooter = async () => { | 7 | export const SiteFooter = async () => { |
| 8 | const symbols = await site.load("assets/symbols.svg"); | 8 | const symbols = await site.load("assets/symbols.svg").one(); |
| 9 | 9 | ||
| 10 | return ( | 10 | return ( |
| 11 | <footer class="c-site-footer"> | 11 | <footer class="c-site-footer"> |
