fix(layout): repair non rendering posts

This commit is contained in:
2022-08-18 17:50:10 +02:00
parent d888c8eeff
commit d19c41f6de
4 changed files with 26 additions and 25 deletions

View File

@@ -1,23 +1,17 @@
{{ define "head" }} {{ define "head" }}
{{ if .Params.featuredImg -}} {{ if .Params.featuredImg -}}
<style> <style>.bg-img {background-image: url('{{.Params.featuredImg}}');}</style>
.bg-img {
background-image: url('{{.Params.featuredImg}}');
}
</style>
{{- else if .Params.images -}} {{- else if .Params.images -}}
{{- range first 1 .Params.images -}} {{- range first 1 .Params.images -}}
<style> <style>.bg-img {background-image: url('{{. | absURL}}');}</style>
.bg-img {
background-image: url('{{. | absURL}}');
}
</style>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{ end }} {{ end }}
{{ define "header" }} {{ define "header" }}
{{ partial "header.html" . }} {{ partial "header.html" . }}
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}
{{- if (or .Params.images .Params.featuredImg) }} {{- if (or .Params.images .Params.featuredImg) }}
<div class="bg-img"></div> <div class="bg-img"></div>
@@ -29,17 +23,15 @@
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
</header> </header>
<div class="content"> <div class="content">
{{ .Content | replaceRE "( {{ .Content | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" `${1}<a href="#${2}" class="anchor" aria-hidden="true"><object type="image/svg+xml" width="24" height="24" data="{{"link.svg" | relURL}}"></object></a>${3}` | safeHTML }}
<h[1-6] id=\ "([^\"]+)\ ".+)(</h[1-6]+>)" `${1}<a href="#${2}" class="anchor" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path><line x1="8" y1="12" x2="16" y2="12"></line></svg></a>${3}`
| safeHTML }}
</div> </div>
{{- if .Site.Params.relatedPosts }} {{- partial "related-posts.html" . -}} {{- end }} {{- if .Site.Params.relatedPosts }}
{{- partial "related-posts.html" . -}}
{{- end }}
<hr class="post-end"> <hr class="post-end">
<footer class="post-info"> <footer class="post-info">
{{- with $.Param "author" }} {{- with $.Param "author" }}
<p> <p><object type="image/svg+xml" width="24" height="24" data="{{"author.svg" | relURL}}">{{.}}</object></p>
<object type="image/svg+xml" width="24" height="24" data="{{"author.svg" | relURL}}">{{.}}</object>
</p>
{{- end }} {{- end }}
{{- with .Params.tags }} {{- with .Params.tags }}
<p> <p>
@@ -57,22 +49,28 @@
</footer> </footer>
</article> </article>
{{- if .Params.toc }} {{- if .Params.toc }}
<aside id="toc "> <aside id="toc">
<div class="toc-title ">{{ i18n "tableOfContents " }}</div> <div class="toc-title">{{ i18n "tableOfContents" }}</div>
{{ .TableOfContents }} {{ .TableOfContents }}
</aside> </aside>
{{- end }} {{- end }}
<div class="post-nav thin "> <div class="post-nav thin">
{{- with .NextInSection }} {{- with .NextInSection }}
<a class="next-post " href="{{ .Permalink }} "> <a class="next-post" href="{{ .Permalink }}">
<span class="post-nav-label "><svg xmlns="http://www.w3.org/2000/svg " width="24 " height="24 " viewBox="0 0 24 24 " fill="none " stroke="#fff " stroke-width="2 " stroke-linecap="round " stroke-linejoin="round " class="feather feather-arrow-left <span class="post-nav-label">
"><line x1="19 " y1="12 " x2="5 " y2="12 "></line><polyline points="12 19 5 12 12 5 "></polyline></svg>&nbsp;{{ i18n "newer " }}</span><br><span>{{ .Title }}</span> <object type="image/svg+xml" width="24" height="24" data="{{"nextarrow.svg" | relURL}}"></object>&nbsp;{{ i18n "newer " }}
</span>
<br>
<span>{{ .Title }}</span>
</a> </a>
{{- end }} {{- end }}
{{- with .PrevInSection }} {{- with .PrevInSection }}
<a class="prev-post " href="{{ .Permalink }} "> <a class="prev-post " href="{{ .Permalink }} ">
<span class="post-nav-label ">{{ i18n "older " }}&nbsp;<svg xmlns="http://www.w3.org/2000/svg " width="24 " height="24 " viewBox="0 0 24 24 " fill="none " stroke="#fff " stroke-width="2 " stroke-linecap="round " stroke-linejoin="round <span class="post-nav-label ">
" class="feather feather-arrow-right "><line x1="5 " y1="12 " x2="19 " y2="12 "></line><polyline points="12 5 19 12 12 19 "></polyline></svg></span><br><span>{{ .Title }}</span> {{ i18n "older " }}&nbsp;<object type="image/svg+xml" width="24" height="24" data="{{"prevarrow.svg" | relURL}}"></object>
</span>
<br>
<span>{{ .Title }}</span>
</a> </a>
{{- end }} {{- end }}
</div> </div>

1
static/link.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 7h3a5 5 0 0 1 5 5 5 5 0 0 1-5 5h-3m-6 0H6a5 5 0 0 1-5-5 5 5 0 0 1 5-5h3"></path><line x1="8" y1="12" x2="16" y2="12"></line></svg>

After

Width:  |  Height:  |  Size: 293 B

1
static/nextarrow.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>

After

Width:  |  Height:  |  Size: 304 B

1
static/prevarrow.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>

After

Width:  |  Height:  |  Size: 306 B