Add post: 暗黑能天使
This commit is contained in:
159
layouts/partials/components/doc-layout.html
Normal file
159
layouts/partials/components/doc-layout.html
Normal file
@@ -0,0 +1,159 @@
|
||||
{{ $hasToc := and (in .TableOfContents "<li>" ) (.Params.toc) }}
|
||||
{{ $hasSidebar := or ($hasToc) (.Params.series) }}
|
||||
<div class="lg:pt-12">
|
||||
<div class="flex flex-col md:flex-row bg-secondary-bg rounded">
|
||||
<div class="md:w-1/4 lg:w-1/5 border-e">
|
||||
<div class="sticky top-16 pt-6">
|
||||
{{ template "doc-sidebar" (dict "context" . "permalink" .Permalink) }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="w-full md:w-3/4 lg:w-4/5 pb-8 pt-2 md:pt-8">
|
||||
<div class="flex">
|
||||
<div class="w-full lg:w-3/4 px-6">
|
||||
{{ partial "components/post-article" . }}
|
||||
|
||||
{{ with .GetTerms "tags" }}
|
||||
{{ partial "components/post-tags" . }}
|
||||
{{ end }}
|
||||
{{ with .GetTerms "authors" }}
|
||||
{{ partial "components/post-author" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/post-edit" . }}
|
||||
|
||||
{{ partial "components/post-footer" . }}
|
||||
{{ partial "comment" . }}
|
||||
</div>
|
||||
{{ if $hasSidebar}}
|
||||
<div class="hidden lg:block lg:w-1/4">
|
||||
{{ if ne $hasToc false }}
|
||||
{{ partial "components/post-toc" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
{{/* highlight.js */}}
|
||||
{{- if eq .Site.Params.highlight.handler "highlightjs" }}
|
||||
hljs.highlightAll();
|
||||
{{- end }}
|
||||
changeSidebarHeight();
|
||||
switchDocToc();
|
||||
})
|
||||
</script>
|
||||
|
||||
{{ define "doc-sidebar" }}
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{ $parentLayout := partial "utils/hyphenate" (.context.Parent.Layout | default .context.Parent.Type) }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{ if eq $parentLayout "doc-list" }}
|
||||
{{ template "list-pages" (dict "context" .context "permalink" .permalink) }}
|
||||
{{ else if (findRE "v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?/$" .context.Permalink) }}
|
||||
{{ template "list-pages" (dict "context" .context "permalink" .permalink) }}
|
||||
{{ else }}
|
||||
{{ template "doc-sidebar" (dict "context" .context.Parent "permalink" .permalink) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "list-pages" }}
|
||||
<div id="sidebar-title" class="md:hidden mx-4 px-2 pt-4 pb-2 md:border-b text-tertiary-text md:text-primary-text">
|
||||
<span class="font-semibold">{{ i18n "toc" }}</span>
|
||||
<i class='fas {{ cond (eq .Site.Language.LanguageDirection "rtl") "fa-caret-left" "fa-caret-right" }} ms-1'></i>
|
||||
</div>
|
||||
|
||||
<div id="sidebar-toc"
|
||||
class="hidden md:block overflow-y-auto mx-6 md:mx-0 pe-6 pt-2 md:max-h-doc-sidebar bg-primary-bg md:bg-transparent">
|
||||
<div class="flex flex-wrap ms-4 -me-2 p-2 bg-secondary-bg md:bg-primary-bg rounded">
|
||||
<a class="{{ if eq .context.Permalink .permalink }}text-eureka{{ end }} hover:text-eureka"
|
||||
href="{{ .context.Permalink }}">{{ .context.LinkTitle }}</a>
|
||||
|
||||
{{ $versions := partial "get-versions" (dict "context" .context) }}
|
||||
{{ if $versions }}
|
||||
<div class="relative ms-2 cursor-pointer">
|
||||
<div id="doc-version" class="flex items-center bg-primary-bg md:bg-secondary-bg">
|
||||
{{ $version := findRE "v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?" .context.Permalink }}
|
||||
<span class="ms-2 me-1">{{ cond (gt (len $version) 0) (index $version 0) "latest" }}</span>
|
||||
<i class='fas {{ cond (eq .Site.Language.LanguageDirection "rtl") "fa-caret-left" "fa-caret-right" }} w-4 h-4 me-1'></i>
|
||||
</div>
|
||||
<div id="version-options" class="hidden absolute start-0 bg-secondary-bg rounded z-40">
|
||||
{{ range $index, $value := $versions }}
|
||||
{{ if eq $index 0 }}
|
||||
<div class="ms-2 me-8 my-1">
|
||||
<a class="" href="{{ $.context.Parent.Permalink }}">latest</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ $version := findRE "v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?" . }}
|
||||
<div class="ms-2 me-8 my-1">
|
||||
<a class="" href="{{ . }}">{{ index $version 0 }}</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="fixed hidden inset-0 opacity-0 h-full w-full cursor-default z-0" id="switch-canvas">
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
switchDocVersion();
|
||||
})
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
|
||||
</div>
|
||||
{{ template "list-items" (dict "context" .context "permalink" .permalink) }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "list-items"}}
|
||||
<ul class="ps-6">
|
||||
{{ range .context.Pages }}
|
||||
{{ $version := findRE "v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?/$" .Permalink }}
|
||||
{{ if eq (len $version) 0 }}
|
||||
<li class="py-2">
|
||||
<div class="{{ if .IsSection }} pb-2 {{ end }}">
|
||||
<a class="{{ if eq .Permalink $.permalink }} text-eureka {{ end }} hover:text-eureka"
|
||||
href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||
</div>
|
||||
{{ if .IsSection }}
|
||||
{{ template "list-items" (dict "context" . "permalink" $.permalink) }}
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
||||
{{ define "partials/get-versions" }}
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{ $parentLayout := partial "utils/hyphenate" (.context.Parent.Layout | default .context.Parent.Type) }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{ if eq $parentLayout "doc-list" }}
|
||||
{{ range .context.Pages.Reverse }}
|
||||
{{ $hasVersion := findRE "v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?/$" .Permalink }}
|
||||
{{ if $hasVersion}}
|
||||
{{ $version := slice .Permalink }}
|
||||
{{ $.context.Scratch.Add "versions" $version }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ range .context.Parent.Pages.Reverse }}
|
||||
{{ $hasVersion := findRE "v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?/$" .Permalink }}
|
||||
{{ if $hasVersion }}
|
||||
{{ $version := slice .Permalink }}
|
||||
{{ $.context.Scratch.Add "versions" $version }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $versions := .context.Scratch.Get "versions" }}
|
||||
{{ .context.Scratch.Delete "versions" }}
|
||||
{{ return $versions }}
|
||||
{{ end }}
|
||||
5
layouts/partials/components/doc-list.html
Normal file
5
layouts/partials/components/doc-list.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{{ partial "components/list-article" . }}
|
||||
<div class="bg-secondary-bg rounded px-6">
|
||||
{{ partial "components/summary-list-plain" .Paginator.Pages }}
|
||||
</div>
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
6
layouts/partials/components/list-article.html
Normal file
6
layouts/partials/components/list-article.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<article class="prose mx-6 my-8">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ with .Content }}
|
||||
{{ . }}
|
||||
{{ end }}
|
||||
</article>
|
||||
21
layouts/partials/components/masonry.html
Normal file
21
layouts/partials/components/masonry.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{ with . }}
|
||||
<div class="mx-4 xl:mx-16">
|
||||
<div class="flex flex-row items-center justify-between">
|
||||
<h2 class=" font-bold text-3xl my-4">{{ i18n "recent" }}</h2>
|
||||
</div>
|
||||
<div class="masonry grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-8">
|
||||
{{ range first 10 . }}
|
||||
<div class="item">
|
||||
<div class="grid-content">
|
||||
{{ partial "components/summary-masonry" . }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', ()=>{
|
||||
enableMasonry()
|
||||
})
|
||||
</script>
|
||||
{{ end }}
|
||||
80
layouts/partials/components/opengraph.html
Normal file
80
layouts/partials/components/opengraph.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<meta property="og:title" content="{{ partial "get-title" . }}" />
|
||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
|
||||
{{ $icon := partial "utils/get-image" (dict "context" . "url" .Site.Params.icon) }}
|
||||
{{ with $icon }}
|
||||
<meta property="og:image" content="{{ . }}">
|
||||
{{ end }}
|
||||
|
||||
<meta property="og:url" content="{{ .Permalink }}" />
|
||||
|
||||
{{ with .Params.audio }}
|
||||
<meta property="og:audio" content="{{ . | absURL }}" />
|
||||
{{ end }}
|
||||
{{ with .Description }}
|
||||
<meta property="og:description" content="{{ . }}" />
|
||||
{{ else }}
|
||||
{{if .IsPage}}
|
||||
<meta property="og:description" content="{{ .Summary }}" />
|
||||
{{ else }}
|
||||
{{ with .Site.Params.Description }}
|
||||
<meta property="og:description" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.LanguageCode }}
|
||||
<meta property="og:locale" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ if .IsTranslated }}
|
||||
{{ range .Translations }}
|
||||
<meta property="og:locale:alternate" content="{{ .Lang }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Title }}
|
||||
<meta property="og:site_name" content="{{ . }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.videos }}
|
||||
{{ range . }}
|
||||
<meta property="og:video" content="{{ . | absURL }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsPage }}
|
||||
{{ if not .PublishDate.IsZero }}
|
||||
<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}" />
|
||||
{{ else if not .Date.IsZero }}
|
||||
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}" />
|
||||
{{ end }}
|
||||
{{ if not .Lastmod.IsZero }}
|
||||
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}" />
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ if not .Date.IsZero }}
|
||||
<meta property="og:updated_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<meta property="article:section" content="{{ .Section }}" />
|
||||
{{ with .Params.tags }}
|
||||
{{ range first 6 . }}
|
||||
<meta property="article:tag" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .GetTerms "series" }}
|
||||
{{ $pageLink := .Permalink }}
|
||||
{{ $series := .Site.Taxonomies.series}}
|
||||
{{ range (.GetTerms "series") }}
|
||||
{{ range .Pages }}
|
||||
{{ if ne .Page.Permalink $pageLink }}
|
||||
<meta property="og:see_also" content="{{ .Page.Permalink }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else if (.Site.RegularPages.Related .) }}
|
||||
{{ range (.Site.RegularPages.Related . | first 6) }}
|
||||
<meta property="og:see_also" content="{{ .Page.Permalink }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
12
layouts/partials/components/post-article.html
Normal file
12
layouts/partials/components/post-article.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<article class="prose">
|
||||
<h1 class="mb-4">{{ .Title }}</h1>
|
||||
|
||||
{{ partial "components/post-metadata" . }}
|
||||
|
||||
{{ $featured := partial "utils/get-featured" . }}
|
||||
{{ with $featured }}
|
||||
{{ . }}
|
||||
{{ end }}
|
||||
|
||||
{{ .Content }}
|
||||
</article>
|
||||
36
layouts/partials/components/post-author.html
Normal file
36
layouts/partials/components/post-author.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<div class="py-2">
|
||||
{{ range . }}
|
||||
<div class="my-8 flex flex-col items-center md:flex-row">
|
||||
<a href="{{ .Permalink }}" class="md:me-4 text-primary-text h-24 w-24">
|
||||
{{ $img := partial "utils/get-image" (dict "context" . "url" .Params.avatar "keyword" "*avatar*") }}
|
||||
{{ with $img }}
|
||||
<img
|
||||
src="{{ . }}"
|
||||
class="bg-primary-bg w-full rounded-full"
|
||||
alt="Avatar"
|
||||
/>
|
||||
{{ else }}
|
||||
<i class="fas fa-user-circle fa-6x"></i>
|
||||
{{ end }}
|
||||
</a>
|
||||
<div class="mt-4 w-full md:mt-0 md:w-auto">
|
||||
<a
|
||||
href="{{ .Permalink }}"
|
||||
class="mb-2 block border-b pb-1 text-lg font-bold"
|
||||
>
|
||||
<h3>{{ .LinkTitle }}</h3>
|
||||
</a>
|
||||
<span class="block pb-2">{{ .Params.bio }}</span>
|
||||
{{ range .Params.social }}
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{ $iconPack := .iconPack | default .icon_pack }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{ $src := print $iconPack " fa-" .icon }}
|
||||
<a href="{{ .url }}" class="me-2">
|
||||
<i class="{{ print $src }}"></i>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
51
layouts/partials/components/post-edit.html
Normal file
51
layouts/partials/components/post-edit.html
Normal file
@@ -0,0 +1,51 @@
|
||||
{{- $editMap := partial "get-edit-url" . }}
|
||||
{{- if or .Site.Params.repoEditURL $editMap.repoEditURL }}
|
||||
<div class="flex md:justify-end my-4">
|
||||
{{- $contentDir := cond .Site.IsMultiLingual .Site.Params.contentDir "/content/" }}
|
||||
{{- $filePath := ""}}
|
||||
{{- if $editMap.fileDir }}
|
||||
{{- $filePath = strings.TrimPrefix $editMap.fileDir .File.Path }}
|
||||
{{- else }}
|
||||
{{- $filePath = path.Join $contentDir .File.Path }}
|
||||
{{- end }}
|
||||
|
||||
{{- $repoEditURL := cond (ne $editMap.repoEditURL "") $editMap.repoEditURL .Site.Params.repoEditURL }}
|
||||
{{- $path := path.Join $repoEditURL $filePath }}
|
||||
{{- $path = replace $path "http:/" "http://" 1 }}
|
||||
{{- $path = replace $path "https:/" "https://" 1 }}
|
||||
|
||||
<a href="{{ $path }}" title="Edit this page">
|
||||
<i class="fas fa-edit me-1"></i>
|
||||
<span>{{ i18n "editThisPage" }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{- else if .Site.Params.repoURL }}
|
||||
{{ warnf "Param 'repoURL' in params.yaml is deprecated and will be removed in Eureka v1.0.0. See https://www.wangchucheng.com/en/docs/hugo-eureka/customization/#params-config-file" }}
|
||||
<div class="flex md:justify-end my-4">
|
||||
{{- $repoEditURL := path.Join .Site.Params.repoURL "/blob/master/" }}
|
||||
{{ $contentDir := cond .Site.IsMultiLingual .Site.Params.contentDir "/content/" }}
|
||||
{{ $path := path.Join $repoEditURL $contentDir .File.Path }}
|
||||
{{ $path = replace $path "http:/" "http://" 1 }}
|
||||
{{ $path = replace $path "https:/" "https://" 1 }}
|
||||
|
||||
<a href="{{ $path }}" title="Edit this page">
|
||||
<i class="fas fa-edit me-1"></i>
|
||||
<span>{{ i18n "editThisPage" }}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{- end }}
|
||||
|
||||
{{ define "partials/get-edit-url" }}
|
||||
{{ $repoEditURL := "" }}
|
||||
{{ $fileDir := "" }}
|
||||
{{ $bundles := partial "utils/get-bundles" . }}
|
||||
{{ range $bundles.Reverse }}
|
||||
{{ if .Params.repoEditURL }}
|
||||
{{ $repoEditURL = .Params.repoEditURL }}
|
||||
{{ $fileDir = .File.Dir }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ return (dict "repoEditURL" $repoEditURL "fileDir" $fileDir) }}
|
||||
{{ end }}
|
||||
20
layouts/partials/components/post-footer.html
Normal file
20
layouts/partials/components/post-footer.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{{ if or .PrevInSection .NextInSection }}
|
||||
<div
|
||||
class="-mx-2 mt-4 flex flex-col border-t px-2 pt-4 md:flex-row md:justify-between"
|
||||
>
|
||||
<div>
|
||||
{{ with .NextInSection }}
|
||||
<span class="text-primary-text block font-bold"
|
||||
>{{ i18n "previous" }}</span
|
||||
>
|
||||
<a href="{{ .Permalink }}" class="block">{{ .LinkTitle }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="mt-4 md:mt-0 md:text-right">
|
||||
{{ with .PrevInSection }}
|
||||
<span class="text-primary-text block font-bold">{{ i18n "next" }}</span>
|
||||
<a href="{{ .Permalink }}" class="block">{{ .LinkTitle }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
42
layouts/partials/components/post-metadata.html
Normal file
42
layouts/partials/components/post-metadata.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<div
|
||||
class="text-tertiary-text not-prose mt-2 flex flex-row flex-wrap items-center"
|
||||
>
|
||||
<div class="me-6 my-2">
|
||||
<i class="fas fa-calendar me-1"></i>
|
||||
<span
|
||||
>{{ .Date.Format (.Site.Params.dateFormat | default "2006-01-02") }}</span
|
||||
>
|
||||
</div>
|
||||
<div class="me-6 my-2">
|
||||
<i class="fas fa-clock me-1"></i>
|
||||
<span>{{ i18n "readingTime" .ReadingTime }}</span>
|
||||
</div>
|
||||
|
||||
{{ with .GetTerms "categories" }}
|
||||
<div class="me-6 my-2">
|
||||
<i class="fas fa-folder me-1"></i>
|
||||
{{ range $index, $value := . }}
|
||||
{{ if gt $index 0 }}
|
||||
<span>, </span>
|
||||
{{ end -}}
|
||||
<a href="{{ .Permalink }}" class="hover:text-eureka"
|
||||
>{{ .LinkTitle }}</a
|
||||
>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ with .GetTerms "series" }}
|
||||
<div class="me-6 my-2">
|
||||
<i class="fas fa-th-list me-1"></i>
|
||||
{{ range $index, $value := . }}
|
||||
{{ if gt $index 0 }}
|
||||
<span>, </span>
|
||||
{{ end -}}
|
||||
<a href="{{ .Permalink }}" class="hover:text-eureka"
|
||||
>{{ .LinkTitle }}</a
|
||||
>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
10
layouts/partials/components/post-series.html
Normal file
10
layouts/partials/components/post-series.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{ $series := .Site.Taxonomies.series }}
|
||||
<div class="bg-secondary-bg prose max-w-none rounded p-6">
|
||||
<h3>{{ i18n "seriesOfPosts" }}</h3>
|
||||
{{ range (.GetTerms "series") }}
|
||||
{{ range .Pages }}
|
||||
<a href="{{ .Permalink }}" class="no-underline">{{ .LinkTitle }}</a>
|
||||
<br />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
5
layouts/partials/components/post-tags.html
Normal file
5
layouts/partials/components/post-tags.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<div class="my-4">
|
||||
{{ range $index, $value := . }}
|
||||
<a href="{{ .Permalink }}" class="inline-block bg-tertiary-bg text-sm rounded px-3 py-1 my-1 me-2 hover:text-eureka">#{{ .LinkTitle }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
21
layouts/partials/components/post-toc.html
Normal file
21
layouts/partials/components/post-toc.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<div
|
||||
class="{{ if eq .Type "docs" }}
|
||||
bg-secondary-bg
|
||||
{{ else }}
|
||||
bg-primary-bg
|
||||
{{ end }} prose sticky top-16 z-10 hidden px-6 py-4 lg:block"
|
||||
>
|
||||
<h3>{{ i18n "onThisPage" }}</h3>
|
||||
</div>
|
||||
<div
|
||||
class="sticky-toc {{ if eq .Type "docs" }}
|
||||
border-s
|
||||
{{ end }} hidden px-6 pb-6 lg:block"
|
||||
>
|
||||
{{ .TableOfContents }}
|
||||
</div>
|
||||
<script>
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
enableStickyToc();
|
||||
});
|
||||
</script>
|
||||
29
layouts/partials/components/schema-node.html
Normal file
29
layouts/partials/components/schema-node.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{{- $paginator := .Paginate .Pages }}
|
||||
{{- $pages := .Paginator.Pages }}
|
||||
{{- if eq .Type "authors" }}
|
||||
{{- $pages = .Pages }}
|
||||
{{- end }}
|
||||
{{- with $pages }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context":"https://schema.org",
|
||||
"@type":"ItemList",
|
||||
"itemListElement":[
|
||||
{{- range $index, $value := . -}}
|
||||
{{- if gt $index 0 -}},{{- end -}}
|
||||
{
|
||||
"@type":"ListItem",
|
||||
"position": {{ add $index 1 }},
|
||||
"name": {{ .Title }},
|
||||
"description": {{ if .Description }}{{ .Description }}{{ else if .Summary }}{{ .Summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ end }},
|
||||
{{- $img := partial "utils/get-image" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
|
||||
{{- with $img }}
|
||||
"image": {{ . }},
|
||||
{{- end }}
|
||||
"url": {{ .Permalink }}
|
||||
}
|
||||
{{- end }}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
{{- end }}
|
||||
62
layouts/partials/components/schema-page.html
Normal file
62
layouts/partials/components/schema-page.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Article",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": {{ .Permalink }}
|
||||
},
|
||||
"headline": "{{ partial "get-title" . }}",
|
||||
{{- $img := partial "utils/get-image" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
|
||||
{{- with $img }}
|
||||
"image": {{ . }},
|
||||
{{ end -}}
|
||||
|
||||
{{ if .IsPage -}}
|
||||
{{ if not .PublishDate.IsZero -}}
|
||||
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
|
||||
{{ else if not .Date.IsZero -}}
|
||||
"datePublished": {{ .Date.Format "2006-01-02T15:04:05-07:00" }},
|
||||
{{ end -}}
|
||||
{{ if not .Lastmod.IsZero -}}
|
||||
"dateModified": {{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }},
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ with .WordCount -}}
|
||||
"wordCount": {{ . }},
|
||||
{{ end -}}
|
||||
{{ with .Params.authors -}}
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": {{ . }}
|
||||
},
|
||||
{{ end -}}
|
||||
"publisher": {
|
||||
{{ with .Site.Params.siteType -}}
|
||||
"@type": {{ . }},
|
||||
{{ else -}}
|
||||
"@type": "Person",
|
||||
{{ end -}}
|
||||
{{ with .Site.Params.publisherName -}}
|
||||
"name": {{ . }},
|
||||
{{ else -}}
|
||||
"name": {{ .Site.Title }},
|
||||
{{ end -}}
|
||||
{{ $publisherLogo := partial "utils/get-image" (dict "context" . "url" .Site.Params.publisherLogo) -}}
|
||||
{{ $icon := partial "utils/get-image" (dict "context" . "url" .Site.Params.icon) -}}
|
||||
{{ if $publisherLogo -}}
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": {{ $publisherLogo }}
|
||||
}
|
||||
{{ else if $icon -}}
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": {{ $icon }}
|
||||
}
|
||||
{{ end -}}
|
||||
},
|
||||
"description": "{{ if .Description }}{{ .Description }}{{ else if .Summary }}{{ .Summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ end }}"
|
||||
}
|
||||
</script>
|
||||
34
layouts/partials/components/schema.html
Normal file
34
layouts/partials/components/schema.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<meta name="description"
|
||||
content="{{ if .Description }}{{ .Description }}{{ else if .Summary }}{{ .Summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ end }}">
|
||||
|
||||
{{- $bundles := partial "utils/get-bundles" . }}
|
||||
{{- if gt (len $bundles) 1 }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
"itemListElement": [
|
||||
{{- range $index, $value := $bundles.Reverse -}}
|
||||
{{- if gt $index 0 -}},{{- end -}}
|
||||
{
|
||||
"@type": "ListItem",
|
||||
"position": {{- add $index 1 -}},
|
||||
"name": {{- .LinkTitle -}},
|
||||
"item": {{- .Permalink -}}
|
||||
}
|
||||
{{- end -}}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
{{- end }}
|
||||
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{ $layout := partial "utils/hyphenate" (.Layout | default .Type) }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{- if and (eq .Type "docs") (ne $layout "doc-list") }}
|
||||
{{- partial "components/schema-page" . }}
|
||||
{{- else if or (eq .Kind "section") (eq .Kind "term") }}
|
||||
{{- partial "components/schema-node" . }}
|
||||
{{- else if .IsPage }}
|
||||
{{- partial "components/schema-page" . }}
|
||||
{{- end }}
|
||||
3
layouts/partials/components/summary-card.html
Normal file
3
layouts/partials/components/summary-card.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="bg-secondary-bg rounded border hover:shadow-lg transition ease-in-out duration-200 px-6 pt-6 pb-4">
|
||||
{{ partial "components/summary-plain" . }}
|
||||
</div>
|
||||
5
layouts/partials/components/summary-list-card.html
Normal file
5
layouts/partials/components/summary-list-card.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{{ range . }}
|
||||
<div class="mb-6">
|
||||
{{ partial "components/summary-card" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
15
layouts/partials/components/summary-list-masonry.html
Normal file
15
layouts/partials/components/summary-list-masonry.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<div class="masonry grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-8">
|
||||
{{ range . }}
|
||||
<div class="item">
|
||||
<div class="grid-content">
|
||||
{{ partial "components/summary-masonry" . }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
enableMasonry()
|
||||
})
|
||||
</script>
|
||||
8
layouts/partials/components/summary-list-plain.html
Normal file
8
layouts/partials/components/summary-list-plain.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<div class="overflow-hidden divide-y">
|
||||
{{ range . }}
|
||||
<div class="py-6">
|
||||
{{ partial "components/summary-plain" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
19
layouts/partials/components/summary-masonry.html
Normal file
19
layouts/partials/components/summary-masonry.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<div
|
||||
class="bg-secondary-bg dark:border-tertiary-bg overflow-hidden rounded border transition duration-200 ease-in-out hover:shadow-lg"
|
||||
>
|
||||
{{ $featured := partial "utils/get-featured" . }}
|
||||
{{ with $featured }}
|
||||
{{ . }}
|
||||
{{ end }}
|
||||
<div class="prose px-6 pt-6 pb-4">
|
||||
<a href="{{ .Permalink }}" class="no-underline">
|
||||
<h3 class="mt-0">{{ .LinkTitle }}</h3>
|
||||
</a>
|
||||
{{ if .Description }}
|
||||
{{ .Description | plainify | htmlUnescape }}
|
||||
{{ else if .Summary }}
|
||||
{{ .Summary | plainify | htmlUnescape }}
|
||||
{{ end }}
|
||||
{{ partial "components/post-metadata" . }}
|
||||
</div>
|
||||
</div>
|
||||
12
layouts/partials/components/summary-plain.html
Normal file
12
layouts/partials/components/summary-plain.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<div class="flex flex-col-reverse lg:flex-row justify-between">
|
||||
{{ $featured := partial "utils/get-featured" . }}
|
||||
<div class="w-full {{ with $featured }}lg:w-2/3{{ end }}">
|
||||
{{ partial "utils/get-summary" . }}
|
||||
</div>
|
||||
|
||||
{{ with $featured }}
|
||||
<div class="w-full lg:w-1/3 mb-4 lg:mb-0 lg:ms-8">
|
||||
{{ . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
Reference in New Issue
Block a user