single.html 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. {{ define "head" }}
  2. {{ if .Params.featuredImg -}}
  3. <style>.bg-img {background-image: url('{{.Params.featuredImg | absURL}}');}</style>
  4. {{- else if .Params.images -}}
  5. {{- range first 1 .Params.images -}}
  6. <style>.bg-img {background-image: url('{{. | absURL}}');}</style>
  7. {{- end -}}
  8. {{- end -}}
  9. {{ end }}
  10. {{ define "header" }}
  11. {{ partial "header.html" . }}
  12. {{ end }}
  13. {{ define "main" }}
  14. {{- if (or .Params.images .Params.featuredImg) }}
  15. <div class="bg-img"></div>
  16. {{- end }}
  17. <main class="site-main section-inner thin animated fadeIn faster">
  18. <h1>{{ .Title }}</h1>
  19. <div class="content">
  20. {{ .Content | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" `${1}<a href="#${2}" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path><line x1="8" y1="12" x2="16" y2="12"></line></svg></a>${3}` | safeHTML }}
  21. </div>
  22. {{ with .Params.comments -}}
  23. {{ partialCached "comments.html" . }}
  24. {{- end }}
  25. </main>
  26. {{ end }}
  27. {{ define "footer" }}
  28. {{ partialCached "footer.html" . }}
  29. {{ end }}