How to link the sibling notebook that works both for clerk/serve! and clerk/build!?
I'm solving AoC and I have notebooks day01.clj, day02.clj, etc. To link the first one from the second one, I'm doing [Day 1](./day01) (I also tried [Day 1](day01)), which works correctly with clerk/serve!, but for clerk/build! it tries to open day02/day01/.
Am I missing some setting that I should be using?
Try without the leading dot . On my phone right now but think this should work in both modes
or wait, use clerk/doc-url like in https://github.com/nextjournal/advent-of-clerk/blob/main/src/advent_of_clerk/index.clj#L35
@mkvlr I've edited my message while you were writing your reply - I've tried both and neither works correctly.
This doc-url stuff looks like an overkill for something that should just work (consistently).
@narimiran doc-url also doens’t work?
(clerk/html [:a {:href (clerk/doc-url "src/advent_of_clerk/day_01")} "To Day 1 hiccup"])this works in serve, trying build! now…
I want to have these links inline with the rest of markdown comment, e.g.:
;; We already did this in [Day 1](./day01) where we used...
I don't want to have to do something like:
;; We already did this in
(clerk/html .......)
;; where we used ...
(And I'm not even sure that would just continue the sentence?)yeah then you’d need to write the whole paragraph in hiccup
agree that sucks
ungh
Why is there a difference between serve and build? I'm ok with using either ./day01 or ../day01 , just would like to be consistent between the two of them.
ok sorry this works
;; To [Day 1](/src/advent_of_clerk/day_01)Ok, I can work with that. I'll try it.
agree we should try to make relative links work
> ;; To [Day 1](/src/advent_of_clerk/day_01)
Doesn't work. Locally it should be /build/src/... and when pushed on GitHub it is /repo-name/src/....
it works if you serve it from build
needs to be the root folder atm
need to run now but will get back to this, Unsure if before next week though.
can you try https://github.com/nextjournal/clerk/pull/784?
so {:git/sha "de2186a9231fb2797de53783eef45702ec33308a"}
this should fix relative links
;; To [Day 2](day_02)unless the webserver adds trailing slashes that is
it does work for me with python3 -m http.server
@mkvlr at least locally, this seems to make both serve and build to correctly use both ./day02 and day02 relative links. 🍾
unless the webserver adds trailing slashes that isOh, now I see that with the notebooks I've published (before this fix) when I open a notebook, there is a trailing slash which I cannot manually remove - the browser adds it back instantly. Ok, this explains why I had to do ../link if I wanted the links to work on published notebooks, but ./link worked locally.
yep, I’ve removed this behaviour in https://github.com/nextjournal/clerk/pull/784/files
there was a comment that the trailing slash was needed to fix relative links…
Yeah, I've read the changes in that PR 🙂 Let's hope this fix won't get blocked on the account that this is a breaking change 🤞
I’ll need to sleep on it
hope you can use that git/sha in the meantime
Thanks for the help and the quick fix!! Really appreciate it!