Customize Params question,I‘m new user

I have customized “.Params.ct_download_link” and “.Params.clic_download_link” in “single.html”, but each article header can only use “ct_download_link” and “.Params.clic_download_link” to pass only one link. How can I make “ct_download_link1”, "ct_download_link2"and “.Params.clic_download_link1” “.Params.clic_download_link2”… The cycle is called when publishing, that is, the same page outputs multiple different links

anyone can help me

Sorry, it’s hard to understand what you’re asking. Are you saying you want to put the URLs in your frontmatter in an array, so you can loop through them in your template?

On the markdown content file frontmatter, something like this? :


… and you want to “loop through” those, in your single.html?

Please forgive my poor English

.Params.ct_download_link in single.html

ct_download_link in .md file

I want ct_download_link1 ct_download_link2 ct_download_link3…… in .md file ,output different link

Ok, I see. You are getting errors? It’s possible that what you did will work if every page that is rendered by your single has that parameter. If not, hugo server will give an error, usually because some are missing.

You can use with to fix this. It acts like an if then statement.

...href="{{ with .Params.cd_download_link }}{{ . }}{{ end }}">...

no error ,now it’s worked,but every article only output “ct_download_link” and “clic_download_link”

“ct_download_link1” and “ct_download_link2”
“clic_download_link2” and “clic_download_link2”
can not work

Ah, ok. You’re telling hugo to go find a param clic_download_link but, not specifying it in your frontmatter. It won’t act like a wildcard.

If you want to make a list of urls of a certain type, you need to use range to loop over the urls and put them in like I mentioned first above.

You’re looking to show, say, a list of “ct” type links and another list of “clic” type links? An example from a single.html:

<p class="menu-label has-text-esolia-secondary-2-0">Tags</p>
  <div class="tags has-margin-l">{{ range .Params.tags }}
   <span class="tag is-rounded is-light"><a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a></span>{{ end }}

… given frontmatter like:

  - this
  - that

This just puts the tags I have in the frontmatter, in spans, between a div.

In fact, I just want to do a download of the historical version of the list, a version number corresponds to the download link for each disk, the other version number is still those disks, but it’s another version of the download link, so I need to be the same ct_download_link distinguishes 1 2 3 4 5… to distinguish different versions of download links

Sorry, not so sure what you want now. Do you mean you want to show the latest/last URL in the list only, but still have the others available? If so, you could adapt this:

So, instead of showing the comma you show the last listed URL.

just like this screenshots

version,update date,download link
one row every version, one to one correspondence

Take clicknUpload for example,version number 3.0,update date 2018.4.29,ClicknUpload download link in one row,add version number 3.1,update date 2018.4.30,ClicknUpload download link in one row, row and row correspondence