How to target specific post


I would like to create a section in my posts called “related posts”, but I want to target individually (instead of using newest posts or posts in the same category/tag).

In the front matter I have a new param called related. And I would like to add an array, like

related = ["", ""]

Then in the single.html file I have created for that type of content I would like to use a range to loop into those files.

So the question is: is it possible to build a post by a given filename? That way I can gather the Title, Permalink and summary, which is the data useful to create this widget I would like to create.


1 Like

Have a look at the cross reference feature. It allows you to link pages based on their path. Inside the templates you can use the equivalent functions.

For example:

{{ range .Params.related }}
    <a href="{{ ref . }}"></a>
{{ end }}