{{ define "main" }}

<div class="col-lg-4 col-xl-3">

  <div class="author-banner bg-primary-light text-center d-flex flex-column align-items-center justify-content-center">

  <h1 class="h5">Odoo Community Hosting Tips, Tutorials & Best Practices </h1>

    {{ with site.GetPage "/about" }}
    {{ if .Params.image }}
    <img  class="mb-4 rounded-circle w-100" style="max-width:280px" src="{{ .Params.image | absURL }}" alt="Author">
    {{ else if .Params.email }}
    <img class="mb-4 rounded-circle w-100" style="max-width:280px" src="https://www.gravatar.com/avatar/{{ md5 .Params.email }}?s=220&pg&d=identicon">
    {{ end }}
    <p class="text-uppercase small mb-2">{{ i18n `my_name_is` }}</p>
    <h2 class="h3 text-primary font-primary mb-3">{{ .Params.name }}</h2>
    <div class="mb-0 mx-auto" style="max-width:460px">{{ .Params.summary }} <a href="{{ .Permalink }}" aria-label="About me" class="text-underline d-inline-block">{{ i18n `read_more` }}</a></div>
    {{ end }}
    <ul class="social-links is-circled list-unstyled list-inline font-weight-500">
      {{ range .Site.Params.social }}
      <li class="list-inline-item"><a href="{{.link}}" title="{{.title}}">
          <i class="icon {{.icon}}"></i> {{.title}}
        </a></li>
        {{ end }}
    </ul>

  </div>
</div>
<div class="col-lg-8 col-xl-9">
  <div class="section">
    <div class="row">
      {{ $paginator := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) }}
      {{ range $paginator.Pages }}
      <div class="col-xl-4 col-sm-6">
        {{ .Render "article" }}
      </div>
      {{ end }}
    </div>

    <div class="row">
      <div class="col-12">
        {{"<!-- pagination -->" | safeHTML }}
        {{ $paginator := .Paginator }}
        <!-- Number of links either side of the current page. -->
        {{ $adjacent_links := 2 }}
        <!-- $max_links = ($adjacent_links * 2) + 1 -->
        {{ $max_links := (add (mul $adjacent_links 2) 1) }}
        <!-- $lower_limit = $adjacent_links + 1 -->
        {{ $lower_limit := (add $adjacent_links 1) }}
        <!-- $upper_limit = $paginator.TotalPages - $adjacent_links -->
        {{ $upper_limit := (sub $paginator.TotalPages $adjacent_links) }}
        <!-- If there's more than one page. -->
        {{ if gt $paginator.TotalPages 1 }}
        <nav class="mb-3">
          <ul class="pagination justify-content-center">
            <!-- Previous page. -->
            {{ if $paginator.HasPrev }}
            <li class="page-item"><a class="page-link arrow" href="{{ $paginator.Prev.URL }}" aria-label="Pagination Arrow">
              <i class="fas fa-angle-left"></i>
            </a></li>
            {{ end }}
            <!-- Page numbers. -->
            {{ range $paginator.Pagers }}
            {{ $.Scratch.Set "page_number_flag" false }}
            <!-- Advanced page numbers. -->
            {{ if gt $paginator.TotalPages $max_links }}
            <!-- Lower limit pages. -->
            <!-- If the user is on a page which is in the lower limit.  -->
            {{ if le $paginator.PageNumber $lower_limit }}
            <!-- If the current loop page is less than max_links. -->
            {{ if le .PageNumber $max_links }}
            {{ $.Scratch.Set "page_number_flag" true }}
            {{ end }}
            <!-- Upper limit pages. -->
            <!-- If the user is on a page which is in the upper limit. -->
            {{ else if ge $paginator.PageNumber $upper_limit }}
            <!-- If the current loop page is greater than total pages minus $max_links -->
            {{ if gt .PageNumber (sub $paginator.TotalPages $max_links) }}
            {{ $.Scratch.Set "page_number_flag" true }}
            {{ end }}
            <!-- Middle pages. -->
            {{ else }}
            {{ if and ( ge .PageNumber (sub $paginator.PageNumber $adjacent_links) ) ( le .PageNumber (add $paginator.PageNumber $adjacent_links) ) }}
            {{ $.Scratch.Set "page_number_flag" true }}
            {{ end }}
            {{ end }}
            <!-- Simple page numbers. -->
            {{ else }}
            {{ $.Scratch.Set "page_number_flag" true }}
            {{ end }}
            <!-- Output page numbers. -->
            {{ if eq ($.Scratch.Get "page_number_flag") true }}
            <li class="page-item">
              <a href="{{ .URL }}" class="page-link{{ if eq . $paginator }} active {{ end }}">
                {{ .PageNumber }}
              </a>
            </li>
            {{ end }}
            {{ end }}
            <!-- Next page. -->
            {{ if $paginator.HasNext }}
            <li class="page-item"><a class="page-link arrow" href="{{ $paginator.Next.URL }}" aria-label="Pagination Arrow">
              <i class="fas fa-angle-right"></i>
            </a></li>
            {{ end }}
          </ul>
        </nav>
        {{ end }}
      </div>
    </div>


    {{ if site.Params.subscription.enable }}
    {{ with site.Params.subscription }}
    <div class="section pb-0">
      <div class="row">
        <div class="col-12">
          <div class="newsletter-block bg-primary-light font-primary">
            <div class="row align-items-center">
              <div class="col-12">
                <h3 class="mb-0">{{ i18n `subscribe_title` }}</h3>
              </div>
              <div class="col-12 mt-4">
                <form action="{{ .mailchimp_form_action }}" name="{{ .mailchimp_form_name }}" method="post">
                  <div class="input-group">
                    <input type="text" class="form-control pl-3" placeholder="{{ i18n `enter_your_email`}}" aria-label="{{ i18n `enter_your_email`}}" required>
                    <div class="input-group-append">
                      <button type="submit" class="input-group-text pr-3" aria-label="News-letter"><i class="far fa-paper-plane"></i>
                      </button>
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    {{ end }}
    {{ end }}
    
    <div class="mt-4 pt-1">
      {{ partial "footer.html" . }}
    </div>

  </div>
</div>

{{ end }}
