| 1 | const join = (...paths: string[]) => path.join(import.meta.dirname, ...paths); |
| 2 | |
| 3 | // Different sections of the website are split into their own folders. Acting as |
| 4 | // as separate codebases, they are hosted as one. This allows me to have |
| 5 | // sub-projects like the file viewer in 'file/', and the question answer system |
| 6 | // in 'q+a', but maintain clear boundaries. Each section can define |
| 7 | // configuration, pages, backend routes, and contain other files. |
| 8 | export const siteSections: sg.Section[] = [ |
| 9 | { root: join(".") }, |
| 10 | { root: join("q+a/") }, |
| 11 | { root: join("file-viewer/") }, |
| 12 | { root: join("friends/"), base: "/friends" }, |
| 13 | { root: join("blog/"), base: "/blog" }, |
| 14 | // { root: join("fiction/"), pageBase: "/fiction" }, |
| 15 | ]; |
| 16 | |
| 17 | // All backends are bundled. The backend named "backend" is run by "node run watch" |
| 18 | export const backends: string[] = [ |
| 19 | join("backend.ts"), |
| 20 | join("source-of-truth.ts"), |
| 21 | ]; |
| 22 | |
| 23 | export const meta: MetaTemplate = { |
| 24 | base: new URL("https://paperclover.net"), |
| 25 | generator: "clover sitegen 3; https://git.paperclover.net/clo/sitegen", |
| 26 | }; |
| 27 | |
| 28 | // Font subsets reduce bandwidth and protect against proprietary font theft. |
| 29 | const fontRoot = path.join(nasRoot, "Documents/Font"); |
| 30 | const ascii = { start: 0x20, end: 0x7E }; |
| 31 | const nonAscii: sg.FontRange[] = [ |
| 32 | { start: 0xC0, end: 0xFF }, |
| 33 | { start: 0x2190, end: 0x2193 }, |
| 34 | { start: 0xA0, end: 0xA8 }, |
| 35 | { start: 0xAA, end: 0xBF }, |
| 36 | { start: 0x2194, end: 0x2199 }, |
| 37 | { start: 0x100, end: 0x17F }, |
| 38 | 0xA9, |
| 39 | 0x2018, |
| 40 | 0x2019, |
| 41 | 0x201C, |
| 42 | 0x201D, |
| 43 | 0x2022, |
| 44 | ]; |
| 45 | const recursiveVars: sg.FontVars = { |
| 46 | WGHT: [400, 750], |
| 47 | SLNT: [-15, 0], |
| 48 | CASL: 0.25, |
| 49 | CRSV: 0.5, |
| 50 | MONO: 0, |
| 51 | }; |
| 52 | const recursiveVarsMono = { ...recursiveVars, MONO: 1 }; |
| 53 | const recursiveVarsQuestion: sg.FontVars = { |
| 54 | ...recursiveVars, |
| 55 | MONO: [0, 1], |
| 56 | WGHT: [400, 800], |
| 57 | }; |
| 58 | const recursiveVarsThin: sg.FontVars = { |
| 59 | ...recursiveVars, |
| 60 | MONO: [0, 1], |
| 61 | WGHT: 350, |
| 62 | }; |
| 63 | const layoutFeatures = ["numr", "dnom", "frac"]; |
| 64 | export const fonts: sg.Font[] = [ |
| 65 | { |
| 66 | name: "Recursive", |
| 67 | sources: [ |
| 68 | "Recursive_VF_1.085.ttf", |
| 69 | path.join(fontRoot, "/ArrowType/Recursive/Recursive_VF_1.085.ttf"), |
| 70 | "https://paperclover.net/file/_unlisted/Recursive_VF_1.085.ttf", |
| 71 | ], |
| 72 | subsets: [ |
| 73 | { |
| 74 | asset: "/recultramin.[ext]", |
| 75 | layoutFeatures, |
| 76 | vars: recursiveVars, |
| 77 | unicodes: ascii, |
| 78 | }, |
| 79 | { |
| 80 | asset: "/recmono.[ext]", |
| 81 | vars: recursiveVarsMono, |
| 82 | unicodes: ascii, |
| 83 | }, |
| 84 | { |
| 85 | asset: "/recqa.[ext]", |
| 86 | vars: recursiveVarsQuestion, |
| 87 | unicodes: ascii, |
| 88 | }, |
| 89 | { |
| 90 | asset: "/recexotic.[ext]", |
| 91 | vars: recursiveVarsQuestion, |
| 92 | unicodes: nonAscii, |
| 93 | }, |
| 94 | { |
| 95 | asset: "/recthin.[ext]", |
| 96 | vars: recursiveVarsThin, |
| 97 | unicodes: ascii, |
| 98 | }, |
| 99 | { |
| 100 | asset: "/recthin2.[ext]", |
| 101 | vars: recursiveVarsThin, |
| 102 | unicodes: nonAscii, |
| 103 | }, |
| 104 | ], |
| 105 | }, |
| 106 | { |
| 107 | name: "AT Name Sans Display Hairline", |
| 108 | sources: [ |
| 109 | "ATNameSansDisplay-Hairline.woff2", |
| 110 | path.join( |
| 111 | fontRoot, |
| 112 | "/ArrowType/AT Name Sans Display/ATNameSansDisplay-Hairline.woff2", |
| 113 | ), |
| 114 | ], |
| 115 | subsets: [ |
| 116 | { |
| 117 | asset: "/cydn_header.[ext]", |
| 118 | layoutFeatures, |
| 119 | unicodes: "cotlyedon", |
| 120 | }, |
| 121 | ], |
| 122 | }, |
| 123 | ]; |
| 124 | |
| 125 | import type * as sg from "#sitegen"; |
| 126 | import type { Template as MetaTemplate } from "@clo/lib/meta"; |
| 127 | import * as path from "node:path"; |
| 128 | import { nasRoot } from "./file-viewer/paths.ts"; |