- forum/extension: oc:import command (archived comments -> one thread per machine) and embed styling - forum/docker: local Flarum 2 test stack - site: optional params.forum.url adds a Forum menu entry and shows the machine thread in the Comments tab Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDRjtmAiNpo5mK5N3d7QwZ
59 lines
2.7 KiB
HTML
59 lines
2.7 KiB
HTML
{{ define "title" }}{{ .Title }} – {{ .Params.tab | title }} · {{ site.Title }}{{ end }}
|
||
{{ define "main" }}
|
||
{{ $m := site.GetPage .Params.machine }}
|
||
{{ $tab := .Params.tab }}
|
||
{{ $p := $m.Params }}
|
||
<article class="machine" data-pagefind-meta="title:{{ .Title }} – {{ .Params.tab | title }}">
|
||
{{ partial "machine-header.html" (dict "machine" $m "tab" $tab) }}
|
||
|
||
{{ if in (slice "photos" "adverts" "hardware" "connectors") $tab }}
|
||
{{ partial "gallery.html" (index $p $tab) }}
|
||
|
||
{{ else if eq $tab "software" }}
|
||
{{ with $p.software }}<h2>Software in the museum</h2>{{ partial "link-list.html" . }}{{ end }}
|
||
{{ with $p.screenshots }}<h2>Screenshots</h2>{{ partial "gallery.html" . }}{{ end }}
|
||
|
||
{{ else if eq $tab "links" }}
|
||
{{ with $p.related }}<h2>Related systems</h2>{{ partial "link-list.html" . }}{{ end }}
|
||
{{ with $p.links }}<h2>Web links</h2>{{ partial "entries.html" . }}{{ end }}
|
||
|
||
{{ else if in (slice "emulators" "videos") $tab }}
|
||
{{ partial "entries.html" (index $p $tab) }}
|
||
|
||
{{ else if eq $tab "docs" }}
|
||
<div class="gallery docs">
|
||
{{ range $p.docs }}
|
||
<figure>
|
||
{{ with .cover }}<img src="{{ . }}" alt="" loading="lazy">{{ end }}
|
||
<figcaption>
|
||
{{ if .text }}<div>{{ .text | markdownify }}</div>
|
||
{{ else }}<a href="{{ .url }}"{{ partial "ext.html" .url }}><strong>{{ .title }}</strong></a>{{ end }}
|
||
</figcaption>
|
||
</figure>
|
||
{{ end }}
|
||
</div>
|
||
|
||
{{ else if and (eq $tab "comments") $p.forum_thread site.Params.forum.url }}
|
||
{{/* live comments: the machine's forum thread, shown in a frame sized to its content */}}
|
||
{{ $thread := printf "%s/embed/%d" (strings.TrimSuffix "/" site.Params.forum.url) (int $p.forum_thread) }}
|
||
<p class="note">The first comments were left by visitors of the original site. Log in to the forum to add yours. <a href="{{ replace $thread "/embed/" "/d/" }}">Open this discussion in the forum</a>.</p>
|
||
<iframe class="forum-thread" id="forum-thread" src="{{ $thread }}" title="Comments on {{ $m.Title }}" loading="lazy"></iframe>
|
||
{{ with resources.Get "js/iframeResizer.min.js" | fingerprint }}
|
||
<script src="{{ .RelPermalink }}"></script>
|
||
<script>iFrameResize({ checkOrigin: false, heightCalculationMethod: "lowestElement" }, "#forum-thread");</script>
|
||
{{ end }}
|
||
|
||
{{ else if eq $tab "comments" }}
|
||
<p class="note">Comments left by visitors of the original site. New comments are closed.</p>
|
||
<ol class="comments">
|
||
{{ range $p.comments }}
|
||
<li>
|
||
<p class="meta"><strong>{{ .author }}</strong>{{ with .date }} · {{ . }}{{ end }}</p>
|
||
<div>{{ .text | markdownify }}</div>
|
||
</li>
|
||
{{ end }}
|
||
</ol>
|
||
{{ end }}
|
||
</article>
|
||
{{ end }}
|