{{ if fileExists ( path.Join $.Page.File.Dir "comments.md" ) }}
<!--<section id="comments">
  <h2 class="subheading subheading--comments" id="comments">Comments</h2>
  <ol>
  {{ $file := path.Join $.Page.File.Dir "comments.md" | readFile }}
  {{ $file | .RenderString }}
  </ol>
</section>-->
{{ end }}

<footer class="site-content__footer">
  <h2>Meta</h2>
    
  {{- if .GetTerms "categories" -}}
    <section id="post-categories" class="article-footer__categories" aria-labelledby="post-categories-title" itemprop="articleSection">
      <h3 id="post-categories-title">Categories</h3>
      <ul>
      {{- range (.GetTerms "categories") -}}
        <li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
      {{- end -}}
      </ul>
    </section>
  {{- end -}}
  
  {{- if .GetTerms "areas" -}}
    <section class="article-footer__links" itemprop="articleSection">
      <h3 id="item-areas-title">Areas</h3>
      <ul>
      {{- range ( .GetTerms "areas" ).ByTitle -}}
        <li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
      {{- end -}}
      </ul>
    </section>
  {{- end -}}
  
  {{- if .GetTerms "skills" -}}
    <section class="article-footer__links" itemprop="articleSection">
      <h3 id="item-skills-title">Skills</h3>
      <ul>
      {{- .Scratch.Set "i" 0 -}}
      {{- range ( .GetTerms "skills" ).ByTitle -}}
        {{- if hasPrefix .LinkTitle "CIISec/" -}}
          <li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> <span class="level">{{ index $.Params.skills_ciisec_levels ( $.Scratch.Get "i" ) }}</span></li>
          {{- $.Scratch.Add "i" 1 -}}
        {{- else -}}
          <li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
        {{- end -}}
      {{- end -}}
      </ul>
    </section>
  {{- end -}}
  
  {{- if .GetTerms "organisations" -}}
    <section id="post-organisations" class="article-footer__organisations" aria-labelledby="post-organisations-title" itemprop="articleSection">
      <h3 id="post-organisations-title">Organisations</h3>
      <ul>
      {{ $all_organisations := partialCached "get_all_organisations.html" . }}
      <!-- TODO: Replace with hierarchy partial -->
      {{- range ( .GetTerms "organisations" ) -}}
          {{ with ( where $all_organisations "Title" ( .Title | plainify ) ) }}
            {{ range . }}
              <li><a href="{{ .RelPermalink }}">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</a></li>
            {{ end }}
          {{ else }}
            {{ warnf "Could not find organisation %q (%q)" .Title $.File.Path }}
              <li>{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</li>
          {{ end }}
      {{- end -}}
      </ul>
    </section>
  {{- end -}}
  
  {{- if .GetTerms "locations" -}}
    <section id="post-locations" class="article-footer__locations" aria-labelledby="post-locations-title">
      <h3 id="post-locations-title">Locations</h3>
      <div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
      <ul style="display: none">
      {{- range ( .GetTerms "locations" ).ByTitle -}}
        <li class="p-location"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
      {{- end -}}
      </ul>
    </section>
  {{- end -}}
  
  {{- if .GetTerms "tags" -}}
    <section id="post-tags" class="article-footer__tags" aria-labelledby="post-tags-title">
      <h3 id="post-tags-title">Tags</h3>
      <ul>
      {{- range ( .GetTerms "tags" ).ByTitle -}}
        <li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
      {{- end -}}
      </ul>
    </section>
  {{- end -}}
</footer>