hermit-V2/layouts/posts/single.html

96 lines
5 KiB
HTML
Raw Normal View History

{{ define "head" }}
2019-01-03 05:25:14 -05:00
{{ if .Params.featuredImg -}}
<style>.bg-img {background-image: url('{{.Params.featuredImg}}');}</style>
{{- else if .Params.images -}}
{{- range first 1 .Params.images -}}
2019-01-03 05:25:14 -05:00
<style>.bg-img {background-image: url('{{. | absURL}}');}</style>
{{- end -}}
{{- end -}}
{{ end }}
2018-10-23 01:15:50 -04:00
{{ define "header" }}
{{ partial "header.html" . }}
{{ end }}
{{ define "main" }}
{{- if (or .Params.images .Params.featuredImg) }}
<div class="bg-img"></div>
{{- end }}
2018-10-23 01:15:50 -04:00
<main class="site-main section-inner animated fadeIn faster">
<article class="thin">
<header class="post-header">
<div class="post-meta"><span>{{ .Date.Format .Site.Params.dateform }}</span></div>
<h1>{{ .Title }}</h1>
</header>
2023-08-06 09:16:12 -04:00
<div class="post-info">
{{- with .Params.description }}
<p>{{.}}</p>
{{- end }}
2023-09-23 01:03:29 -04:00
{{- if and .Params.author .Params.authorLink}}
{{ $relreflink := relref . .Params.authorLink }}
<p>{{ partial "svg.html" (dict "context" . "name" "author") }}<a href="{{ $relreflink }}" target="_blank">{{ .Params.author }}</a></p>
{{- else if .Params.author }}
{{ $relreflink := relref . .Site.Author.about }}
<p>{{ partial "svg.html" (dict "context" . "name" "author") }}<a href="{{ $relreflink }}" target="_blank">{{ .Params.author }}</a></p>
{{- else }}
{{ $relreflink := relref . .Site.Author.about }}
<p>{{ partial "svg.html" (dict "context" . "name" "author") }}<a href="{{ $relreflink }}" target="_blank">{{ .Site.Author.name }}</a></p>
{{- end }}
2018-10-23 01:15:50 -04:00
{{- with .Params.tags }}
<p>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-tag meta-icon"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path><line x1="7" y1="7" x2="7" y2="7"></line></svg>
{{- range . -}}
<span class="tag"><a href="{{ "tags/" | absLangURL }}{{ . | urlize }}">{{.}}</a></span>
2018-10-23 01:15:50 -04:00
{{- end }}
</p>
{{- end }}
2023-10-25 04:10:31 -04:00
<p>{{- partial "svg.html" (dict "context" . "name" "posts_single_wordcount") }}{{ i18n "wordCount" . -}} {{- partial "readTime.html" . -}}</p>
<p>{{- partial "svg.html" (dict "context" . "name" "posts_single_date") }}{{ dateFormat .Site.Params.dateformNumTime .Date.Local -}}
{{- if or (eq .Page.Params.IgnoreLastmod nil) (not .Page.Params.IgnoreLastmod) -}}
{{- if and .GitInfo .Site.Params.gitUrl -}}
[{{- partial "svg.html" (dict "context" . "name" "posts_single_git_commit") -}}<a href="{{ .Site.Params.gitUrl -}}{{ .GitInfo.Hash }}" target="_blank" rel="noopener">{{ .GitInfo.AbbreviatedHash -}}</a> @ {{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local -}}]
{{- else if not (eq .Lastmod .Date ) -}}
&nbsp;[Modified : {{ dateFormat .Site.Params.dateformNumTime .Lastmod.Local -}}]
{{- else -}}
2023-10-25 04:23:10 -04:00
{{ errorf "Lastmod is not found in Page Frontmatter or Lastmod is same as Date" }}
2023-10-25 04:10:31 -04:00
{{- end -}}
{{- end -}}
2023-08-06 09:16:12 -04:00
</p>
</div>
<hr class="post-end">
<div class="content">
{{ .Content | replaceRE "(<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="currentColor" 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>
{{- if .Site.Params.relatedPosts }}
{{- partial "related-posts.html" . -}}
{{- end }}
<hr class="art-end">
2018-10-23 01:15:50 -04:00
</article>
2018-12-24 09:17:22 -05:00
{{- if .Params.toc }}
<aside id="toc">
2018-12-24 09:56:07 -05:00
<div class="toc-title">{{ i18n "tableOfContents" }}</div>
2018-12-24 09:17:22 -05:00
{{ .TableOfContents }}
</aside>
{{- end }}
2018-10-23 01:15:50 -04:00
<div class="post-nav thin">
{{- with .NextInSection }}
<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="currentColor" 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>&nbsp;{{ i18n "newer" }}</span><br><span>{{ .Title }}</span>
2018-10-23 01:15:50 -04:00
</a>
{{- end }}
{{- with .PrevInSection }}
<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="currentColor" 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></span><br><span>{{ .Title }}</span>
2018-10-23 01:15:50 -04:00
</a>
{{- end }}
</div>
<div id="comments" class="thin">
{{- partial "comments.html" . -}}
</div>
2018-10-23 01:15:50 -04:00
</main>
{{ end }}
{{ define "footer" }}
{{ partialCached "footer.html" . }}
2023-08-06 09:16:12 -04:00
{{ end }}