What is the best way to work with dynamic images?


#1

Hi,

I trying to find a way to implement dynamic images for something like a logo that could be used across the site, and that my client could edit.

I tried adding a field in the config.site. When using this:

<img src="{{ site.logo | first.path }}" alt="La Bete" class="header-logo"/>

It only works on the index page.


#2

@gen035 The answer depends…

  • What are ‘dynamic images’? SVG images, or jpg/png images which are loaded depending on some logic in a twig template?
  • Which theme are you using?
  • What is the ‘index page’ and what is its template? The template is the basename of the *.md file, e.g. default.md uses template ‘default.html.twig’.
  • What is the template of the pages that don’t work?
  • Where are your images located?