hugo-theme-moments/layouts/partials/row.html
2021-09-02 21:09:09 +08:00

121 lines
No EOL
5.1 KiB
HTML

<div class="moment-row">
<div class="pure-g">
<!-- time -->
<div class="pure-u-1 pure-u-sm-1-3">
<div class="time">
<div class="month-day">{{ .Date.Format "Jan 2"}}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22)
.Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }}</div>
<div class="year">{{ .Date.Format "2006"}}</div>
</div>
</div>
<!-- moment-content -->
<div class="pure-u-1 pure-u-sm-2-3">
<div class="moment-content">
<!-- top mark -->
{{ if gt .Params.top 0}}
<div class="top-mark" style="position: absolute; right: 5%;">
<i class="fas fa-bookmark" style="color: #e76b4f;"></i>
</div>
{{ end }}
<!-- user info -->
<div class="user-info">
<div class="avatar-block">
{{ with .Params.avatar }}
<img src='{{ . }}' class="avatar">
{{ else }}
<!-- fixme check whether the default avatar path is url or not-->
<img src='{{ $.Site.BaseURL }}/{{ .Site.Params.avatar }}' class="avatar">
{{ end }}
</div>
<div class="intro">
{{ with .Params.name }}
<div class="name">{{ . }}</div>
{{ else }}
<div class="name">{{ .Site.Params.name }}</div>
{{ end }}
<div>
{{ $tags_filtered := slice}}
{{ with .Params.tags }}
{{ range . }}
{{ with .}}
{{ $tags_filtered = $tags_filtered | append . }}
{{ end }}
{{ end }}
{{ end }}
{{ with $tags_filtered }}
{{ range . }}<span class="tag text-muted">{{ . }}</span>{{ end }}
{{ end }}
</div>
</div>
</div>
<div style="padding-left: 5px; padding-right: 5px;">
<!-- content -->
<div class="context">
{{ .Content }}
</div>
<!-- add-on info 1: pictures -->
<!-- single picture (old version)-->
{{ with .Params.pic }}
<img src="{{ . }}" class="single-pic" alt="Responsive image" data-fancybox="gallery"></img>
{{ end }}
<!-- multiple pictures (old version) -->
{{ $pic_set_filtered := slice}}
{{ with .Params.pic_set }}
{{ range . }}
{{ with . }}
{{ $pic_set_filtered = $pic_set_filtered | append . }}
{{ end }}
{{ end }}
{{ end }}
{{ with $pic_set_filtered }}
{{ partial "pic_set.html" (dict "pic_set" .) }}
{{ end }}
<!-- new pictures API (combine single & multiple pictures)-->
{{ $pictures_set:= slice}}
{{ with .Params.pictures }}
{{ range . }}
{{ with . }}
{{ $pictures_set = $pictures_set | append . }}
{{ end }}
{{ end }}
{{ end }}
{{ if (eq (len $pictures_set) 1) }}
{{ range $pictures_set }}
<img src="{{ . }}" class="single-pic" alt="Responsive image" data-fancybox="gallery"></img>
{{ end }}
{{ end }}
{{ if (gt (len $pictures_set) 1)}}
{{ partial "pic_set.html" (dict "pic_set" $pictures_set) }}
{{ end }}
<!-- add-on info 2: link -->
{{ $link_link := .Params.link }}
{{ $link_logo := .Params.link_logo }}
{{ $link_text := .Params.link_text }}
{{ with .Params.link }}
{{ partial "link-block.html" (dict "logo" $link_logo "a" $link_link "word" $link_text "baseurl"
$.Site.BaseURL)}}
{{ end }}
<!-- Note info -->
<div class="moment-note">
<p class="note">{{ .Date.Format "15:04" }} {{ .Params.note }}</p>
<div style="padding-right: 12px;"><i class="far fa-heart"></i></div>
</div>
</div>
<hr style="clear: both">
</div>
</div>
</div>
</div>