refactor: internal and external links
This commit is contained in:
parent
5aec4874b6
commit
f1c9fa5622
14 changed files with 388 additions and 125 deletions
|
@ -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 }}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue