I use obsidian on Hugo to host my site in Netlify via Github.
In my home page when I click a post it points to a link like this https://website.netlify.app/post/wiki-plugin-new-change-manually/
it opens successfully. But when I have a link inside that post. Say link_1
. It points to https://website.netlify.app/post/wiki-plugin-new-change-manually/link_1.md
. Gives me 404. It is pointing to a md file.
The internal links don’t work. I use MDlinks ( [link_1](link_1)
) not wikilinks ( [[link_1]]
).
I intent to use hugo site like a digital garden. I need to link a lot. Now I cannot use Hugo due to this.
**How to properly link internal md files so that it can be resolved online correctly ?
** Please help 
nb: It will be helpful if someone use obsidian hugo setup to publish.
In the past 24 hours you have created three posts on this forum related to the same thing:
It seems like you have a fundamental misunderstanding of markdown links.
A markdown link has three components: link text, a link destination, and optionally a link title.
[Post 1](/posts/post-1 "My first post")
------ ------------- -------------
text destination title
The destination is a URL, either absolute or relative. The destination is not a file path.
In this post you describe a markdown render hook as a “hack.” It is not. A markdown render hook allows you to alter the way that markdown is rendered to HTML—it is a very powerful feature.
A well-constructed link render hook allows you to use file paths instead of URLs for link destinations. This makes your markdown portable to other systems, and provides link validation.
To address your questions, either (a) make sure your link destinations are valid URLs, or (b) implement a link render hook. More info here.
1 Like
I did this.
<a href="{{ (.Page.GetPage .Destination).RelPermalink | safeURL }}">{{ .Text | safeHTML }}</a>
on
/layouts/_default/_markup/render-link.html
render hook did solve the problem for simple links.
But links with spaces & uppercase characters do not point to the correct link.
My Link
file points to /post/My%20Link
whereas the correct link by Hugo is/post/my-link
.
Help appreciated.
Please read the markdown specification.
This works as expected:
content/
├── posts/
│ └── My File.md
└── _index.md
markdown
[My File](</posts/My File.md>)
As a best practice:
- Avoid spaces in your file names
- Avoid capital letters and symbols other than hyphens in your file names
2 Likes