Search code examples
bolt-cmsimagesource

Images from director not displayed


I've recently started experimenting with Bolt-cms and everything has been going smoothly, but this: I'm trying to add some hard coded images to my template, but they don't show up. It looks like the pathing is wrong.

<img src="img/test.jpg" >

or

<img src="{{root}}/img/test.jpg" >

don't seem to work.

Does someone know the correct approach is?


Solution

  • We use Symfony Asset, docs here.

    But the short version:

    <script src="{{ asset('js/jquery.min.js', 'theme') }}"></script>
    # Include jquery.min.js from the js folder in your theme.
    
    <img src="{{ asset('kitten.jpg', 'files') }}"></script>
    # Display the kitten.jpg image, that was uploaded to the `files/` folder.