Add simple blog rendering

This commit is contained in:
Alex Shpak 2018-11-24 15:14:43 +01:00
parent 7798a5cc7c
commit 2a89630a47
4 changed files with 51 additions and 1 deletions

View file

@ -4,6 +4,5 @@
<link href="https://fonts.googleapis.com/css?family=Oxygen|Oxygen+Mono:300,400,700" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Oxygen|Oxygen+Mono:300,400,700" rel="stylesheet">
<link rel="stylesheet" href="{{ "normalize.min.css" | absURL }}"> <link rel="stylesheet" href="{{ "normalize.min.css" | absURL }}">
<!-- <link rel="stylesheet" href="/basscss.min.css"> -->
{{ $styles := resources.Get "book.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} {{ $styles := resources.Get "book.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}"> <link rel="stylesheet" href="{{ $styles.RelPermalink }}">

20
layouts/posts/baseof.html Normal file
View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
{{- partial "docs/shared" -}}
<html>
<head>
{{ partial "docs/html-head" . }}
{{ partial "docs/inject/head" . }}
</head>
<body>
<main>
<div class="book-posts mx-auto">
{{ template "main" . }}
</div>
</main>
{{ partial "docs/inject/body" . }}
</body>
</html>

20
layouts/posts/list.html Normal file
View file

@ -0,0 +1,20 @@
{{ define "main" }}
<section>
{{ $paginator := .Paginate (where .Pages "Params.hidden" "ne" true) }}
{{ range sort .Paginator.Pages }}
<article>
<h2>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</h2>
<h5>{{ .Date.Format "January 2, 2006" }}</h5>
<p>
{{ .Summary }}
{{ if .Truncated }}
<a href="{{ .Permalink }}">...</a>
{{ end }}
</p>
</article>
{{ end }}
{{ template "_internal/pagination.html" . }}
</section>
{{ end }}

11
layouts/posts/single.html Normal file
View file

@ -0,0 +1,11 @@
{{ define "main" }}
<section>
<header>
<h1>{{ .Title }}</h1>
<h5>{{ .Date.Format "January 2, 2006" }}</h5>
</header>
<article class="markdown">
{{- .Content -}}
</article>
</section>
{{ end }}