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

@ -26,7 +26,7 @@ menu:
- identifier: fediverse - identifier: fediverse
name: fediverse name: fediverse
title: fediverse title: fediverse
url: https://fedi.vrifox.cc/vrifox url: https://fedi.vrifox.cc/users/vrifox
weight: 1 weight: 1
- identifier: git - identifier: git
name: git name: git

View file

@ -1,15 +1,12 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<title>{{ with .Title }} {{ . }} {{ end }}{{ .Site.Title }}</title> <title>{{ with .Title }} {{ . }} {{ end }}{{ .Site.Title }}</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{ block "stylesheet" . }}{{ end }} {{ block "stylesheet" . }}{{ end }}
<link rel="icon" type="image/png" href="{{ "/favicon.png" | relURL }}"> <link rel="icon" type="image/png" href="{{ "/favicon.png" | relURL }}">
</head> </head>
<body> <body>
{{ partial "nav.html" . }} {{ partial "nav.html" . }}
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}

View file

@ -1,26 +1,28 @@
{{ define "stylesheet" }}{{ $scss := resources.Get "/_default/list.scss" }}{{ $style := $scss | resources.ToCSS }} {{- define "stylesheet" -}}
<link rel="stylesheet" href="{{ $style.Permalink }}" type="text/css" media="screen" rel="preload" /> {{- $scss := resources.Get "/_default/list.scss" -}}
{{ end }} {{- $style := $scss | resources.ToCSS -}}
<link rel="stylesheet" href="{{ $style.Permalink }}" type="text/css" media="screen" rel="preload" />
{{- end -}}
{{ define "main" }} {{- define "main" }}
<main> <main>
<div class="container"> <div class="container">
<section class="section posts"> <section class="section posts">
<div class="section posts inner"> <div class="section posts inner">
{{ range .Pages }} {{- range .Pages }}
<a href="{{ .Permalink }}"> <a href="{{ .Permalink }}">
<article> <article>
<h1><span>{{ .Title }}</span></h1> <h1><span>{{ .Title }}</span></h1>
{{ with .Description }}<p class="description">{{ . }}</p>{{ end }} {{ with .Description }}<p class="description">{{ . }}</p>{{ end }}
<p class="meta" title="{{ .Date.Format "2 Jan 2006, 15:04 MST" }}"> <p class="meta" title="{{ .Date.Format "2 Jan 2006, 15:04 MST" }}">
<span class="date">{{ .Date.Format "2 January 2006" }}</span> <span class="date">{{ .Date.Format "2 January 2006" }}</span>
<span class="author">{{ with .Params.author }}by {{ end }}{{ .Params.author }}</span> {{- with .Params.author }}<span class="author">by {{ . }}</span>{{ end }}
</p> </p>
</article> </article>
</a> </a>
{{ end }} {{- end }}
</div>
</section>
</div> </div>
</section> </main>
</div> {{- end }}
</main>
{{ end }}

View file

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

View file

@ -1,68 +1,74 @@
{{ define "stylesheet" }}{{ $scss := resources.Get "/index.scss" }}{{ $style := $scss | resources.ToCSS }} {{- define "stylesheet" -}}
<link rel="stylesheet" href="{{ $style.Permalink }}" type="text/css" media="screen" /> {{- $scss := resources.Get "/index.scss" -}}
{{ end }} {{- $style := $scss | resources.ToCSS -}}
<link rel="stylesheet" href="{{ $style.Permalink }}" type="text/css" media="screen" />
{{- end -}}
{{ define "main" }} {{- define "main" -}}
<section class="section header"> <section class="section header">
<div class="container"> <div class="container">
<header> <header>
<h1>{{ .Params.heading }}</h1> <h1>{{ .Params.heading }}</h1>
<span class="subtitle">{{.Params.subheading}}</span> <span class="subtitle">{{.Params.subheading}}</span>
</header> </header>
<section class="section contact"> <section class="section contact">
<table class="table contact"> <table class="table contact">
{{ range sort .Params.contact "weight" "asc" }} {{- range sort .Params.contact "weight" "asc" }}
<tr> <tr>
<td>{{ .name }}</td> <td>{{ .name }}</td>
<td> <td>
{{ with .url }}<a href="{{ . }}">{{ end }} {{- with .url }}<a href="{{ . }}">{{ end -}}
{{ .handle }} {{ .handle }}
{{ with .url }}</a>{{ end }} {{- with .url }}</a>{{ end -}}
{{ with .hint }}<a href="{{ .url }}">{{ .name }}</a>{{ end }} {{- with .hint }}<a href="{{ .url }}">{{ .name }}</a>{{ end -}}
</td> </td>
</tr> </tr>
{{ end }} {{- end }}
</table> </table>
</section> </section>
</div>
</section>
<main>
<div class="container">
<section class="section projects">
<span class="latest">
latest <a href="{{ "/projects" | relURL }}">projects</a>
</span>
<div class="section projects inner">
{{ range first 4 (where .Site.RegularPages "Type" "project") }}
<a href="{{ .Permalink }}">
<article>
<h1>{{ .Title }}</h1>
<p class="meta">{{ with .Params.activetime }}<span class="date">{{ . }}</span>{{ end }}<br />{{ with .Params.status }}<span class="status">{{ . }}</span>{{ end }}</p>
</article>
</a>
{{ end }}
</div> </div>
</section> </section>
<hr>
<section class="section posts"> <main>
<span class="latest"> <div class="container">
latest <a href="{{ "/blog" | relURL }}">posts</a> <section class="section projects">
</span> <span class="latest">
<div class="section posts inner"> latest <a href="{{ "/projects" | relURL }}">projects</a>
{{ range first 4 (where .Site.RegularPages "Type" "post") }} </span>
<a href="{{ .Permalink }}"> <div class="section projects inner">
<article> {{- range first 4 (where .Site.RegularPages "Type" "project") }}
<h1><span>{{ .Title }}</span></h1> <a href="{{ .Permalink }}">
{{ with .Description }}<p class="description">{{ . }}</p>{{ end }} <article>
<p class="meta" title="{{ .Date.Format "2 Jan 2006, 15:04 MST" }}"> <h1>{{ .Title }}</h1>
<span class="date">{{ .Date.Format "2 January 2006" }}</span> <p class="meta">
<span class="author">{{ with .Params.author }}by {{ end }}{{ .Params.author }}</span> {{ with .Params.activetime }}<span class="date">{{ . }}</span>{{ end }}<br />
</p> {{ with .Params.status }}<span class="status">{{ . }}</span>{{ end }}
</article> </p>
</a> </article>
{{ end }} </a>
{{- end }}
</div>
</section>
<hr>
<section class="section posts">
<span class="latest">
latest <a href="{{ "/blog" | relURL }}">posts</a>
</span>
<div class="section posts inner">
{{- range first 4 (where .Site.RegularPages "Type" "post") }}
<a href="{{ .Permalink }}">
<article>
<h1><span>{{ .Title }}</span></h1>
{{ with .Description }}<p class="description">{{ . }}</p>{{ end }}
<p class="meta" title="{{ .Date.Format "2 Jan 2006, 15:04 MST" }}">
<span class="date">{{ .Date.Format "2 January 2006" }}</span>
<span class="author">{{ with .Params.author }}by {{ end }}{{ .Params.author }}</span>
</p>
</article>
</a>
{{- end }}
</div>
</section>
</div> </div>
</section> </main>
</div> {{- end }}
</main>
{{ end }}

