Partial to loop through an array parameter, write the corresponding page title in a link to said page

Hi,
The purpose is in the title.
it has to : use items of an parameters to get a page context, and make a link to that page with its title as the title.
In a page I would use [{{<ref “page_title”>}}]({{<ref “page_title”>}})
but it’s different in a partial.
I can’t write that.
I started with:

{{with .Page.Params.Requirements}}
<section id=“requirements_list”>
<span>Read first:
<p>
{{ range . }}
{{ ref “{{.}}” }}{{ .Title }}{{ end }}
{{ end }}
</p>
</section>
{{ end }}

but from there I have no clue, and it’s stupidly complicated, for no reason. Once I know the equivalent of {{}} (and how to use it !!), I’ll write the link part just fine.

Thanks

structure

content/
├── posts/
│   └── test.md
├── requirements/
│   ├── dependencies.md
│   └── operating-system.md
└── _index.md

content/posts/test.md

+++
title = 'Test'
date = 2022-11-03T12:39:15-07:00
draft = false
requirements = ['/requirements/dependencies','/requirements/operating-system']
+++

layouts/partials/requirements-list.html

{{ with .Params.requirements }}
  {{ range . }}
    {{ with site.GetPage . }}
      <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
    {{ else }}
      {{ errorf "Unable to get page %q" . }}
    {{ end }}
  {{ end }}
{{ end }}

rendered

<a href="/requirements/dependencies/">Dependencies</a>
<a href="/requirements/operating-system/">Operating System</a>

Oh thanks.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.