tedcm
1
I have a blog that posts some data daily.
Data are pulled from the front matter:
---
cms: true
data: 123456
---
and rendered in a table:
{{ if .Params.cms }}
<table>
<thead>
<tr>
<th>Date</th>
<th>Data</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ .PublishDate.Format "January 2, 2006" }}</td>
<td>{{ .Params.data }}</td>
</tr>
</tbody>
</table>
{{ else }}
{{ .Content }}
{{ end }}
I’m trying to create a summary page that updates every time a new post is posted.
Thank you.
Is data always an integer or float? Or could it be a string? Or boolean?
tedcm
3
Sorry for the incomplete details.
I was able to solve with simple range:
{{ if .Params.cms }}
<table>
<thead>
<tr>
<th>Date</th>
<th>Data</th>
</tr>
</thead>
<body>
{{ range where .Site.RegularPages "Section" "summary" }}
<tr>
<td>{{ .PublishDate.Format "January 2, 2006" }}</td>
<td>{{ .Params.data }}</td>
</tr>
</tbody>
</table>
{{ else }}
{{ .Content }}
{{ end }}
Thank you.
system
Closed
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.