bastibe / org-static-blog

A static site generator using org-mode
BSD 3-Clause "New" or "Revised" License
341 stars 74 forks source link

Get relative path for both draft and post #87

Closed petergil closed 3 years ago

petergil commented 3 years ago

Ensure that the relative path of a post is calculated based on which out of the post or draft directory it is located in.

This fixes #86.

bastibe commented 3 years ago

Thank you for following up on this!

bastibe commented 3 years ago

Testing this pull request on my own machine, I found out that it broke my blog: It inserted "../" into all post links, such as "https://mydomain.org/../2021-03-05-a-new-post.html".

petergil commented 3 years ago

Hmmm that's strange.. what are your path configs? It should prefer paths relative to your org-static-blog-posts-directory and fall back to org-static-blog-drafts-directory if that did not work.

Also, obligatory, 'works on my machine'.

petergil commented 3 years ago

One point may be that those two paths as well as my render path are on the same level, so I have

~/blog/posts
~/blog/drafts
~/blog/public_html

I don't think that should have any affect but maybe? I should have some time to play around with this tomorrow so can hopefully diagnose something.

bastibe commented 3 years ago

My config on the machine in question is

(setq org-static-blog-publish-directory "C:/Users/basti/projects/blog/")
(setq org-static-blog-posts-directory "C:/Users/basti/projects/blog/posts/")
(setq org-static-blog-drafts-directory "C:/Users/basti/projects/blog/drafts/")

Which looks innocuous enough... could this be a Windows issue, somehow?

bastibe commented 3 years ago

BTW, I reverted this particular change in the latest release due to the error I was seeing. But I'll gladly re-include it once we figure this out.

petergil commented 3 years ago

BTW, I reverted this particular change in the latest release due to the error I was seeing. But I'll gladly re-include it once we figure this out.

No worries, I totally understand.

Sorry for the delay, I had some unexpected things happen. Hopefully I'll be able to look into this later this week.

bastibe commented 3 years ago

No rush, do it whenever you feel like. We do this for fun, so no pressure.