From bd2c535ceee5d3772036da9ffee0fedca509ee19 Mon Sep 17 00:00:00 2001 From: haetae Date: Tue, 25 Nov 2025 17:26:36 -0500 Subject: [PATCH] minor fixes --- src/assets/styles/reset.css | 12 ++++++++---- src/pages/fics/[ficId]/[chapterId].astro | 19 ++++++++++--------- src/pages/fics/[ficId]/index.astro | 4 ++-- src/pages/fics/[ficId]/rss.xml.ts | 2 +- src/utils/lastModified.mjs | 16 +++++----------- 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/assets/styles/reset.css b/src/assets/styles/reset.css index cc722cc..b80a2f8 100644 --- a/src/assets/styles/reset.css +++ b/src/assets/styles/reset.css @@ -1,9 +1,13 @@ *, *::before, *::after { box-sizing: border-box; } * { margin: 0; } -html, body { - height: 100vh; +body { width: 100vw; + min-height: 100vh; + + @supports (min-height: 100svh) { + min-height: 100svh; + } } body { line-height: calc(1em + 0.5rem); } @@ -15,5 +19,5 @@ img, picture, video, canvas, svg { input, button, textarea, select { font: inherit; } p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; } -p { text-wrap: pretty; } -h1, h2, h3, h4, h5, h6 { text-wrap: balance; } \ No newline at end of file +h1, h2, h3, h4, h5, h6 { text-wrap: balance; } +p { text-wrap: pretty; } \ No newline at end of file diff --git a/src/pages/fics/[ficId]/[chapterId].astro b/src/pages/fics/[ficId]/[chapterId].astro index 3754311..237f7c4 100644 --- a/src/pages/fics/[ficId]/[chapterId].astro +++ b/src/pages/fics/[ficId]/[chapterId].astro @@ -40,7 +40,7 @@ const links = [ title={chapter.data.title} ficTitle={fic[0].data.title} date={chapter.data.publishedAt} - {lastModified} + {lastModified} notes={chapter.data.notes} > @@ -53,19 +53,20 @@ const links = [ {chapters.length > 1 && ( @@ -104,7 +105,7 @@ const links = [ #chapter-index { grid-area: 1 / 1 / 1 / -1; - width: min-content; + /* width: min-content; */ justify-self: center; } @@ -130,10 +131,10 @@ const links = [ \ No newline at end of file diff --git a/src/pages/fics/[ficId]/index.astro b/src/pages/fics/[ficId]/index.astro index 665605b..394c698 100644 --- a/src/pages/fics/[ficId]/index.astro +++ b/src/pages/fics/[ficId]/index.astro @@ -24,7 +24,7 @@ const { Content } = await render(fic); const parser = marked.use({ gfm: true, breaks: true }); const summary = await parser.parse(fic.data.summary); -const lastMod = fic.rendered && (fic.rendered.metadata!.frontmatter as any)['lastModified']; +const lastModified = fic.rendered && (fic.rendered.metadata!.frontmatter as any)['lastModified']; const notes = fic.rendered && await parser.parse((fic.rendered.metadata!.frontmatter as any)["notes"]); --- @@ -78,7 +78,7 @@ const notes = fic.rendered && await parser.parse((fic.rendered.metadata!.frontma {fic.body && (
- +
diff --git a/src/pages/fics/[ficId]/rss.xml.ts b/src/pages/fics/[ficId]/rss.xml.ts index 8e7a015..5013cdc 100644 --- a/src/pages/fics/[ficId]/rss.xml.ts +++ b/src/pages/fics/[ficId]/rss.xml.ts @@ -18,7 +18,7 @@ export const GET: APIRoute = async (context) => { for (const entry of chapters) { const { Content } = await render(entry); const content = await container.renderToString(Content); - + feed.push({ link: `/fics/${entry.id}`, title: entry.data.title, diff --git a/src/utils/lastModified.mjs b/src/utils/lastModified.mjs index a5da1b3..515a8ab 100644 --- a/src/utils/lastModified.mjs +++ b/src/utils/lastModified.mjs @@ -1,15 +1,9 @@ -import { statSync } from "fs"; +import { execSync } from "child_process"; export function modifiedTime() { - return function (_tree, file) { - const path = file.history[0]; - const result = statSync(path); - file.data.astro.frontmatter.lastModified = result.mtime; - // try { - // const result = statSync(path); - // file.data.astro.frontmatter.lastModified = result.mtime; - // } catch (error) { - // return; - // } + return function (_tree, { data, history }) { + const path = history[0]; + const result = execSync(`git log -1 --pretty="format:%cI" "${path}"`); + data.astro.frontmatter.lastModified = result.toString(); } } \ No newline at end of file