diff --git a/data/comment-only.json b/data/comment-only.json deleted file mode 100644 index 450d397b..00000000 --- a/data/comment-only.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "tdor" -] \ No newline at end of file diff --git a/data/exclude.json b/data/exclude.json deleted file mode 100644 index 0637a088..00000000 --- a/data/exclude.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/data/hdata.json b/data/hdata.json new file mode 100644 index 00000000..dd05ece3 --- /dev/null +++ b/data/hdata.json @@ -0,0 +1,7 @@ +{ + "commentOnly": [ + "tdor" + ], + "exclude": [], + "notShowOnHome": [] +} \ No newline at end of file diff --git a/people/SS3B_0016/comments/2024-04-05-C17100.json b/people/SS3B_0016/comments/2024-04-05-C17100.json new file mode 100644 index 00000000..bd476533 --- /dev/null +++ b/people/SS3B_0016/comments/2024-04-05-C17100.json @@ -0,0 +1 @@ +{"id":17100,"content":"晚安","submitter":"Catht","date":"Apr 5, 2024"} \ No newline at end of file diff --git a/scripts/build.ts b/scripts/build.ts index e590e3ae..a5cab8ee 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -8,7 +8,7 @@ import metadataParser from 'markdown-yaml-metadata-parser'; import { renderMdx } from "./mdx.js"; import moment from "moment"; -import { Icon } from "./icon.js"; +import { Icon, backSVG } from "./icon.js"; const PUBLIC_DIR = "public"; @@ -27,8 +27,16 @@ const people = fs.readdirSync(peopleDir).map(person => ({ distPath: path.join(projectRoot, DIST_DIR, PEOPLE_DIR, person) })); -const commentOnlyList = JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, "comment-only.json")).toString()) as String[]; -const excludeList = commentOnlyList.concat(JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, 'exclude.json')).toString()) as String[]); +interface HData { + commentOnly: string[] + exclude: string[] + notShowOnHome: string[] +} + +const hdata = JSON.parse(fs.readFileSync(path.join(projectRoot, DATA_DIR, "hdata.json")).toString()) as HData; +const commentOnlyList = hdata.commentOnly; +const excludeList = commentOnlyList.concat(hdata.exclude); +const notShowOnHomeList = hdata.notShowOnHome; interface PeopleMeta { id: string @@ -49,6 +57,7 @@ function buildPeopleInfoAndList() { // Compiled meta of list of people for the front page (contains keys id, name, profileUrl) const peopleList: PeopleMeta[] = []; + const peopleHomeList: PeopleMeta[] = []; // For each person for (const { dirname, srcPath, distPath } of people) { @@ -110,14 +119,19 @@ function buildPeopleInfoAndList() { } as PeopleMeta; // Add meta to people list - if (peopleList.filter(it => it.id == peopleMeta.id).length == 0) + if (peopleList.filter(it => it.id == peopleMeta.id).length == 0) { peopleList.push(peopleMeta); + if (!notShowOnHomeList.includes(peopleMeta.id)) + peopleHomeList.push(peopleMeta) + } } peopleList.sort((a, b) => b.sortKey.localeCompare(a.sortKey)) + peopleHomeList.sort((a, b) => b.sortKey.localeCompare(a.sortKey)) // Write people-list.json fs.writeFileSync(path.join(projectRoot, DIST_DIR, `people-list${lang}.json`), JSON.stringify(peopleList)); + fs.writeFileSync(path.join(projectRoot, DIST_DIR, `people-home-list${lang}.json`), JSON.stringify(peopleHomeList)); } } @@ -157,7 +171,7 @@ function handleFootnote(md: string) { // Replace footnote references with HTML superscript tags return md.replace(/\[\^(\d+)\](?::\s*(.*))?/g, (match, id, text) => text ? // Footnote definition - `
  • ${text}
  • ` : + `
  • ${text}${backSVG}
  • ` : // Footnote reference `${id}` ) diff --git a/scripts/icon.ts b/scripts/icon.ts index 8ddeaccc..a4f1f136 100644 --- a/scripts/icon.ts +++ b/scripts/icon.ts @@ -8,4 +8,6 @@ export const Icon = { Annotation: ``, TransFlag: ``, Pride: ``, -}; \ No newline at end of file +}; + +export const backSVG = ` ` \ No newline at end of file