Skip to content

Latest πŸ—žοΈ

Saturday, March 14

Git Commits

days commits 5 ohnsh/days
  • 11:54 pm β€” John Sherrell <dev@ohn.sh>

    Added automatic tag extraction (based on emoji) to youtube loader. Using `Intl.Segmenter` API to handle complex multi-codepoint emoji. Also fixed some edge cases when parsing dates from video titles with implicit years. The year is taken from the pub date but adjusted as necessary in case the two dates fall on different sides of a December/January boundary.

  • 9:24 pm β€” John Sherrell <dev@ohn.sh>

    Youtube loader: fix regex date-from-title parsing edge cases. (JavaScript will parse 'Run 1' as a valid date: January 1, 2001. JavaScript is always right.)

  • 3:57 pm β€” John Sherrell <dev@ohn.sh>

    Dynamic heading levels for rendered markdown and mdx. My spidey sense said that heading levels were going to be a huge pain, and they were. I settled on something that seems pretty robust but unfortunately involves regex string replacement on raw HTML. The <Post> component (similar to the previous <Preview>) computes a heading level offset based on context (list of posts versus single post). Then, a <PostWrapper> component is passed the actual <Content /> in a slot and uses `Astro.slots.render('default')` to obtain the rendered HTML string, which it then manipulates and renders to the page with `<Fragment set:html={adjustedHtml} />`.

  • 12:16 pm β€” John Sherrell <dev@ohn.sh>

    Added horizontal rules back in, moved the CSS to global.css.

  • 1:31 am β€” John Sherrell <dev@ohn.sh>

    Paginated /tags/[tag] route. As a bonus, og:image now works on tag pages. Both og:image and pagination links are implemented in route middleware, so any paginated routes get them for free. Realized that using [...page].astro instead of [page].astro allows for more elegant routes: the first page has no page segment (the `page` parameter is undefined) so there's no need for an index page returning `Astro.rewrite('/route/1')`. So now I'm using it on both paginated routes: /tags/[tag] and /latest.

YouTube

Friday, March 13

Posts are back.

Posts are now a distinct content collection. If you’re seeing this, they are being merged with other content types at build time to generate daily entries. Currently, both days and individual posts can be tagged. Posts are tagged in Markdown frontmatter while days are tagged in a separate YAML metadata collection.

View full post…

Git Commits

days commits 17 ohnsh/days
  • 11:04 pm β€” John Sherrell <dev@ohn.sh>

    Moved day tags to top, right under title. No longer rendering year in title for posts later than this month last year.

  • 10:09 pm β€” John Sherrell <dev@ohn.sh>

    Fixed sidebar month-rendering bug related to JavaScript date parsing (i.e. plain dates are usually interpreted as midnight local time, but sometimes as midnight UTC, creating weird day/month/year boundary issues.)

  • 9:34 pm β€” John Sherrell <dev@ohn.sh>

    Changed tagMap values to Set<DayEntry> instead of DayEntry[] to avoid duplicates. (For example, I had both today and a post from today tagged "test" which caused the day to render twice at tags/test.) Also switched on title rendering for days on tags route.

  • 9:23 pm β€” John Sherrell <dev@ohn.sh>

    Sidebar now working on tags routes.

  • 9:17 pm β€” John Sherrell <dev@ohn.sh>

    Tag route is in decent shape now except the sidebar. Lots of refactoring and cleanup in src/lib. De-duplicating filtering and sidebar processing in components by moving it to lib/day.ts and lib/sidebar.ts. Learned to be very careful abou what I import in astro.config.mjs (created lib/const.ts with no side effects or dependencies for this purpose).

  • 6:10 pm β€” John Sherrell <dev@ohn.sh>

    Day tags and post tags now being rendered. It's confusing when they're adjacent--I'll need to think that through. The /tags route is mostly working without me even touching it. There are a few things to fix up, especially the sidebar.

  • 5:59 pm β€” John Sherrell <dev@ohn.sh>

    Posts now rendering. Overall intra-day layout needs a lot of work, but the content is mostly there. Still need to merge in tagging/metadata from yaml collection. Also need to get og:image working again.

  • 5:28 pm β€” John Sherrell <dev@ohn.sh>

    Prepping posts to be merged into daily feed.

  • 4:51 pm β€” John Sherrell <dev@ohn.sh>

    Fixed sidebar regression where the header and footer was lost when I started dynamically generating the content. Now the static config is a template with a literal '<slot />' item that is replaced dynamically with the generated entries.

  • 2:26 pm β€” John Sherrell <dev@ohn.sh>

    Add wrangler to gitignore.

  • 2:22 pm β€” John Sherrell <dev@ohn.sh>

    Merge branch 'virtual-days'

  • 2:18 pm β€” John Sherrell <dev@ohn.sh>

    Titles fixed, filtering implemented (year >= 2025 for now).

  • 1:45 pm β€” John Sherrell <dev@ohn.sh>

    Getting close. All routes rendering, pagination working. Still need to render actual post content, fix up titles, filter days, and get og:image extraction working again.

  • 2:44 am β€” John Sherrell <dev@ohn.sh>

    Refactoring new code.

  • 2:23 am β€” John Sherrell <dev@ohn.sh>

    Auto-collapse all but first year and month.

  • 2:00 am β€” John Sherrell <dev@ohn.sh>

    Proof of concept. It works. Needs lots of work, though.

  • 12:17 am β€” John Sherrell <dev@ohn.sh>

    Getting there.

Thursday, March 12

Git Commits

