optimizations for nicer looking raw html

This commit is contained in:
Vrifox 2020-11-20 22:39:10 +01:00
parent 2b06ee5dfa
commit 59c38330f6
7 changed files with 232 additions and 221 deletions

View file

@ -1,63 +1,69 @@
{{ define "stylesheet" }}{{ $scss := resources.Get "/_default/single.scss" }}{{ $style := $scss | resources.ToCSS }}
<link rel="stylesheet" href="{{ $style.Permalink }}" type="text/css" media="screen" rel="preload" />
{{ end }}
{{- define "stylesheet" -}}
{{- $scss := resources.Get "/_default/single.scss" -}}
{{- $style := $scss | resources.ToCSS -}}
<link rel="stylesheet" href="{{ $style.Permalink }}" type="text/css" media="screen" rel="preload" />
{{- end -}}
{{ define "main" }}
<main>
<div class="container">
<section class="section-article">
<article>
<p class="meta">
{{ if eq .Params.type "post" }}<span title="{{ .Date.Format "2. January 2006, 15:04 MST" }}">{{ .Date.Format "2. January 2006" }}</span>{{ end }}
{{ if eq .Params.type "singlepage" }}<span title="{{ .Date.Format "2. January 2006" }}">version: {{ .Date.Format "2006-01-02" }}</span>{{ end }}
<span>{{ with .Params.author }}by {{ end }}{{ .Params.author }}</span>
</p>
<h1 class="title">{{ .Title }}</h1>
{{ with .Params.featured_image }}<img src="{{ . | relURL }}" loading="lazy" alt="">{{ end }}
{{ .Content }}
<aside class="meta">
{{ with .Params.topics }}
<ul class="topics">
{{ range . }}
<li>
<a href="{{ "topics" | relURL}}/{{ . | urlize }}">{{ . }}</a>
</li>
{{ end }}
</ul>
{{ end }}
{{ with .Params.tags }}
<h3>tags</h3>
<ul class="tags">
{{ range . }}
<li>
<a href="{{ "tags" | relURL }}/{{ . | urlize }}">{{ . }}</a>
</li>
{{ end }}
</ul>
{{ end }}
</aside>
</article>
</section>
{{ if ne .Params.type "singlepage" }}
<section class="section-articles">
<article class="next-article">
{{ with .NextInSection }}
<a href="{{ .Permalink }}">
{{ if eq .Params.type "project" }}&leftarrow; next project{{ end }}
{{ if ne .Params.type "project" }}&leftarrow; next article{{ end }}
</a>
{{ end }}
</article>
<article class="previous-article">
{{ with .PrevInSection }}<span></span>
<a href="{{ .Permalink }}">
{{ if eq .Params.type "project" }}previous project &rightarrow;{{ end }}
{{ if ne .Params.type "project" }}previous article &rightarrow;{{ end }}
</a>
{{ end }}
</article>
</section>
{{ end }}
</div>
</main>
{{ end }}
{{- define "main" -}}
<main>
<div class="container">
<section class="section-article">
<article>
<p class="meta">
{{ if eq .Params.type "post" }}<span title="{{ .Date.Format "2. January 2006, 15:04 MST" }}">{{ .Date.Format "2. January 2006" }}</span>{{ end }}
{{- if eq .Params.type "singlepage" }}<span title="{{ .Date.Format "2. January 2006" }}">version: {{ .Date.Format "2006-01-02" }}</span>{{ end }}
{{- with .Params.author }}<span>by {{ . }}</span>{{ end }}
</p>
<h1 class="title">{{ .Title }}</h1>
{{ with .Params.featured_image }}<img src="{{ . | relURL }}" loading="lazy" alt="">{{ end }}
{{ printf "<!-- content -->" | safeHTML }}
{{ .Content }}
{{- printf "<!-- content END -->" | safeHTML }}
<aside class="meta">
{{- with .Params.topics }}
<ul class="topics">
{{- range . }}
<li>
<a href="{{ "topics" | relURL}}/{{ . | urlize }}">{{ . }}</a>
</li>
{{ end }}
</ul>
{{- end }}
{{- with .Params.tags }}
<h3>tags</h3>
<ul class="tags">
{{- range . }}
<li>
<a href="{{ "tags" | relURL }}/{{ . | urlize }}">{{ . }}</a>
</li>
{{- end }}
</ul>
{{- end }}
</aside>
</article>
</section>
{{- if ne .Params.type "singlepage" }}
<section class="section-articles">
<article class="next-article">
{{- with .NextInSection }}
<a href="{{ .Permalink }}">
{{ if eq .Params.type "project" }}&leftarrow; next project{{ end }}
{{ if ne .Params.type "project" }}&leftarrow; next article{{ end }}
</a>
{{- end }}
</article>
<article class="previous-article">
{{- with .PrevInSection }}<span></span>
<a href="{{ .Permalink }}">
{{- if eq .Params.type "project" }}previous project &rightarrow;{{ end -}}
{{- if ne .Params.type "project" }}previous article &rightarrow;{{ end -}}
</a>
{{- end }}
</article>
</section>
{{- end }}
</div>
</main>
{{- end }}