{{ define "main" }}


  <section class="section pt-7">
    <div class="container">
      <div class="row justify-center">
        <article class="lg:col-10">
          {{ $image:= .Params.image }}
          {{ if $image }}
            <div class="mb-10">
              {{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "w-full rounded") }}
            </div>
          {{ end }}
          <h1 class="h2 mb-4">
            {{ .Title }}
          </h1>
          <div class="lieu">
            <i class="fas fa-map-marker-alt"></i> {{ .Params.location }}
          </div>
          {{ $format := "2 Jan 2006 à 15:04" }}
          <div class="lieu">
            <i class="fas fa-calendar-alt"></i> {{dateFormat $format .Params.date_evt }}
          </div>
          <ul class="mb-4">
            {{ if .Params.Author }}
            <li class="mr-4 inline-block">
              <a
                href="{{ `authors/` | relLangURL }}{{ .Params.Author | urlize }}/">
                <i class="fa-regular fa-circle-user mr-2"></i
                >{{ .Params.author }}
              </a>
            </li>
            {{ end }}
            {{ $categories:= .Params.categories }}
            {{ if $categories }}
              <li class="mr-4 inline-block">
                <i class="fa-regular fa-folder mr-2"></i>
                {{ range $i,$p:= $categories }}
                  <a
                    href="{{ `categories/` | relLangURL }}{{ . | urlize | lower }}/"
                    class=""
                    >{{ . | humanize }}{{ if ne $i (sub (len $categories) 1) }}
                      {{ "," }}
                    {{ end }}
                  </a>
                {{ end }}
              </li>
            {{ end }}
            {{ if .Date }}
            <li class="mr-4 inline-block">
              <i class="fa-regular fa-clock mr-2"></i>
              {{ time.Format ":date_long" .PublishDate }}
            </li>
            {{ end }}
          </ul>
          <div class="content mb-10">
            {{ .Content }}
          </div>
          <div class="row items-start justify-between">
            {{ $tags:= .Params.tags }}
            {{ if $tags }}
              <div class="lg:col-5 mb-10 flex items-center lg:mb-0">
                <h5 class="mr-3">{{ T "tags" }} :</h5>
                <ul>
                  {{ range $i,$p:= $tags }}
                    <li class="inline-block">
                      <a
                        class="bg-theme-light hover:bg-primary dark:bg-darkmode-theme-light dark:hover:bg-darkmode-primary dark:hover:text-dark m-1 block rounded px-3 py-1 hover:text-white"
                        href="{{ `tags/` | relLangURL }}{{ . | urlize | lower }}/">
                        {{ . | humanize }}
                      </a>
                    </li>
                  {{ end }}
                </ul>
              </div>
            {{ end }}

          </div>
          {{ if .Params.url_info }}
          <div class="url_info">
            <a href="{{ .Params.url_info | safeURL }}" target="_blank" rel="noopener nofollow">
              <i class="fas fa-globe"></i> {{ .Params.url_info }}
            </a>
          </div>
          {{ end }}
        </article>
      </div>

      <!-- Related posts -->
      {{ $related := (where site.RegularPages "Section" "in" "agenda") | intersect (where site.RegularPages ".Params.date_evt" "!=" .Params.date_evt)  }}
      {{ $related = $related | first 3 }}
      {{ with $related }}
        <div class="section pb-0">
          <h2 class="h3 mb-12">{{ T "Evts_a_venir" }}</h2>
          <div class="row">
            {{ range . }}
              <div class="lg:col-4 md:col-6 mb-14">
                {{ partial "components/event-card" . }}
              </div>
            {{ end }}
          </div>
        </div>
      {{ end }}
    </div>
  </section>
{{ end }}