days commits 4 ohnsh/days
  • 3:39 pm β€” John Sherrell <dev@ohn.sh>

    Nuke content folder, keeping actual posts for a "posts" collection. There's still a docs collection since this is starlight, but it might be empty. The days collection will be optional yaml metadata to for tagging and configuration.

  • 2:05 pm β€” John Sherrell <dev@ohn.sh>

    Updated github loader to fetch 100 commits per page. Still need to implement actual paging.

  • 12:58 pm β€” John Sherrell <dev@ohn.sh>

    Rough first pass of virtual day route.

  • 12:55 pm β€” John Sherrell <dev@ohn.sh>

    Prepping for new branch that will make major changes to project structure. Days will be virtual resources rather than concrete mdx files. The `days` collection will be strictly for metadata; posts will be a separate content collection, and they, along with github, youtube, etc., will be merged at the endpoint for a given day.

scratch commits 1 ohnsh/scratch
  • 12:51 pm β€” John Sherrell <dev@ohn.sh>

    remove note.

Wednesday, March 11

Git Commits

days commits 13 ohnsh/days
  • 10:17 pm β€” John Sherrell <dev@ohn.sh>

    Badge commit summaries with daily count.

  • 9:49 pm β€” John Sherrell <dev@ohn.sh>

    Bump Astro and Starlight.

  • 9:43 pm β€” John Sherrell <dev@ohn.sh>

    Wrap <YouTube> in <figure>; scoped CSS should make my custom Vite plugin obsolete.

  • 9:23 pm β€” John Sherrell <dev@ohn.sh>

    YouTube loader now detects when videos are shorts. <YTDay> now allows sorting by first character of video titles (for video titles with an emoji indicating subject/category).

  • 6:40 pm β€” John Sherrell <dev@ohn.sh>

    Added YouTube Data API loader; now videos are available in a day-oriented content collection, just like GitHub commits.

  • 1:29 pm β€” John Sherrell <dev@ohn.sh>

    Bring in loaders/github improvements from scratch. Commits now organized by local day instead of UTC.

  • 1:27 pm β€” John Sherrell <dev@ohn.sh>

    Refactor <GithubDay> and improve formatting. Now <Commit> and <RepoDay> are separate components.

  • 11:30 am β€” John Sherrell <dev@ohn.sh>

    Upgrade to Astro v6.

  • 2:59 am β€” John Sherrell <dev@ohn.sh>

    Added link-button out to repositories in <GithubDay>.

  • 1:56 am β€” John Sherrell <dev@ohn.sh>

    <GithubDay> commit formatting is less terrible. Still need to account for UTC timestamps and bring in a ~7-digit SHA prefix a la GitHub.

  • 1:28 am β€” John Sherrell <dev@ohn.sh>

    Add github sync script to package.json. March 11.

  • 1:03 am β€” John Sherrell <dev@ohn.sh>

    Clean up console.logs

  • 12:24 am β€” John Sherrell <dev@ohn.sh>

    Tagging implementation, loosely based on HiDeoo/starlight-blog. No pagination yet, but it will be necessary. Need to work on consistent conversion of tags to slugs. The <Tags> component has made me realize that the other everyday components like <YouTube> and <GithubDay> need to be rendered outside of the MDX where they can be passed computed props directly. This avoids a lot of duplication.

scratch commits 6 ohnsh/scratch
  • 9:50 pm β€” John Sherrell <dev@ohn.sh>

    YouTube loader now detects when videos are shorts. <YTDay> now allows sorting by first character of video titles (for video titles with an emoji indicating subject/category). Wrap <YouTube> in <figure>; allows for scoped CSS to override <lite-youtube> styles.

  • 6:22 pm β€” John Sherrell <dev@ohn.sh>

    Extracted a new content loader from YouTube Data API experiment. Loads videos keyed by day, as with the GitHub loader. Dates in the video title take precedence.

  • 1:12 pm β€” John Sherrell <dev@ohn.sh>

    Bring over GithubDays updates from days and refactor. Now <Commit> and <RepoDay> are separate components.

  • 12:29 pm β€” John Sherrell <dev@ohn.sh>

    Update color scheme cyan -> blue.

  • 12:24 pm β€” John Sherrell <dev@ohn.sh>

    more updates after nuking bun.lock.

  • 11:41 am β€” John Sherrell <dev@ohn.sh>

    Upgrade Astro to v6.

Tuesday, March 10

Git Commits

days commits 7 ohnsh/days
  • 10:52 pm β€” John Sherrell <dev@ohn.sh>

    Clean up old pagination hack.

  • 9:50 pm β€” John Sherrell <dev@ohn.sh>

    Tweak <YouTube> styles. Copilot pulled out a pretty sweet custom Vite plugin that wraps the component's own CSS in a @layer so it can be overridden with no fuss.

  • 1:17 pm β€” John Sherrell <dev@ohn.sh>

    Add README.

  • 11:57 am β€” John Sherrell <dev@ohn.sh>

    Added 3/9 video, minor edits.

  • 2:55 am β€” John Sherrell <dev@ohn.sh>

    Day updates.

  • 2:28 am β€” John Sherrell <dev@ohn.sh>

    Refactor route middleware. Pagination now handled there so no need to override the Pagination component. Remove TOC from latest stream.

  • 12:51 am β€” John Sherrell <dev@ohn.sh>

    Index is now a paginated non-Starlight route with a hero on page 1. Getting rid of content/docs/index.mdx makes sense because it was an outlier in the content collection and because the index really needs to display a stream of recent posts. Astro's built-in pagination is a much better solution for such a stream. Date utils are finally in good shape. Moving away from Starlight-centric approach. Parsing dates directly from slugs rather than relying on route context set by Starlight middleware.