refactor: internal and external links

This commit is contained in:
Ben Goldsworthy 2025-05-08 13:48:23 +02:00
parent 5aec4874b6
commit f1c9fa5622
No known key found for this signature in database
14 changed files with 388 additions and 125 deletions

View file

@ -76,10 +76,7 @@
{{ end }}
{{ define "main-body" }}
<section
class="site-content__body"
itemprop="articleBody"
>
<section class="site-content__body">
{{ with .Summary }}
<section
class="article-body__summary"
@ -91,87 +88,22 @@
{{ end }}
{{- if ( or .Params.internal_links .Params.external_links ) -}}
<section class="article__links">
{{- with .Params.internal_links -}}
<h3>Internal Links</h3>
<ul>
{{- range . -}}
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
<li><a href="{{ .link }}">{{ .title | safeHTML }}</a></li>
{{ else }}
<li><a href="{{ . }}">Link</a></li>
{{ end }}
{{- end -}}
</ul>
{{- end -}}
{{- with .Params.external_links -}}
<h3>External Links</h3>
<ul>
{{- range . -}}
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
<li><a href="{{ .link }}">{{ .title | safeHTML }}</a></li>
{{ else }}
<li><a href="{{ . }}">Link</a></li>
{{ end }}
{{- end -}}
</ul>
{{- end -}}
</section>
{{- partial "single/main-body/links.html" ( dict "pc" . "sc" $ ) -}}
{{- end -}}
<section
class="e-content article-body__content"
itemprop="articleBody"
>
{{ .Content }}
</section>
{{- partial "single/main-body/content.html" ( dict "pc" . "sc" $ ) -}}
{{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }}
<section class="article-body__appendices">
<h2
class="subheading subheading--appendices"
id="appendices"
>
Appendices
</h2>
{{ $file := path.Join $.Page.File.Dir "appendices.md" | readFile }}
{{ $file | .RenderString }}
</section>
{{- partial "single/main-body/appendices.html" ( dict "pc" . "sc" $ ) -}}
{{ end }}
{{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }}
<section
class="article-body__corrigendum"
itemprop="correction"
itemscope
itemtype="https://schema.org/CorrectionComment"
>
<h2
class="subheading subheading--corrigendum"
id="corrigendum"
>
Corrigendum
</h2>
{{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }}
{{ $file | .RenderString }}
</section>
{{- partial "single/main-body/appendices.html" ( dict "pc" . "sc" $ ) -}}
{{ end }}
</section>
{{ with .Page.Resources.Get "comments.md" }}
<section class="site-content__comments">
<h2
class="subheading subheading--comments"
id="comments"
>
Comments
</h2>
<ul class="comment__thread">
{{ .RenderShortcodes }}
</ul>
</section>
{{- partial "single/main-body/comments.html" ( dict "pc" . "sc" $ ) -}}
{{ end }}
{{ end }}