How to get the params on default.md in folder archetypes?

Hello, I added some params on default.md in folder archetypes, I do it like following

---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
description: ""
url: ""
shortname: ""
---

And I create two pages with this template, and I try to get the content via following code

{{range .Pages}}
{{ .Title }}
{{ .Date }}
{{ .Url}}
{{ . Shortname }}
{{end}}

And I get an error

execute of template failed: template: _default/big.html:26:28: executing "_default/big.html" at <.Url>: can't evaluate field Url in type page.

Please help me, thank you so much.

The console message is informative. There is no .Url Page variable and as such it cannot be evaluated. Use .Permalink or .RelPermalink.

Please have another look at the documentation:

@alexandros Thank you for the reply, and I know that, I mean can the Page variable be expanded, I want to add some, thank you so much.

I updated the code

---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
description: ""
...
url: "http://domain.com"
shortname: "shortcut"
...
---

But {{ .Params.url}} and {{ .Params.shortname}} get nothing.

The quoted front matter is not formatted properly.

Remove the dots ... for url and shortname to be picked up.

I find the issue, my mistake, thank you so much.

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