{{ "<!-- details page -->" | safeHTML }}
<section>
  <div class="container-fluid">
    <div class="row">
      <div class="col-xl-2 col-lg-3 col-md-4 d-none d-md-block">
        <ul class="{{ if gt .WordCount 100 }}vh-100{{ end }} sidenav pt-4 pe-4 ps-0 border-end border-default">
          {{ $currentNode := . }}
          {{range .Site.Home.Sections.ByWeight}}
          <!-- not render any single page, like contact page. -->
          {{ $numberOfMainPages := len .Pages }}
          {{ if eq $numberOfMainPages 0 }}
          {{ else }}
          <!-- /not render any single page, like contact page. -->
          {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode}}
          {{ end }}
          {{ end }}
        </ul>
      </div>
      <div class="col-xl-8 col-lg-9 col-md-8">
        <div class="px-lg-5 px-sm-4 pt-5">
          <h2 class="mb-4 fw-bold">{{ .Title }}</h2>
          {{ if .Content }}
          <div class="content" data-bs-spy="scroll" data-bs-target="#TableOfContents" data-bs-offset="20">{{.Content}}
          </div>
          {{ else }}
          <div class="page-list">
            {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode }}
          </div>
          {{ end }}

          <nav class="pagination">
            <!-- Next prev page -->
            {{- $currentNode := . -}}
            {{- template "menu-nextprev" dict "menu" .Site.Home "currentnode" $currentNode -}}
            {{- define "menu-nextprev" -}}
              {{- $currentNode := .currentnode -}}
              {{- if ne .menu.Params.hidden true -}}
                {{- if hasPrefix $currentNode.Permalink .menu.Permalink -}}
                  {{- $currentNode.Scratch.Set "NextPageOK" "OK" -}}
                  {{- $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") -}}
                {{- else -}}
                  {{- if eq ($currentNode.Scratch.Get "NextPageOK") "OK" -}}
                    {{- $currentNode.Scratch.Set "NextPageOK" nil -}}
                    {{- $currentNode.Scratch.Set "nextPage" .menu -}}
                  {{- end -}}
                {{- end -}}
                {{- $currentNode.Scratch.Set "prevPageTmp" .menu -}}
                {{- $currentNode.Scratch.Set "pages" .menu.Pages -}}
                {{- if .menu.IsHome -}}
                  {{- $currentNode.Scratch.Set "pages" .menu.Sections -}}
                {{- else if .menu.Sections -}}
                  {{- $currentNode.Scratch.Set "pages" (.menu.Pages | union .menu.Sections) -}}
                {{- end -}}
                {{- $pages := ($currentNode.Scratch.Get "pages") -}}
    
                {{- range $pages.ByWeight -}}
                  {{- template "menu-nextprev" dict "menu" . "currentnode" $currentNode -}}
                {{- end -}}
              {{- end -}}
            {{- end -}}
            
                
            {{- with ($.Scratch.Get "prevPage") -}}
            <a class="nav nav-prev" href="{{.RelPermalink }}"><i class="fas fa-chevron-left me-2"></i>
              <span class="d-none d-sm-block">{{.Title}}</span> <span class="d-block d-sm-none">Prev</span>
            </a>
            {{ end -}}
            {{- with ($.Scratch.Get "nextPage") -}}
            <a class="nav nav-next" href="{{.RelPermalink }}">
              <span class="d-none d-sm-block">{{.Title}}</span> <span class="d-block d-sm-none">Next</span><i class="fas fa-chevron-right ms-2"></i>
            </a>
            {{- end }}
          </nav>
        </div>
      </div>
      {{ if .Site.Params.table_of_content }}
      {{ if gt .WordCount 200 }}
      <div class="col-lg-2 d-none d-xl-block">
        {{ .TableOfContents }}
      </div>
      {{ end }}
      {{ end }}
    </div>
  </div>
</section>
{{ "<!-- /details page -->" | safeHTML }}

<!-- templates -->
{{ define "section-tree-nav" }}
{{ $showvisitedlinks := .showvisitedlinks }}
{{ $currentNode := .currentnode }}
{{ with .sect }}
{{ safeHTML .Params.head }}
{{ $fileUniqueID := "" }}
{{ with .File }}{{ $fileUniqueID = .UniqueID }}{{ end }}
{{ $currentNodeFileUniqueID := "" }}
{{ with $currentNode.File }}{{ $currentNodeFileUniqueID = .UniqueID }}{{ end }}
<li data-nav-id="{{.Permalink}}" title="{{.Title}}" class="sidelist {{if .IsAncestor $currentNode }}parent{{end}} {{if eq $fileUniqueID $currentNodeFileUniqueID}}active parent{{end}}">
  <a href="{{.Permalink}}">{{.Title }}</a>
  {{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
  {{ if ne $numberOfPages 0 }}
  <ul>
    {{ $currentNode.Scratch.Set "pages" .Pages }}
    {{ if .Sections}}
    {{ $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }}
    {{ end }}
    {{ $pages := ($currentNode.Scratch.Get "pages") }}

    {{ range $pages.ByWeight }}
    {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode }}
    {{ end }}
  </ul>
</li>
{{ end }}
{{ end }}
{{ end }}


<!-- call to action -->
{{ if .Site.Params.call_to_action.enable }}
{{ with .Site.Params.call_to_action }}
<section class="section">
  <div class="container">
    <div class="row align-items-center">
      <div class="col-lg-4 text-center d-lg-block d-none">
        {{ partial "image.html" (dict "Src" .image) }}
      </div>
      <div class="col-lg-8 text-lg-left">
        <h2 class="mb-3 fw-bold">{{ .title | markdownify }}</h2>
        <p>{{ .content | markdownify }}</p>
        {{ if .button.enable }}
        {{ with .button }}
        <a href="{{ .link | absLangURL }}" class="btn btn-primary">{{ .label }}</a>
        {{ end }}
        {{ end }}
      </div>
    </div>
  </div>
</section>
{{ end }}
{{ end }}
<!-- /call to action -->