list almost done

This commit is contained in:
wangbudui 2020-01-07 14:05:49 +08:00
parent b6bd7ece4d
commit 04ce6eb512
4 changed files with 54 additions and 28 deletions

View File

@ -8,7 +8,7 @@
@import "node_modules/tailwindcss/utilities"; @import "node_modules/tailwindcss/utilities";
.markdown h1 { .markdown h1 {
@apply text-4xl my-12; @apply text-3xl my-12;
} }
.markdown h2 { .markdown h2 {
@apply text-2xl my-8; @apply text-2xl my-8;

View File

@ -1,7 +1,25 @@
{{ define "main" }} {{ define "main" }}
{{ range .Pages }} <section itemscope itemtype="http://schema.org/Collection" class="max-w-3xl mx-auto leading-relaxed my-6">
<article class=""> {{- $pctx := . -}}
<h1 class=""><a href="{{ .Permalink }}">{{ .Title }}</a></h1> {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := $pctx.RegularPages -}}
{{ range (where $pages "Section" "!=" "") }}
<article itemscope itemtype="http://schema.org/Article" class="flex flex-col mt-6 mb-12">
{{- partial "meta.html" . -}}
<h2 itemprop="name" class="text-2xl"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<p itemprop="datePublished" content="{{ .Date.Format "2006-01-02" }}" class="">{{ .Date.Format "2006/01/02" }}
</p>
<div class="py-2">
{{ if .Description }}
{{ .Description | markdownify }}
{{ else }}
{{ if .Truncated }}
{{ .Summary | truncate 150 | markdownify }}...
{{ end }}
{{ end }}
</div>
</article> </article>
{{ end }} {{ end }}
</section>
{{ end }} {{ end }}

View File

@ -1,10 +1,11 @@
{{ define "main" }} {{ define "main" }}
<article itemscope itemtype="http://schema.org/Article" class="max-w-3xl mx-auto leading-relaxed"> <article itemscope itemtype="http://schema.org/Article" class="max-w-3xl mx-auto leading-relaxed">
{{ if .IsPage }} {{ if .IsPage }}
<section class="flex flex-col meta"> <header class="flex flex-col meta">
<h1 class="text-center text-4xl my-8 md:my-12">{{ .Title }}</h1> {{- partial "meta.html" . -}}
<h1 itemprop="name" class="text-center text-3xl my-4 md:my-6">{{ .Title }}</h1>
{{ if not .Params.disableMeta }} {{ if not .Params.disableMeta }}
<h3 class="text-center text-2xl"> <h3 class="text-center text-xl">
{{ with $.Site.Params.AuthorName }} {{ with $.Site.Params.AuthorName }}
<span itemprop="author" itemscope itemtype="http://schema.org/Person"> <span itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">{{ . }}</span> <span itemprop="name">{{ . }}</span>
@ -15,31 +16,14 @@
content="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</span> content="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</span>
{{ end }} {{ end }}
</h3> </h3>
<h3 class="md:order-first text-xl text-right mt-4 md:mt-0">
{{ with .Params.categories }}
<span itemprop="articleSection" class="category">
{{ range . }}
<a href="{{ . | printf "categories/%s" | relURL }}" rel="category">{{ . }}</a>
{{ end }}
</span>
{{ end }}
{{ if .Params.categories }} / {{ end }}
{{ with .Params.tags }}
<span itemprop="keywords" class="tags text-base font-mono">
{{ range . }}
<a href="{{ . | printf "tags/%s" | relURL }}" class="m-1" rel="tag">#{{ . }}</a>
{{ end }}
</span>
{{ end }}
</h3>
{{ end }} {{ end }}
</section> </header>
{{ end }} {{ end }}
{{ if not .IsHome }} {{ if not .IsHome }}
<hr class="block my-10 mx-auto max-w-xs h-px border-t border-black"> <hr class="block my-10 mx-auto max-w-xs h-px border-t border-black">
{{ end }} {{ end }}
<section itemprop="articleBody" class="content markdown"> <div itemprop="articleBody" class="content markdown">
{{ .Content }} {{ .Content }}
</section> </div>
</article> </article>
{{ end }} {{ end }}

View File

@ -0,0 +1,24 @@
<div class="flex flex-col md:flex-row justify-between">
{{ with .Params.categories }}
<ul class="flex justify-end" itemprop="articleSection">
{{ range . }}
<li class="pr-2"><a href="{{ . | printf "categories/%s" | relURL }}" rel="category">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ with .Params.tags }}
<ul class="flex justify-end">
{{ range . }}
<li itemprop="keywords" class="pl-2 md:pl-4">
<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
{{ if and (eq . "markdown") (eq . "markdown") }}
<mark>#{{ . }}</mark>
{{ else }}
#{{ . }}
{{ end }}
</a>
</li>
{{ end }}
</ul>
{{ end }}
</div>