Ship a direct "View image" link on every media library gallery card so users can open the generated PNG in the browser without navigating through the HTML card page.
Read and implement all steps in the plan at docs/plans/add-image-link-media-library-gallery.html — Add View image link to gallery cards
add-image-link-media-library-gallery.html
docs/plans/add-image-link-media-library-gallery.html
Context
The media-library skill scans docs/media/social/ and builds a filterable HTML gallery (index.html). Each card-generating skill saves both an HTML card and a PNG screenshot side-by-side in that directory. The gallery currently links each card to its HTML file so users can read the post copy — but there is no way to open the PNG image directly from the gallery UI.
The fix is a plain HTML <a> link placed below each gallery card, outside the existing <a class="gallery-card"> wrapper. Siblings can't nest, so this avoids the HTML spec violation entirely and requires no JS card-click refactoring. Each card + link pair lives inside a thin <div class="gallery-card-wrap"> container so the existing filter JS can show/hide both elements together.
Two files need updating: templates/gallery.html (CSS for the wrap and link, JS filter update) and skills/media-library/SKILL.md (the gallery entry block that the skill generates per card).
Steps
gallery.html — add .gallery-card-wrap and .open-img-link CSS; update applyFilters() JS to target .gallery-card-wrap
.gallery-card would leave orphaned links visible. Adding .open-img-link CSS gives the plain link a consistent visual treatment matching the dark-mode gallery theme.Verify
kit/plugins/social-media-tools/templates/gallery.html. Confirm:
- A
.gallery-card-wrapCSS rule exists (at minimumdisplay: contentsor a block wrapper with no gap impact). - A
.open-img-linkCSS rule exists with at leastfont-size,color, anddisplaydeclared. - The
applyFilters()JS function targets.gallery-card-wrapforstyle.displaytoggle, readingdata-typeanddata-topicfrom the inner.gallery-cardchild. - The
var cards = grid.querySelectorAll(…)line selects.gallery-card-wrap(not.gallery-card).
SKILL.md Step 3 — wrap each card entry in <div class="gallery-card-wrap"> and add a plain <a class="open-img-link"> below the card
docs/media/social/index.html. Wrapping in .gallery-card-wrap and placing the image link as a sibling after </a> (not inside it) keeps the HTML valid — no nested anchors — and no JS click handler is needed.Verify
kit/plugins/social-media-tools/skills/media-library/SKILL.md and read Step 3. Confirm:
- The gallery entry block starts with
<div class="gallery-card-wrap">. - The existing
<a class="gallery-card" href="{BASENAME}" …>card is unchanged inside the wrap. - After the closing
</a>, a<a class="open-img-link" href="{BASENAME_PNG}" target="_blank" rel="noopener">View image</a>appears as a sibling (not a child of the card<a>). - The entry block closes with
</div>(closing the wrap).
Acceptance Criteria
Verification
Rebuild the gallery by running /social-media-tools:media-library and open docs/media/social/index.html in a browser. Confirm:
- Each card has a "View image" link rendered visibly below it (not inside the card).
- Clicking the card body opens the HTML card file in the same tab.
- Clicking "View image" opens the
.pngin a new tab — the gallery page does not navigate away. - Using the type filter chips or search box hides both the card and its "View image" link together — no orphaned links remain visible.
- Switching between grid and list view still shows the link below each card in both layouts.