From 375f1530a4dce60db64aea660d468246ee002df4 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 8 Oct 2025 19:44:09 -0400 Subject: [PATCH] fix styling --- public/scripts/index.js | 11 +---------- public/styles/git.css | 19 ++++--------------- src/layouts/PostLayout.astro | 27 +++++++++++++++++++++++++-- src/pages/gist.astro | 2 +- src/pages/gist/[slug].astro | 5 ----- src/pages/git/[slug].astro | 11 +++++++---- 6 files changed, 38 insertions(+), 37 deletions(-) diff --git a/public/scripts/index.js b/public/scripts/index.js index 4d04543..e7a847c 100644 --- a/public/scripts/index.js +++ b/public/scripts/index.js @@ -43,14 +43,6 @@ function currentDisplayPath() { return normalizeDisplayPath(location.pathname); } - function setDocTitleForPath(displayPath) { - if (!displayPath) { - document.title = "Barrett Ruth"; - return; - } - document.title = displayPath.slice(1); - } - function animateToDisplayPath(displayPath, totalMs, done) { if (typing) return; typing = true; @@ -195,7 +187,7 @@ t.classList.remove("active"); t.style.color = ""; }); - setDocTitleForPath(""); + document.title = ""; }); } else { persistPrompt(); @@ -209,7 +201,6 @@ const initial = currentDisplayPath(); if (initial) setPromptTailImmediate(" " + initial); else setPromptTailImmediate(""); - if (initial) setDocTitleForPath(initial); document.body.addEventListener("click", (e) => { if (e.target.closest(".home-link")) return handleHomeClick(e); diff --git a/public/styles/git.css b/public/styles/git.css index 6cbe162..7fef6fc 100644 --- a/public/styles/git.css +++ b/public/styles/git.css @@ -1,28 +1,17 @@ .clone-line { font-family: 'Apercu Mono', monospace !important; - font-size: 1.3em; - font-weight: 400; + font-size: 1.2em; margin: 0 1em; text-align: left; user-select: all; - color: inherit; } .clone-line code { all: unset; font-family: 'Apercu Mono', monospace !important; - font-size: 1em; + white-space: normal !important; + word-break: break-word; + overflow-wrap: anywhere; line-height: 1.5; - white-space: nowrap; cursor: text; - background: transparent !important; - color: inherit; } - -.clone-line .prompt { - user-select: none; - opacity: 0.8; - margin-right: 0.3em; - color: inherit; -} - diff --git a/src/layouts/PostLayout.astro b/src/layouts/PostLayout.astro index 407c01d..9fbddd1 100644 --- a/src/layouts/PostLayout.astro +++ b/src/layouts/PostLayout.astro @@ -10,17 +10,40 @@ interface Props { useKatex?: boolean; useD3?: boolean; scripts?: string[]; + category?: string; + }; + post?: { + id?: string; + collection?: string; + slug?: string; }; - post?: { id?: string }; } const { frontmatter, post } = Astro.props as Props; const { title, description, useKatex = false, useD3 = false } = frontmatter; +const filePath = post?.id ?? ""; +const categoryFromId = (filePath.split("/")[0] ?? "").replace( + /\.(mdx?|MDX?)$/, + "", +); +const category = + (frontmatter.category ?? post?.collection ?? categoryFromId) || ""; + +let documentTitle = title; +if (post?.collection === "git" && post?.slug) { + documentTitle = `${post.slug}.git`; +} else if ( + (post?.collection === "gists" || post?.collection === "gist") && + post?.slug +) { + documentTitle = `${post.slug}`; +} + const topicColor = getTopicColor(post.collection); --- - + diff --git a/src/pages/gist.astro b/src/pages/gist.astro index 3fe4f19..9e3b6b7 100644 --- a/src/pages/gist.astro +++ b/src/pages/gist.astro @@ -2,7 +2,7 @@ import BaseLayout from "../layouts/BaseLayout.astro"; import { getCollection } from "astro:content"; -const title = "/gists"; +const title = "gists"; const gists = await getCollection("gists"); gists.sort((a, b) => a.slug.localeCompare(b.slug)); --- diff --git a/src/pages/gist/[slug].astro b/src/pages/gist/[slug].astro index d706c47..74a7bfd 100644 --- a/src/pages/gist/[slug].astro +++ b/src/pages/gist/[slug].astro @@ -12,13 +12,8 @@ export async function getStaticPaths() { const { gist } = Astro.props; const { Content } = await gist.render(); -const pageTitle = `${gist.slug}`; --- - - {pageTitle} - - diff --git a/src/pages/git/[slug].astro b/src/pages/git/[slug].astro index e1a31da..763f227 100644 --- a/src/pages/git/[slug].astro +++ b/src/pages/git/[slug].astro @@ -11,15 +11,18 @@ export async function getStaticPaths() { } const { repo } = Astro.props; -const { slug } = Astro.params; const { Content } = await repo.render(); -const pageTitle = `${slug}.git`; +const cloneCommand = `git clone https://git.barrettruth.com/${repo.slug}.git`; --- - {pageTitle} - + + +
+ {cloneCommand} +
+