How to get the parameter of a list template?

Following a very good post, I managed to more or less get my head around how to use tags.

One problem which I struggle with is to understand how, in a list template, to get the “parameter” which led to that page.

Taking the example from the post above, specifically taxonomy list templates and reusing the code in this paragraph I indeed get in /tags/value_1 the bulleted list of pages tagged with the specific tag.

I would like to slightly change this code to:

<!-- layouts/taxonomy/tag.html -->

Below is a list of pages with tag {{ I do not know what to put here, it should be value_1 for page /tags/value_1 }}

  {{ range .Data.Pages }}
      <a href="{{.RelPermalink}}">{{ .Title }}</a>
  {{ end }}

In other words I am looking for the “parameter” passed to that list page (though the URL, so to speak), to be reused within this page

{{ .Page.Title }}

Thank you! It indeed works.

Would you know why this is this particular variable? Is this a rule that the last part of an URL is the {{ .Page.Title }}? (wildly speculating here)

{{ .Title }} should work the same way?? I copied it from my templates :wink:

access tag lists in a normal page

{{ range (.GetTerms "tags") -}}
  <a  href={{ .RelPermalink }}>{{ .LinkTitle }}</a>
{{- end}}

In taxonomies you have 2 lists :frowning:

I use the tmplate layout/tags/terms.html.html to list all tags (tag overview)
and list.html.html to list all pages for a single tag

my sample is here

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