Reference your own contents in Hugo

Page content

https://gohugo.io/content-management/cross-references/#use-ref-and-relref

Refer another post

Please delete a backquote (\) in the follwoing snippet. I added it because of a Hugo rendering issue.

[text to be hyperlinked]({\{< ref "hugo/article.md" >}})

You don’t need to append contents in the reference.

When you open this hugo document in local hugo server the link is referred as http://localhost:1313/hugo/article. When you open this hugo document on the hosted server, the link is referred as http://{{ your_base_URL_in_config.toml ]}/hugo/article.

Refer a section:

[lifetime in Rust]({\{< relref "#10-generic-types-traits-and-lifetimes" >}})

The name of anchor is created automatically by Hugo.

Reference a section in another post

[my quick note about function pointer]({\{< relref "rust/getting-started#194-advanced-functions-and-closures" >}})