Skip to content

Working with Images in Posts

1 min read

Images are part of the story a post tells. This blog keeps its assets under public/static/images/ so they are served as-is and can be referenced from both Markdown and frontmatter.

Images in Markdown

The standard syntax works exactly as you would expect:

The blog logo

Because the file lives in public/, the path is absolute and stable — no import statements, no bundler hashing.

Images in frontmatter

The images field is an array of paths used for social previews and card layouts:

images:
  - /static/images/og-default.png
  - /static/images/logo.svg

The first entry is typically the one a layout will hand to Open Graph and Twitter card tags.

A word on formats

Prefer SVG for logos and diagrams, and raster formats for anything a crawler has to read: social platforms will not render an SVG, so the Open Graph image is a PNG while the logo stays a vector.

Social card

Keeping paths tidy

Decide on one asset directory and stick to it. Scattering images across per-post folders makes them hard to reuse and easy to break during a refactor.

Written by

  • Fajar

    Fajar

    DevOps / Platform Engineer @ PT Mastersystem Infotama

Subscribe to the Newsletter

New posts on OpenShift, Kubernetes, and running platforms in production. No schedule, no noise.

Set PUBLIC_BUTTONDOWN_USER to enable this form

Comments