Initial import of Hugo site to Forgejo

This commit is contained in:
Iman Alipour 2026-07-28 12:47:20 +00:00
commit cb1ba0317f
1259 changed files with 236349 additions and 0 deletions

View file

@ -0,0 +1,8 @@
{{ if not (.Page.Store.Get "mermaidLoaded") }}
<script src="{{ "js/mermaid.min.js" | relURL }}" defer></script>
<script src="{{ "js/init-mermaid-umd.js" | relURL }}" defer></script>
{{ .Page.Store.Set "mermaidLoaded" true }}
{{ end }}
<div class="mermaid">{{- .Inner -}}</div>

View file

@ -0,0 +1,7 @@
{{- /* pgpkey — show your ASCII-armored public key from static/keys/iman-alipour-pgp.asc */ -}}
{{- $path := .Get 0 | default "static/keys/iman-alipour-pgp.asc" -}}
{{- $key := readFile $path | htmlEscape -}}
<details>
<summary>Show ASCII-armored key</summary>
<pre style="font-size:0.85em; overflow-x:auto; padding:0.75rem;">{{$key}}</pre>
</details>

View file

@ -0,0 +1,9 @@
{{- /* Usage: {{< sig >}} or {{< sig "name.asc" >}}. Reads from .Page.File.Dir */ -}}
{{- $name := .Get 0 | default "signature.asc" -}}
{{- $dir := .Page.File.Dir -}}
{{- $sig := readFile (print $dir $name) | htmlEscape -}}
<details class="signature">
<summary>OpenPGP signature (.asc)</summary>
<pre style="font-size:0.85em; overflow-x:auto; padding:0.75rem;">{{$sig}}</pre>
</details>
<p><em>Verify:</em> <code>gpg --verify {{ $name }} {{ .Page.File.Path }}</code></p>

View file

@ -0,0 +1,63 @@
{{- /* sigdl — Download & Verify block for each post.
Usage: {{< sigdl >}}
Normalizes index.md/_index.md so links become /sources/<dir>.md
*/ -}}
{{- /* Compute a normalized relative path for the source */ -}}
{{- $rel := replace .Page.File.Path "content/" "" -}}
{{- $rel = replace $rel "/index.md" ".md" -}}
{{- $rel = replace $rel "/_index.md" ".md" -}}
{{- $download := printf "/sources/%s" $rel -}}
{{- $asc := printf "%s.asc" $download -}}
{{- $staticAscPath := printf "static%s.asc" $download -}}
{{- $sig := "" -}}
{{- if (fileExists $staticAscPath) -}}
{{- $sig = (readFile $staticAscPath) | htmlEscape -}}
{{- end -}}
{{/* Robust onion detection:
1) prefer --environment onion
2) else parse .Site.Params.isOnion (string-safe)
3) else check baseURL contains ".onion"
*/}}
{{- $isOnion := eq hugo.Environment "onion" -}}
{{- if not $isOnion -}}
{{- with .Site.Params.isOnion -}}
{{- $v := (printf "%v" . | lower) -}}
{{- if or (eq $v "true") (eq $v "1") (eq $v "yes") (eq $v "on") -}}
{{- $isOnion = true -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if and (not $isOnion) (in (lower (site.BaseURL)) ".onion") -}}
{{- $isOnion = true -}}
{{- end -}}
<div class="signature-block" style="margin-top:1rem">
<p><strong>Downloads:</strong>
<a href="{{ $download | relURL }}">Markdown</a> ·
<a href="{{ $asc | relURL }}">Signature (.asc)</a>
</p>
{{- if $sig -}}
<details class="signature">
<summary>View OpenPGP signature</summary>
<pre style="font-size:0.85em; overflow-x:auto; padding:0.75rem;">{{ $sig }}</pre>
</details>
{{- end -}}
<p><em>Verify locally:</em></p>
<pre style="font-size:0.85em; overflow-x:auto; padding:0.75rem;">
{{- if $isOnion -}}
torsocks curl -fSLO {{ $download | absURL }}
torsocks curl -fSLO {{ $asc | absURL }}
{{- else -}}
curl -fSLO {{ $download | absURL }}
curl -fSLO {{ $asc | absURL }}
{{- end }}
gpg --verify {{ path.Base $asc }} {{ path.Base $download }}
</pre>
</div>