jackyzha0 / quartz

🌱 a fast, batteries-included static-site generator that transforms Markdown content into fully functional websites
https://quartz.jzhao.xyz
MIT License
7.33k stars 2.53k forks source link

Issue with relative path #610

Closed PhilB-RLB closed 11 months ago

PhilB-RLB commented 11 months ago

Describe the bug Unable to use relative path

To Reproduce Steps to reproduce the behavior:

Let say we have the following directories/files arrangement : content/ -----------/my_page ..............my_page.md -------------------------------/docs .......................................my_photo.jpg

If in my_page.md I link to my_photo.jpg using : ![My Photo](./docs/my_photo.jpg) everything is fine from my Mardown editor (Remarkable) but image is not displayed on the static site (http://127.0.0.1:8080/..../my_page/my_page

I think I don't understand how to configure relative link in Quartz V4 in order to obtain the same behavior between a markdown editor and the static site generated by Quartz.

Could you please explain how to achieve this ?

Regards

Phil.B

jackyzha0 commented 11 months ago

What is your link resolution set to in https://github.com/jackyzha0/quartz/blob/v4/quartz.config.ts#L55 ? Can you also reformat your directory listing? It's confusing what the structure is.

PhilB-RLB commented 11 months ago

Hi Jackyzha0,

line 55 of quartz.config.ts is : Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }),

Sorry for my bad description of my directory listing. Here it is : content/ content/my_page/ content/my_page/my_page.md (with the link ![My Photo](./docs/my_photo.jpg)) content/my_page/docs/ content/my_page/docs/my_photo.jpg

jackyzha0 commented 11 months ago

If you use relative paths, you should set markdownLinkResolution to "relative"

PhilB-RLB commented 11 months ago

Yes !!! It works. :+1:

During the Quartz install (npx quartz create) I'm quite sure I have selected relative path ...

jackyzha0 commented 11 months ago

Closing as resolved :) I can't reproduce the second thing you mentioned, npx quartz create does the right thing for me.