MATH201/themes/zettels/layouts/_default/single.html

51 lines
1.4 KiB
HTML

{{ define "main" }}
<p style="text-align: center;"><a href=./>Back to index</a></p>
{{ $.Scratch.Set "title" "" }}
{{ if ne (.Param "bear") true }}
<h1>{{ .Title }}</h1>
{{$.Scratch.Set "title" .Title }}
{{ else }}
{{ $.Scratch.Set "title" .File.BaseFileName }}
{{ end }}
{{ $title := $.Scratch.Get "title" }}
<!--
Protects content if the note has the "private" tag on the YAML
-->
{{- if and (isset .Params "private") (eq .Params.private true) -}}
{{ if .Site.IsServer }}
<p>&#128274;</p>
{{ partial "content.html" . }}
{{ else }}
<p>&#128274; {{ i18n "private-note" }}</p>
{{ end }}
{{- else -}}
<!--
If the note hasn't the "private" tag, but has the "private" word on its content, we want to protect the content.
This is because when using bear mode, we don't use yaml.
@todo:
- find a better way of doing this (this is false-positive prone)
- code refactor
-->
{{ $private := .Content | findRE "private-note" }}
{{ if le (len $private) 0 }}
{{ partial "content.html" . }}
{{ else }}
{{ if.Site.IsServer }}
<p>&#128274;</p>
{{ partial "content.html" .}}
{{ else }}
<h1>{{ $title }}</h1>
<p>&#128274; {{ i18n "private-note" }}</p>
{{ end }}
{{ end }}
{{- end -}}
{{/* partial "backlinks.html" . */}}
<p style="text-align: center;"><a href="./">Back to index</a></p>
{{ end }}