Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Img src vs ![]()

Started by Muut Archive 10 years ago · 4 replies · 563 views
10 years ago

Somebody pls help, I must be doing something stupid but this has been a real stumbling block as I try to make my first steps:
When I use inside an .md file, the pic is shown when the page is loaded; but when I use <img src="pic.jpg">, the pic does not load....even though it does show properly on the markdown editor.
I would like to use the <img> tag in order to define some attributes, but atm am only able to load images via ![](). Same pic, same path. What am I doing wrong?&quest;

(I'm working locally with an MAMP webserver)

10 years ago

Using ![](pic.jpg) that is translated to the correct relative page URL. Using <img src=“pic.jpg”> will try to load yoursite.com/pic.jpg. You need to use the full relateive url (src="/mypage/pic.jpg")

10 years ago

Thank you, but unfortunately still can't get it to work. (Sorry if this is such a basic question!)

For example, let's say I'm at the grav-skeleton-onepage-site trying to insert a pic at the features page.
I have tried either <img src="/home/_features/pic.jpg">
and <img src="/01.home/_features/pic.jpg"> with no success. But works fine.

I also tried creating an images subfolder at 01.home and put the pic.jpg there, and calling it via <img src="/images/pic.jpg"> from the features.md file, but it doesn't load. But if I call it via it loads normally.

10 years ago

Sorry for the italics, will try to use the proper syntax hightlight... In short,
---<img src=“/home/_features/pic.jpg”>

TXT
doesn't work while
---![](/home/_features/pic.jpg)
--- 
works, and
---<img src=“/images/pic.jpg”>

doesn't work while
---


works

10 years ago

Put both in a page and "view source." You will immediately see the problem.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1350 9 years ago
Archive · by Muut Archive, 9 years ago
2 934 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2947 9 years ago
Archive · by Muut Archive, 9 years ago
3 1118 9 years ago