Skip to content
Snippets Groups Projects
event.html 1.84 KiB
Newer Older
Arnaud Levy's avatar
Arnaud Levy committed
{{ $event := .event }}
{{- $direction := "" -}}
{{ $heading := .heading | default "h2" }}
{{ $heading_tag := (dict 
    "open" ((printf "<%s itemprop='headline'>" $heading) | safeHTML)
    "close" ((printf "</%s>" $heading) | safeHTML)
    ) }}
{{ $index := .index}}
{{ $alternate := .alternate}}

{{ with $event }}

{{ if .Params.image }}
  {{- $direction = partial "GetImageDirection" .Params.image -}}
{{ end }}

Arnaud Levy's avatar
Arnaud Levy committed
<article class='event {{ if $alternate }}{{ $direction }} {{if not (modBool $index 2)}}left{{ else}}right{{end}}{{end}}' itemprop="events" itemscope itemtype="https://schema.org/Event">
Arnaud Levy's avatar
Arnaud Levy committed
  <div class="event-content">
    {{- $title := partial "PrepareHTML" .Title -}}

    {{ $heading_tag.open }}
      <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}">{{ $title }}</a>
    {{ $heading_tag.close }}

    {{ if site.Params.events.index.show_description }}
      {{- if (partial "GetTextFromHTML" .Params.summary) -}}
Arnaud Levy's avatar
Arnaud Levy committed
        <p itemprop="articleBody">
          {{ if site.Params.events.index.truncate_description }}
            {{ partial "GetTruncateContent" ( dict 
              "text" .Params.summary
              "length" site.Params.events.index.truncate_description
              ) }}
          {{ else }}
            {{ partial "PrepareText" .Params.summary }}
          {{ end }}
        </p>
Arnaud Levy's avatar
Arnaud Levy committed
      {{- end -}}
    {{- end -}}
    
Arnaud Levy's avatar
Arnaud Levy committed
    <div class="event-dates">
Arnaud Levy's avatar
Arnaud Levy committed
      {{ .Params.dates.computed.short }}
Arnaud Levy's avatar
Arnaud Levy committed
    </div>
  </div>
  <div class="media">
    {{- if .Params.image -}}
      {{- partial "commons/image.html"
            (dict
              "image"    .Params.image
              "sizes"    site.Params.image_sizes.sections.events.item
            ) -}}
    {{- else if site.Params.events.default_image -}}
      {{- partial "commons/image-default.html" -}}
    {{- end -}}
  </div>
</article>
{{ end }}