View file

@ -1,20 +1,21 @@
<footer>
<div class="container"> <footer>
<section class="website-version"> <div class="container">
<span title="{{ now.Format "2. January 2006, 15:04 MST" }}">version {{ now.Format "2006-01-02" }}</span> <section class="website-version">
</section> <span title="{{ now.Format "2. January 2006, 15:04 MST" }}">version {{ now.Format "2006-01-02" }}</span>
<section class="website-subnav"> </section>
<ul> <section class="website-subnav">
{{ $currentPage := . }} <ul>
{{ range .Site.Menus.footer }} {{- $currentPage := . }}
<li> {{- range .Site.Menus.footer }}
<a href="{{ .URL }}"> <li>
{{ .Pre }} <a href="{{ .URL }}">
<span>{{ .Name }}</span> {{- .Pre }}
</a> <span>{{ .Name }}</span>
</li> </a>
{{ end }} </li>
</ul> {{- end }}
</section> </ul>
</div> </section>
</footer> </div>
</footer>

View file

@ -1,47 +1,46 @@
{{ $currentPage := . }} {{ $currentPage := . }}
<nav>
<nav> <div class="container">
<div class="container"> <section class="website-name">
<section class="website-name"> {{- range .Site.Menus.name }}
{{ range .Site.Menus.name }} {{- if $currentPage.IsMenuCurrent "name" . }}
{{ if $currentPage.IsMenuCurrent "name" . }} <a href="{{ .URL }}" class="active">{{ .Name }}</a>
<a href="{{ .URL }}" class="active">{{ .Name }}</a> {{- else }}
{{ else }} <a href="{{ .URL }}">{{ .Name }}</a>
<a href="{{ .URL }}">{{ .Name }}</a> {{- end }}
{{ end }} {{- end }}
{{ end }} </section>
</section> <span class="seperator">/</span>
<span class="seperator">/</span> <section class="website-mainmenu">
<section class="website-mainmenu"> <ul>
<ul> {{- range .Site.Menus.main -}}
{{ range .Site.Menus.main }} {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) -}}
{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} <li class="active">
<li class="active"> <a href="{{ .URL }}">
<a href="{{ .URL }}"> <span>{{ .Name }}</span>
<span>{{ .Name }}</span> </a>
</a> </li>
</li> {{- else }}
{{ else }} <li>
<li> <a href="{{ .URL }}">
<a href="{{ .URL }}"> <span>{{ .Name }}</span>
<span>{{ .Name }}</span> </a>
</a> </li>
</li> {{- end }}
{{ end }} {{- end }}
{{ end }} </ul>
</ul> </section>
</section> <section class="website-externallinks">
<section class="website-externallinks"> <ul>
<ul> {{- range .Site.Menus.externallinks }}
{{ range .Site.Menus.externallinks }} <li>
<li> <a title="{{ .URL }}" href="{{ .URL }}">
<a title="{{ .URL }}" href="{{ .URL }}"> {{- .Pre }}
{{ .Pre }} <span>{{ .Name }}</span>
<span>{{ .Name }}</span> </a>
</a> </li>
</li> {{- end }}
{{ end }} </ul>
</ul> </section>
</section> </div>
</div> </nav>
</nav>