{{ define "title" }}
  {{ .Title }} – {{ .Site.Title }}
{{ end }}

{{ define "hero" }}
<section class="hero">
     <h1>Rancher Docs</h1>

    {{ with .Params.Author }}
      <span class="byline bg-link">{{ . }}</span>
    {{end}}
</section>
{{ end }}

{{ define "main" }}
  <div class="wrapper">
    {{ partial "docs-nav.html" . }}
    {{ $secondLevel := ($.Scratch.Get "secondLevel") }}
    {{ $.Scratch.Set "showSidebar" false }}
    {{ with $secondLevel }}
      {{ if (gt (len .Sections) 0) }}
        {{ $.Scratch.Set "showSidebar" true }}
      {{end}}
    {{end}}

    <div class="row m-t-sm">

      {{ if ($.Scratch.Get "showSidebar") }}
        <aside class="col-sm-3 col-xs-12 p-l-0">
          {{ partial "docs-side-nav.html" . }}
        </aside>
      {{end}}
      <article class="{{ if ($.Scratch.Get "showSidebar") }} col-sm-7 {{else}} col-md-9 p-r-lg {{end}} col-xs-12">

        <div class="main-content ">
        {{ with .Params.Title }}
          <h2 class="m-t-0">{{ . }}</h2>
        {{end}}
        {{ .Content }}

        {{ range (.Paginator 5).Pages }}
          <div class="box m-b-md">
              <div class="p-a-sm">
                <h3><a href="{{.URL}}">{{.Title}}</a></h3>

                {{ if .Params.Image }}
                  <div class="thumbnail"><img src="{{ .Params.Image }}" alt="{{ .Params.Title }}"></div>
                {{end}}

                <p>{{ .Summary | safeHTML }}</p>
                {{ if .Truncated }}
                <div>
                  <a href="{{ .RelPermalink }}">Read More…</a>
                </div>
                {{ end }}
              </div>
              <div class="bg-default">
                <div class="row">

                  {{ with .Params.Author }}
                    <div class="p-h-sm p-v-xs"><i class="material-icons">person_outline</i> By: {{ . }}</div>
                  {{end}}

                  {{ if eq .Section "events" }}
                    {{ with .Params.EventDate }}
                      <div class="p-h-sm p-v-xs"><i class="material-icons">event</i> {{ . }}</div>
                    {{end}}

                  {{ else }}

                    {{ with .Params.Date }}
                      <div class="p-h-sm p-v-xs"><i class="material-icons">event</i> {{ .Format "January 2, 2006" }}</div>
                    {{end}}
                  {{end}}

                  {{ if eq .Section "blog" }}
                    <div class="p-h-sm p-v-xs"><i class="material-icons">timer</i> Read Time: {{.ReadingTime}} minutes</div>
                  {{end}}

                  {{ with .Params.Location }}
                    <div class="p-h-sm p-v-xs"><i class="material-icons">location_on</i> {{ . }}</div>
                    {{end}}

                </div>
              </div>
          </div>
          {{ end }}
        </div>
        {{ template "_internal/pagination.html" . }}


        <div class="p-v-xs">{{ partial "page-edit.html" . }}</div>

      </article>
      {{ with .TableOfContents }}
        <div class="offset-watch invisible"></div>
        <aside class="col-sm-2 col-xs-12 unstyled toc-container hidden-md">
          <h4 class="m-b-0">On this page</h4>
          {{ . }}
        </aside>
      {{ end }}
    </div>
  </div>
{{ end }}
