Skip to content

Commit

Permalink
Template code styles.
Browse files Browse the repository at this point in the history
  • Loading branch information
frjo committed Sep 30, 2023
1 parent 340aa48 commit 5d13028
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
25 changes: 15 additions & 10 deletions layouts/products/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ <h1 class="title">{{ .Title }}</h1>
</header>

{{ with .Content -}}
<div class="content">
{{ . }}
</div>
<div class="content">
{{ . }}
</div>
{{ end -}}

<div id="js-list">
{{ if $.Param "listsort" -}}
<div class="filter margin-top">
<input class="fuzzy-search" placeholder="Search">
<input type="search" class="fuzzy-search" placeholder="Search">

<select class="js-filter-1">
<option value="">Tags</option>
{{ range site.Taxonomies.tags -}}
<option value="{{ .Page.Title }}">{{ .Page.Title }}</option>
<option value="{{ .Page.Title }}">{{ .Page.Title }}</option>
{{ end -}}
</select>

<select class="js-filter-2">
<option value="">Categories</option>
{{ range site.Taxonomies.categories -}}
<option value="{{ .Page.Title }}">{{ .Page.Title }}</option>
<option value="{{ .Page.Title }}">{{ .Page.Title }}</option>
{{ end -}}
</select>

Expand All @@ -41,12 +41,17 @@ <h1 class="title">{{ .Title }}</h1>

<table class="list-table">
<thead>
<tr><th class="sort" data-sort="products">Product</th><th class="sort" data-sort="tags">Tags</th><th class="sort" data-sort="categories">Categories</th><th class="sort" data-sort="date">Date</th></tr>
<tr>
<th class="sort" data-sort="products">Product</th>
<th class="sort" data-sort="tags">Tags</th>
<th class="sort" data-sort="categories">Categories</th>
<th class="sort" data-sort="date">Date</th>
</tr>
</thead>
<tbody class="js-items">
{{ range .Pages -}}
{{ .Render "tr" }}
{{ end -}}
{{ range .Pages -}}
{{ .Render "tr" }}
{{ end -}}
</tbody>
</table>

Expand Down
33 changes: 16 additions & 17 deletions layouts/products/tr.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<tr>
<td class="products">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</td>
<td class="products">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</td>

<td class="tags">
{{- $tags := slice -}}
{{- range (.GetTerms "tags") }}{{ $tags = $tags | append .LinkTitle }}{{ end -}}
{{- delimit $tags ", " -}}
</td>
<td class="tags">
{{- $tags := slice -}}
{{- range (.GetTerms "tags") }}{{ $tags = $tags | append .LinkTitle }}{{ end -}}
{{- delimit $tags ", " -}}
</td>


<td class="categories">
{{- $categories := slice -}}
{{- range (.GetTerms "categories") }}{{ $categories = $categories | append .LinkTitle }}{{ end -}}
{{- delimit $categories ", " -}}
</td>

<td class="date">
<time class="created-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format ($.Param "dateformat" | default "2 January, 2006") }}</time>
</td>
<td class="categories">
{{- $categories := slice -}}
{{- range (.GetTerms "categories") }}{{ $categories = $categories | append .LinkTitle }}{{ end -}}
{{- delimit $categories ", " -}}
</td>

<td class="date">
<time class="created-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format ($.Param "dateformat" | default "2 January, 2006") }}</time>
</td>
</tr>

0 comments on commit 5d13028

Please sign in to comment.