How do I get the title of a post in Markdown?

Hello all

I’ve been trying to create a post that contains a list of posts that I have written myself.

What I want is roughly the following in Markdown

  • [Title of post](Link to post)

So say I have the post about.md, I know I can get the URL with {{% relref “about.md” %}} In the Markdown, but I cannot, for the life of me, figure out how to access the title.

Am I missing something? Thanks in advance.

Might be of some help.

What kind of list are you trying to generate?

If it’s related content see the Docs about this Hugo feature.

If it’s an arbitrary list I’m afraid that you will need to enter those titles manually.

I’m trying to make an index for a blog series I am doing. A post with all the links in it (e.g. Part 1, Part 2, part 3) etc.

Hm, This works for getting the current title, thanks. I’m going to figure out if I can get the title of another page

Much thanks though

For those that are wondering how I did this

In my layout/shortcodes, I created the following shortcode:

{{ with .Site.GetPage "page" (.Get 0) }}
{{ .Title }}
{{ end }}

Then, I can start using it in Markdown like

{{% title "post/about.md" %}}

Much thanks to @gaetawoo for pointing me in the right direction

1 Like