single.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {{- define "main" }}
  2. {{- $scratch := newScratch }}
  3. {{- if isset .Params "image" }}
  4. {{- $scratch.Set "image" .Params.image }}
  5. {{- else }}
  6. {{ $scratch.Set "image" .Site.Params.fallBackOgImage }}
  7. {{- end }}
  8. {{- $image := $scratch.Get "image" }}
  9. {{- $bg := (path.Join "images" $image | absLangURL) }}
  10. {{- $show_toc := (and .Params.toc (gt (len .TableOfContents) 80)) }}
  11. <div class="wrap content {{ if $show_toc }}grid-inverse{{- else }}without-toc{{ end }} {{ if eq .Type "posts" }}type-post{{ end }}">
  12. <article class="post_content">
  13. {{- partial "i18nlist" . }}
  14. <h1 class="post_title">{{ .Title }}</h1>
  15. {{- partial "post-meta" . }}
  16. {{ partial "share" . }}
  17. {{ with .Params.featureImage }}
  18. <img src="{{ . }}" class="image_featured">
  19. {{ end }}
  20. <div class="js-toc-content">
  21. {{- .Content }}
  22. </div>
  23. {{ if eq .Type "posts" }}
  24. <div style="border: 2px solid #efefef; padding: 2rem; margin-top: 2rem;">
  25. {{ partial "subscriber-form" . }}
  26. </div>
  27. {{ if and ( ne .Site.Params.comment false ) ( ne .Params.comment false ) }}
  28. {{ partial "comments" . }}
  29. {{ end }}
  30. {{ partial "related-posts" . }}
  31. {{ end }}
  32. </article>
  33. {{ if $show_toc }}
  34. <aside class="sidebar">
  35. <section class="sidebar_inner">
  36. <div class="sticky-toc">
  37. <div class="js-toc"></div>
  38. </div>
  39. <!-- {{ .TableOfContents }} -->
  40. </section>
  41. </aside>
  42. {{ end }}
  43. </div>
  44. {{- end }}