Add multiple homepage layouts

This commit is contained in:
James Panther
2021-08-15 18:41:40 +10:00
parent 491d356d15
commit 7285cac334
20 changed files with 176 additions and 47 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<html lang="{{ with .Site.LanguageCode }}{{ . }}{{ else }}en{{ end }}">
{{- partial "head.html" . -}}
<body
class="flex flex-col h-screen px-6 m-auto text-lg leading-7 text-grey-900 sm:px-14 md:px-24 lg:px-32 dark:bg-gray-800 dark:text-white max-w-7xl"
class="flex flex-col h-screen px-6 m-auto text-lg leading-7 bg-white text-grey-900 sm:px-14 md:px-24 lg:px-32 dark:bg-gray-800 dark:text-white max-w-7xl"
>
{{- partial "header.html" . -}}
<main class="flex-grow">{{- block "main" . }}{{- end }}</main>
+1 -1
View File
@@ -1,7 +1,7 @@
{{ define "main" }}
<article class="max-w-prose">
<header>
<h1 class="mt-0 text-4xl font-extrabold">{{ .Title }}</h1>
<h1 class="mt-0 text-4xl font-extrabold">{{ .Title | emojify }}</h1>
<div class="mt-8 mb-12 text-base text-gray-400 dark:text-gray-500">
{{ partial "article-meta.html" . }}
{{ if .Draft }}
+14 -6
View File
@@ -1,8 +1,16 @@
{{ define "main" }}
<article class="max-w-full prose dark:prose-light">
<header>
<h1>{{ .Title }}</h1>
</header>
<section>{{ .Content | emojify }}</section>
</article>
{{ $partial := print "partials/home/" .Site.Params.homepage.layout ".html" }}
{{ if templates.Exists $partial }}
{{ partial $partial . }}
{{ else }}
{{ partial "partials/home/page.html" . }}
{{ end }}
{{ if .Site.Params.homepage.showList | default false }}
<section>
<h2 class="text-2xl font-extrabold">Recent</h2>
{{ range first 5 (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.homepage.listSections)).Pages }}
{{ partial "article-link.html" . }}
{{ end }}
</section>
{{ end }}
{{ end }}
+16
View File
@@ -0,0 +1,16 @@
{{ with .Site.Author.links }}
<div class="flex flex-wrap text-gray-400 dark:text-gray-500">
{{ range $links := . }}
{{ range $name, $url := $links }}
<a
class="px-1 hover:text-primary-700 dark:hover:text-primary-400"
href="{{ $url }}"
target="_blank"
alt="{{ $name | title }}"
rel="me"
>{{ partial "icon.html" $name }}</a
>
{{ end }}
{{ end }}
</div>
{{ end }}
+1 -16
View File
@@ -9,22 +9,7 @@
{{ . }}
</div>
{{ end }}
{{ with .Site.Author.links }}
<div class="flex flex-wrap text-lg text-gray-400 dark:text-gray-500">
{{ range $links := . }}
{{ range $name, $url := $links }}
<a
class="mr-2 hover:text-primary-700 dark:hover:text-primary-400"
href="{{ $url }}"
target="_blank"
alt="{{ $name | title }}"
rel="me"
>{{ partial "icon.html" $name }}</a
>
{{ end }}
{{ end }}
</div>
{{ end }}
{{ partialCached "author-links.html" . }}
</div>
</div>
{{ end }}
+1 -1
View File
@@ -1,4 +1,4 @@
<header class="flex justify-between py-10 font-semibold ">
<header class="flex justify-between py-6 font-semibold sm:py-10">
<div>
<a class="hover:underline" rel="me" href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
</div>
+8
View File
@@ -0,0 +1,8 @@
<article class="max-w-full prose dark:prose-light">
{{ with .Title }}
<header>
<h1>{{ . | emojify }}</h1>
</header>
{{ end }}
<section>{{ .Content | emojify }}</section>
</article>
+21
View File
@@ -0,0 +1,21 @@
<article
class="flex flex-col items-center justify-center text-center
{{ if not .Site.Params.homepage.showList -}}
h-full
{{- else -}}
mb-8
{{- end }}"
>
<header class="flex flex-col items-center mb-3">
{{ with .Site.Author.image }}
<img class="mb-2 rounded-full w-36 h-36" src="{{ . }}" />
{{ end }}
<h1 class="text-4xl font-extrabold">
{{ .Site.Author.name | default .Site.Title }}
</h1>
<div class="mt-1 text-2xl">
{{ partialCached "author-links.html" . }}
</div>
</header>
<section class="prose dark:prose-light">{{ .Content | emojify }}</section>
</article>