Skip to content

fix(blog): use data attributes for lightbox year/slug#59

Merged
CalvinAllen merged 1 commit intomainfrom
fix/blog/lightbox-year-slug
Jan 29, 2026
Merged

fix(blog): use data attributes for lightbox year/slug#59
CalvinAllen merged 1 commit intomainfrom
fix/blog/lightbox-year-slug

Conversation

@CalvinAllen
Copy link
Copy Markdown
Collaborator

Summary

Fixes the lightbox not opening when clicking images on blog posts.

Problem

The JavaScript was trying to extract the year from the URL path (/2026/slug/), but the actual URLs are just /slug/ without the year. This caused year to be null and the lightbox code path that opens the image was never reached.

Solution

  • Extract year from the post's date prop on the server side
  • Pass year and slug as data attributes on the <article> element
  • Read from data attributes in JavaScript instead of parsing the URL

Test plan

  • Click an image on a blog post
  • Verify lightbox opens with full-size original image
  • Verify close button, clicking outside, and Escape all close the lightbox

…parsing

The URL doesn't contain the year, so the lightbox couldn't find the
original images. Now we pass year and slug from the server-side props
via data attributes on the article element.
@CalvinAllen CalvinAllen changed the title fix(blog): use data attributes for lightbox year/slug instead of URL parsing fix(blog): use data attributes for lightbox year/slug Jan 29, 2026
@CalvinAllen CalvinAllen merged commit 569ce94 into main Jan 29, 2026
@CalvinAllen CalvinAllen deleted the fix/blog/lightbox-year-slug branch January 29, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant