jekyll-highlight-cards
A Jekyll plugin providing styled card components for links and images with Internet Archive integration.
Features
-
{% linkcard %}- Styled link cards with optional titles and archive links -
{% polaroid %}- Polaroid-style image cards with titles, links, and archive support -
Markdown Image Sizing - Extended syntax for image dimensions:
 - Internet Archive Integration - Automatic lookup and archival for both tags
- Customizable - Override HTML templates and CSS styles
Installation
Add to your Gemfile:
gem 'jekyll-highlight-cards'Add to your _config.yml:
plugins:
- jekyll-highlight-cardsRun:
bundle installAdd to your main.scss file:
@use "highlight-cards";Usage
Linkcard Tag
Highlight links:
{% linkcard https://example.com %}
{% linkcard https://example.com My Cool Title %}
{% linkcard https://example.com Title archive:none %}
{% linkcard https://example.com archive:https://web.archive.org/... %}Parameters:
| Parameter | Description |
|---|---|
| URL | (required, first parameter) |
| Title | (optional, everything after URL until archive:) |
archive:URL |
Explicit archive URL |
archive:none |
Disable archive lookup |
Polaroid Tag
Create polaroid-style image cards:
{% polaroid /assets/image.jpg %}
{% polaroid /assets/image.jpg size=300x200 %}
{% polaroid /assets/image.jpg size=400x title="My Photo" %}
{% polaroid /assets/image.jpg alt="Screen reader description" %}
{% polaroid /assets/image.jpg alt="Alt text" title="Visible Title" %}
{% polaroid /assets/image.jpg title="Photo" link="https://example.com" %}
{% polaroid /assets/image.jpg link="https://example.com" image_link="https://other.com" %}
{% polaroid {{ page.image }} size=x400 title={{ page.title }} %}Parameters:
| Parameter | Description |
|---|---|
| Image URL | (required, first parameter) |
size=WxH |
Image dimensions. Formats: 300x200, 300x, x200, 300, 400pxx300px
|
alt="..." |
Alt text for image (for accessibility) |
title="..." |
Title text displayed below image (also used as alt fallback) |
link="..." |
Explicit URL to link to (shows as visible link text) |
image_link="..." |
Override where the image links to (independent of visible link text) |
archive="..." |
Archive URL or none to disable |
Image Alt Text:
The alt attribute priority: explicit alt parameter → title parameter → empty string.
This allows you to:
- Set accessible alt text without displaying a visible title
- Use title as both visual label and screen reader description
- Separate concerns: detailed alt for accessibility, brief title for display
Link Behavior:
-
No
linkparameter: Image links to itself, no visible link text shown -
With
linkparameter: Image and visible link text both point to the specified URL -
With
image_linkparameter: Image links toimage_linkURL, overriding default behavior -
With both
linkandimage_link: Image links toimage_link, but visible text displayslink
Stacking:
By default, the Polaroids are displayed centered in their available space. Two Polaroids in a row will be stacked vertically.
If you want Polaroids to fill the available width side-by-side, add the following to your main.scss file:
.polaroid-container {
display: inline-block;
width: auto;
}Markdown Image Sizing
Add dimensions to Markdown images:



Sized images are automatically wrapped in links to themselves.
Configuration
Internet Archive
Enable automatic archive lookup:
export JEKYLL_HIGHLIGHT_CARDS_ARCHIVE=1Or in your shell config:
# In .bashrc, .zshrc, etc.
export JEKYLL_HIGHLIGHT_CARDS_ARCHIVE=1CSS Styles
Default usage:
Import the default styles which include both structure and colors:
@use "highlight-cards";This provides a complete, ready-to-use appearance.
Full customization:
For complete control over colors and visual effects, import only the structural styles and define your own colors:
@use "highlight-cards-structure";
// Define your own color styles
.polaroid {
border-color: var(--link-color);
background-color: var(--body-bg);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
.polaroid-image {
border-color: var(--link-color);
}
}The structure file contains only layout, positioning, and sizing - no colors, borders, or visual effects. This allows you to fully customize the appearance while maintaining the structural layout.
Template Customization
If the provided HTML structure doesn't work for you, you can override templates by creating files in your Jekyll site:
Linkcard template:
- Create
_includes/highlight-cards/linkcard.html
Polaroid template:
- Create
_includes/highlight-cards/polaroid.html
Templates receive these variables:
Linkcard variables:
-
url,display_url,title,archive_url -
escaped_url,escaped_display_url,escaped_title,escaped_archive_url
Polaroid variables:
-
image_url,link_url,image_link_url,title,link_display,archive_url,width,height,alt -
escaped_*versions of all text fields
See default templates in gem's _includes/ directory for examples.
Examples
Blog post with link card
---
title: My Blog Post
---
Check out this cool site:
{% linkcard https://jekyllrb.com Jekyll - Simple, blog-aware, static sites %}
More content here...Gallery with polaroids
---
title: Photo Gallery
photos:
- url: /assets/photo1.jpg
title: Sunset
- url: /assets/photo2.jpg
title: Mountains
---
{% for photo in page.photos %}
{% polaroid {{ photo.url }} size=300x300 title={{ photo.title }} %}
{% endfor %}Sized images in Markdown
Here's a large image:

And a smaller one:
Development
See CONTRIBUTING.md for development setup and guidelines.

