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.