This plugin extends the default Media Library in OctoberCMS by enabling the assignment and display of metadata for media files, especially images. It provides:
- the ability to edit metadata (title, description, author, source, keywords)
- a Twig filter
|metadata - a frontend component
ImageBlock - integration into the Media Library UI (popup + sidebar)
- output compliant with WAI/WCAG accessibility standards
In the Media section (Media > Library), every file includes an ✎ icon. Clicking it opens a modal where you can define:
- Title
- Description
- Keywords
- Author + URL
- Source + URL
These values are stored in the database and can be reused on the frontend.
Renders an image with its metadata according to layout settings.
image: string – Media file path (e.g./content/myimage.jpg)showTitle: checkbox – Display the title (default: true)showDescription: checkbox – Display description (default: true)showKeywords: checkbox – Display keywords (default: true)layout: dropdown – Layout mode:meta-in-imageormeta-below-imagetextAlign: dropdown – Text alignment:left,center,rightuseDefaultStyles: checkbox – Use bundled styles (default: true)
The generated HTML follows this pattern:
Figure container: figure.image-block
Depending on selected layout:
meta-in-image→ metadata overlaps the imagemeta-below-image→ metadata placed below image
Inside the figure:
imgwith alt text and lazy loadingfigcaptioncontaining:h2.image-title(ifshowTitle)p.image-description(ifshowDescription)p.image-author(with optional link)p.image-source(with optional link)p.image-keywords(ifshowKeywords)
If you disable the built-in styles via useDefaultStyles, you are expected to define styles for the following classes:
image-block– wrapper for the entire blockmeta-in-image– layout modifier (text over image)meta-below-image– layout modifier (text under image)image-title– title headingimage-description– paragraph textimage-author– author rowimage-source– source rowimage-keywords– list of keywords/tagsexternal-link– class for links pointing outside (optionally styled with an icon)
If you want to access metadata in Twig without using a component, use the |metadata filter:
Example:
{% set meta = '/content/example.jpg' | metadata %}{{ meta.title }}{{ meta.description }}
When a media file is clicked in the Media Library, this plugin automatically injects the related metadata into the right-hand sidebar, below the default file info table.
If metadata exists, it will display:
- A
Media Metadataheading - Author (with link if available)
- Source (with link if available)
This block is injected dynamically and does not duplicate on repeated clicks.
- Copy plugin to
plugins/snipi/memetadata - (Optional) Run
php artisan october:upif you use migrations - Use the component or Twig filter in your layout
This plugin aims to follow WAI-ARIA and WCAG best practices:
- semantic HTML
- alt text
- lazy loading
- external links use
rel="noopener"andtarget="_blank"
MIT. Use at your own risk.