Images on sub-pages not working

Hi everybody!
I just created a page with the following structure:

01.home
-> 01.test

When I now place a image in the 01.home/default.md with it is working.

Using the same code in the 01.home/01.test/default.md, the image does not show up on this page! Are there any dependencies missing?

Thx!

PS: I`m using the antimatter-theme without any changes.

Where did you put the demo.png image? Generally images are put in the same folder as the .md file. This associates them with the page.

For example if you have:

pages/01.home
  - default.md
  - demo.png

Then you can reference that image directly with ![](demo.png) (using markdown is the preferred approach).

You can even access this image from a sub-page pages/01.home/01.subpage/default.md with: ![](/home/demo.png)

However, if you want to access an image from multiple locations, you can put all the images into an empty image page like:

pages/01.home
 - default.md
 
pages/images
 - demo.png

Then you can access that image from any page with the ![](/images/demo.png) where image/ is actually a slug to the images page.

Note, you should really use these markdown image tags because they have support for the logic to find the image in a pages. The logic is the same as is outlined in this document about links.

Thank you very much, worked fine! I thought, all images should be stored in the /grav/images/ folder …

No Grav’s /images/ folder is for cached folders only. You shouldn’t put anything in there yourself. The rule of thumb is that any thing the user adds should be in the /user/ folder only.

I see. And where, in this case would be the right folder for the favicon? /grav or webdirectory-root?

Generally we put the favicon in the theme itself as you need to have the reference directly in the theme anyway.

<link rel="icon" type="image/png" href="{{ url('theme://images/favicon.png') }}" />

This is the new way to do it… it will look in the theme’s images/ folder so: user/themes/antimatter/images/favicon.png will be used.

Thanks, this also worked fine! :slight_smile: GRAV rocks, I need some practice, though I keep on learning!

@siren386, I am new to PHP and Apache. I had the same issue as yours. But I got it figure out by following tutorial here to set up .htaccess. See step 3 to config default site. BTW, I am using debian.