Writing HTML in a .md file - trouble giving href the correct link

I am trying to write some HTML in a .md file. Specifically to display a link link to an image.
GRAV is happy with my
But it has trouble getting to the correct link for the images.
Whatever I try in front of the image which is in the same folder as the default.md it sticks the name of the folder above

Hi! Would be great if you could provide the code you can not get right.

Did you enable Markdown extra in System config? This will allow for more HTML options in markdown files.

Lot of the times the answers is easily found in the documentation. It is a good idea to take a quick overlook over everything, then go through the parts that seems most interesting for you. That way you will read all the documentation in no time.

Thanks Michael. That does indeed look like the solution. I am very new to Grav and did not think to look in the Markdown extra documentation. Will report later on how it goes.

And yes the Grav documentation is very comprehensive. Perhaps an extra line in the HTML section to note that md extra extends HTML capabilities - it would have helped me.

Norma

No problem Norma :slight_smile:

Markdown is in fact included in the markdown section in the introduction. I think if everything would be referenced in every situation then this documentation would be a lot longer.

As Grav grows the documentation will be more readable and content rich.

Learning Grav I know for a fact that it takes time to understand the concept and the different parts in each situation. We just have to take time to learn it, and if we do we have an amazing tool that will be seen everywhere!

I appreciate that your team is there to help us. Thanks.

Thanks for thinking that I am in the Grav team as that would be awesome! But I am not…

I think the fact is that I think everyone that participate in asking and answering questions is a part of the Grav team.

Any open source project is like a democracy, and for a democracy to work it needs people to be apart of it. And the more people the stronger and more reliable the democracy and the project.

So the best thing everyone can do to Grav is to be as active as possible! It shows great strength!

Good luck forward with your project!

PS! Always remember to mark a question as answered if a reply answers your question. It helps the forum to be more efficient to find what you are looking for and answering new questions without looking for them.

Hi Mikael
Well, actually it does not work because markdown extra only works for text!

My code

This is *true* markdown text.
[![](0001-thumb.jpg)](0001.jpg?classes=gallery)
<div markdown = "1" Mary

this did correctly interpret the jpg references correctly, which may be useful to know one day.
But it could not handle the internal div (with or without markdown=“1” inside).

The result is nice picture with working link followed by <div markdown = "1” Mary.

I guess I will have to do this using twig and yaml.

Thanks for the idea.

Norma

Hi Mikael
Well, actually it does not work because markdown extra only works for text!

My code

This is *true* markdown text.
[![](0001-thumb.jpg)](0001.jpg?classes=gallery)
<div markdown = "1" Mary

this did correctly interpret the jpg references correctly, which may be useful to know one day.
But it could not handle the internal div (with or without markdown=“1” inside).

The result is nice picture with working link followed by <div markdown = “1” Mary

Hi Mikael
I have fixed my problem, but I think that there is an error in GRAV - that HLML links do not point to the folder in which the .md file sits.

My structure is user/pages/members-only/05.Member-photos/default.md
My photos are in the same directory as default.md.
Simplifying my default.md to say only
here
and hovering over “here” shows me that the system wants to find 0001.jpg in user/pages/members-only (one directory up from the md).

So I put them there and my whole gallery works, divs and all, and I can present the entire project to my “boss” (I am volunteering for a non-profit to do this). I know that I should write a twig and a yaml but right now I have deadlines.

Thank you - your help led me to experiment and find the solution.

Norma

It is hard to know without seeing the code.

Did you check out: https://learn.getgrav.org/cookbook/general-recipes#creating-a-simple-gallery

It is cool that you volunteer your skills to non-profit! I worked for several non-profits so I understand the importance of volunteers donating their skills.

If you wish I could take a look at the project and make it work.
You can send a Dropbox link or something similar via private message and I will take a look. I will stay online for a while now.

Also if you are worried about privacy I can ensure you I value respect as my integrity.

Good luck in any situation.

Hi Michael

I have my site totally working! Only missing thing is protecting the member area with a password. The site can be improved later.

I did try a cookbook recipe and also some skeletons, but I need more time to get my head around twigs and yaml. In the meantime, I generated HTML with a perl script.

You can the site at pnhbgrav.battycom.com http://pnhbgrav.battycom.com/.

The structure is exactly what the menu shows. In order to get the gallery (members-only/Member-photos to work I had to put all the photos in members-only - one level up from Member-photos that contains the code below in its default.md

0166.jpg
Jesse Weller

The href’s point to files in Member-photos but the (rendered) HTML insists on looking in members-only!

Could you please send me a private message (I do not know how) and I will send you the password to my server?

Norma

1 Like

Wow! Great job on the site :slight_smile: That is the way to get the brain learning and working faster!

I sent you a private message, you can find the messaging system by clicking any user name or going to your own profile (unless you have to be higher rank?).

I will try to see if I find what the problem is, but it is usually because of overthinking. Learning Grav takes time like anything else. But when you learn the basic the advanced is easily understood.

Thanks.

I know that I should do the gallery in yaml, and I will (later) be beautiful. But I would anyway have to write a perl script to generate the front matter to feed the yaml.

For one gallery, what I did at least works and I can practise some instruments before band starts next week:) I only discovered grav 3 weeks ago.

However, I think there is a bug in grav that gets the hrefs wrong.

Cheers

Norma

I have to say you came a long way in these 3 weeks!

I do not necessarily think you need to write all those portraits in a YAML. On the top of my head, I would write a for each tag in twig to iterate over all the images and then use the file name as the title and with some simple jquery, format the file name to be a real name.

Thanks, that is kind of what I plan, but I do not know JAVA either. Too many new languages all at once. For now, I am just happy that I have it working and have sent it to my “boss”.
Norma

Hi again

I was applying my newly working html to another section of my site - archive/events/previous-bands - and the rendered html points to server/pnhbgrav/archive. That is the root level page that contains the page that contains the pictures and is being rendered.

It should point to server/pnhbgrav/archive/events/previous-bands.

This is surely a GRAV error?

Norma

Correction to previous
The rendered html points to the folder above the folder that contains the pictures and the default.md
Norma

Hi,

has this been resolved? I’m facing the same problem when trying to display an image.

<img src="2016_02_08.jpg" alt="" width="540" height="356" />

Markdown extra is enabled, but Grav searches for the image in the parent folder, not in the folder of the page.

As far as I know this is not resolved. I played around until I got something that gave grav what it wanted.

member-pics/0001_tn.jpg
Dorinda Adair

where member-pics is the directory containing the pictures (which should not have to be specified.)
Norma