move dates/tags from sidebar to post frontmatter

This commit is contained in:
John Bowdre 2024-01-20 16:21:09 -06:00
parent e9f57f8033
commit 31f90b6446
3 changed files with 55 additions and 27 deletions

View file

@ -1,7 +1,24 @@
{{ define "main" }}
{{- $ageDays := div (sub now.Unix .Date.Unix) 86400 -}}
<header class="content__header">
<h1>{{ .Title | markdownify }}</h1>
<div class="frontmatter">
<hr>
<table class="frontmatter">
<tr><td class="label">title:</td><td class="title">{{ .Title | markdownify }}</td></tr>
{{- if .Params.date }}
{{- $postDate := .Date.Format "2006-01-02" }}
{{- $updateDate := .Lastmod.Format "2006-01-02" }}
<tr><td class="label">posted:</td><td class="content">{{ $postDate }}</td></tr>
{{- if ne $postDate $updateDate }}
<tr><td class="label">updated:</td><td class="content">{{ $updateDate }}</td></tr>
{{ end }}
{{ end }}
{{- with .Params.tags }}{{- $tagCount := len . }}
<tr class="frontmatter_tags"><td>tags:</td><td>{{- if gt $tagCount 5 }}<details><summary>See all {{ $tagCount }} tags...</summary>{{- end }}[&quot;<a href="/tags">all</a>&quot; {{- range . }}{{- $tag := urlize . }}{{ if $tag }}, {{ end }}&quot;<a href='{{ absLangURL (printf "tags/%s" $tag) }}'>{{ . }}</a>&quot;{{- end }}]{{- if gt $tagCount 5 }}</details>{{- end }}</td></tr>
{{- end }}
</table>
<hr>
</div>
</header>
{{- with .Param "lastmod" -}}
{{- $ageDays = div (sub now.Unix .Unix) 86400 -}}

View file

@ -1,30 +1,10 @@
{{- $postDate := .Date.Format "2006-01-02" }}
{{- $updateDate := .Lastmod.Format "2006-01-02" }}
{{ if or (.Params.description) (.Params.date) }}
{{ if .Params.description }}<p>{{ .Params.description }}</p>{{ end }}
<p>
{{ if .Params.date }}<table><tr><td>posted:</td><td>{{ $postDate }}</td></tr>{{- if ne $postDate $updateDate }}<tr><td>updated:</td><td>{{ $updateDate }}</td></tr>{{ end }}</table>{{ end }}
</p>
{{ if .Params.description }}<p>{{ .Params.description }}</p><hr>{{ end }}
{{ if and (gt .WordCount 400 ) (gt (len .TableOfContents) 180) }}
<p>
<h3>On this page</h3>
{{ .TableOfContents }}
<hr>
{{ if and (gt .WordCount 400 ) (gt (len .TableOfContents) 180) }}
<p>
<h3>On this page</h3>
{{ .TableOfContents }}
<hr>
</p>
{{ end }}
{{- with .Params.tags -}}
<p>
<h3>Tags</h3>
[<a href="/tags">all</a>]
{{- range . }}
{{- $tag := urlize . -}}
[<a href='{{ absLangURL (printf "tags/%s" $tag) }}' title="{{ . }}">{{ . }}</a>]
{{- end }}
<br><br>
<hr>
</p>
{{- end }}
</p>
{{ end }}
{{ if isset .Params "categories" }}

View file

@ -303,3 +303,34 @@ button.tinylytics_kudos:hover {
transform: scale(1.1);
text-shadow: var(--off-fg) 0 0 1px;
}
/* post front matter styling*/
.frontmatter hr {
margin-bottom: 0rem;
margin-top: 0rem;
}
.frontmatter h1 {
margin-top: 0rem;
}
.frontmatter .label {
color: var(--off-fg);
font-size: 0.8rem;
}
.frontmatter .title {
color: var(--fg);
font-weight: 600;
font-size: 1.1rem;
}
.frontmatter table {
overflow-wrap: break-word;
margin-bottom: 0rem;
}
.frontmatter_tags {
font-size: 0.8rem;
color: var(--off-fg);
}