arisac
June 19, 2020, 5:04pm
1
I’m new to Hugo and I’m trying to use Hugo to generate a site for docs.
I have links to other files in docs using markdown markups:
[Title](linked-file.md)
But link like this are not rendered to correct links like linked-file.html
I know there are shortcodes for links, but I would like to keep using markup since it can work in GitHub repo to the correct .md file.
So I am asking if there is a way to render
[Title](linked-file.md)
to
<a href="linked-file.html">Title</a>
Thanks
1 Like
maiki
June 19, 2020, 5:51pm
2
arisac
June 19, 2020, 6:14pm
4
thank you.
I saw it is said can be used as Resolve link references using .GetPage. This would make links portable as you could translate ./my-post.md (and similar constructs that would work on GitHub) into /blog/2019/01/01/my-post/ etc.
However I can’t get this work right.
maiki
June 19, 2020, 8:12pm
5
There are examples, you’ll need to search for them. I don’t personally use them.
The minimal example for relative markdown links:
[My Article](../my-article/index.md)
Template: /layouts/_default/_markup/render-link.html
<a href="{{ (.Page.GetPage .Destination).RelPermalink | safeURL }}">{{ .Text | safeHTML }}</a>
For more complex example in the test project, follow: https://github.com/bep/portable-hugo-links
system
Closed
June 21, 2020, 8:34pm
7
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.