Closed ThatOtherAndrew closed 2 years ago
Thanks for reporting this. I'll look into how to solve this so that it links to the correct page and scrolls to the linked heading.
I do find a similar issue. For example, if the path of the .md file in Obsidian vault is "/1.abc/test.md", it will be redirected to "digitalgarden.url/notes/1-abc-test", instead of "digitalgarden.url/notes/1.abc/test.md". And this also causes 404.
I can give an example on my website hxhc-notes The third note named Savitkzy-Golay filter 1 is located in the root directory, and it works fine. The fourth note (exactly the same with the third one) named 1. Projects/algo/chemometrics/Savitkzy-Golay filter is located in "/1. Projects/algo/chemometrics/Savitkzy-Golay filter". But the link in fact is "https://hxhc-notes.netlify.app/notes/1-projects-algo-chemometrics-savitkzy-golay-filter", which is a 404 page.
Besides, it seems that the link can't handle Chinese characters (maybe CJK characters). Look at the links of the first and second notes on my website, the links of them contains no Chinses characters. And this may also causes 404.
Anyway, I think the main issue is the link generation problem.
Hope this can be solved soon. Thank you for providing such a good plugin.
This is what happens when I'm the only tester 😅 I've just used a flat file structure, and thus never bumped into the issues when there are several notes with the same title but in different locations.
I've implemented a fix where instead of only using the filename as a URL, the whole path will be the URL. So if you publish a note with the path "Folder 1/SubFolder/Note.md" the url will become "folder-1/subfolder/note/" .
I've also made it so the links containing "#" will work. I've not yet implemented the linking to the actual header, but at least they won't redirect to a 404 anymore.
It would be great if you could update to the latest plugin version and test if it now works as you expected, and report back here. (Use the publish multiple notes command so that every note is "fixed")
I will also look into the chinese-characters problem. The reason they are stripped away is the library I'm using to slugify the url is stripping them away. But as far as I know it is allowed in URLs. I'll look into how i can add support for them. For now, if you want to include the chinese character in the url, you should be able to do so by using the permalink attribute in frontmatter like so: 'dg-permalink: "知乎"'
Big thanks for your quick response! My problems have been solved. ❤
It seems like the new update has thrown things up in the air slightly for me - transclusions are no longer working for me and neither are links to my garden entry page. I'll try to do a bit of testing later to see if it's an issue specifically with the garden entry, or if it's something else.
Make sure you are on the latest version, 2.1.3. I did 3 releases today because the changes introduced several bugs that I didn't catch before publishing. Transclusions and images not working was one of the bugs that was introduced in the 2.1.* releases before it got fixed in the 2.1.3 release. If you're still having trouble when using that version, let me know.
Ah, my bad - I had updated, but something broke when pushing to the Git repository and there were duplicate files - as a result, the old static files were still being used. Sorry about that, false alarm!
@ThatOtherAndrew I've just released a new version of the plugin which supports linking to headers in other notes. Let me know if its working as you expected, (Remember to also update the site template for this to work properly)
That works great, thank you very much!
Problem
When linking to the heading of another note, the hashtag is replaced with a hyphen character, leading to an invalid URL.
How to reproduce
one.md
with content# title
andtwo.md
with content[[one#title]]
digitalgarden.url/notes/two
and click on the linkdigitalgarden.url/notes/two-title
instead ofdigitalgarden.url/notes/two/#title
, causing a 404