Reputation: 33
I'm putting together a site in Harp which will be composed of multiple topics, written by different contributors, potentially in different languages. My present folder structure is something like this:
+public
|_layout.jade
+en
+topic 1
|_data.json
|pg1.md
|pg2.md
+img
|pic.png
Ideally, to make life easy for them, each contributor will only have to worry about a single folder: the one for their topic. This will also let me keep them as sub-repos, with people only able to interfere with their own work.
The issue I am hitting is that an image path expressed in Markdown is not relative to the location of the Markdown file i.e.
pg1.md
![My image](/img/pic.png "A title")
Is translating to
pg1.html
<img src="/img/pic.png" alt="My image" title="A title">
instead of
<img src="/en/topic1/img/pic.png" alt="My image" title="A title">
Is there any way I can make my desired behaviour happen, or do I have to get contributors to enter the full path?
Thanks!
Upvotes: 1
Views: 1889
Reputation: 42517
A path which starts with a slash is not a relative path. Remove the slash from the beginning of the URL:
![My image](img/pic.png "A title")
Now the image path is relative to the location of the Markdown file.
Note that when a URL starts with a slash, that first slash represents the root of the web server. Therefore any path which starts with a slash is an absolute path. If you want relative paths, you cannot have a path which starts with a slash.
Upvotes: 0