Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wangchucheng/hugo-eureka.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Chucheng <me@wangchucheng.com>2020-12-27 21:06:11 +0300
committerWang Chucheng <me@wangchucheng.com>2020-12-27 21:06:11 +0300
commitc33985a935b5bf5706bed27bc112f700df2f2903 (patch)
tree431d55abb64e7d125b9056475e31abc26ede6a33 /layouts
parent3023aca70db61f681db293c21341769de8111a59 (diff)
feat: widget system for configuring homepagev0.4.0
BREAKING CHANGE: Param 'hero' in params.toml is deprecated. BREAKING CHANGE: Param 'icon_pack' in %q is deprecated. Use 'iconPack'. BREAKING CHANGE: 'doc_list' in doc layout is deprecated. Use 'doc-list'. Closes #11
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html6
-rw-r--r--layouts/_default/list.html8
-rw-r--r--layouts/_default/single.html16
-rw-r--r--layouts/authors/list.html56
-rw-r--r--layouts/docs/doc-list.html3
-rw-r--r--layouts/docs/doc_list.html22
-rw-r--r--layouts/docs/list.html2
-rw-r--r--layouts/docs/single.html2
-rw-r--r--layouts/index.html200
-rw-r--r--layouts/partials/comment.html4
-rw-r--r--layouts/partials/components/doc-layout.html (renamed from layouts/partials/doc_layout.html)52
-rw-r--r--layouts/partials/components/doc-list.html12
-rw-r--r--layouts/partials/components/masonry.html (renamed from layouts/partials/masonry.html)2
-rw-r--r--layouts/partials/components/opengraph.html (renamed from layouts/partials/opengraph.html)8
-rw-r--r--layouts/partials/components/post-author.html (renamed from layouts/partials/post_author.html)5
-rw-r--r--layouts/partials/components/post-edit.html (renamed from layouts/partials/post_edit.html)4
-rw-r--r--layouts/partials/components/post-footer.html (renamed from layouts/partials/post_footer.html)0
-rw-r--r--layouts/partials/components/post-metadata.html (renamed from layouts/partials/post_metadata.html)2
-rw-r--r--layouts/partials/components/post-series.html (renamed from layouts/partials/post_series.html)0
-rw-r--r--layouts/partials/components/post-tags.html (renamed from layouts/partials/post_tags.html)0
-rw-r--r--layouts/partials/components/post-toc.html (renamed from layouts/partials/post_toc.html)0
-rw-r--r--layouts/partials/components/schema-node.html (renamed from layouts/partials/schema_node.html)4
-rw-r--r--layouts/partials/components/schema-page.html (renamed from layouts/partials/schema_page.html)10
-rw-r--r--layouts/partials/components/schema.html (renamed from layouts/partials/schema.html)15
-rw-r--r--layouts/partials/components/summary-card.html3
-rw-r--r--layouts/partials/components/summary-list-card.html5
-rw-r--r--layouts/partials/components/summary-list-masonry.html15
-rw-r--r--layouts/partials/components/summary-list-plain.html8
-rw-r--r--layouts/partials/components/summary-masonry.html17
-rw-r--r--layouts/partials/components/summary-plain.html12
-rw-r--r--layouts/partials/custom-head.html (renamed from layouts/partials/custom_head.html)0
-rw-r--r--layouts/partials/get_featured.html9
-rw-r--r--layouts/partials/head.html44
-rw-r--r--layouts/partials/horizontal_summary.html43
-rw-r--r--layouts/partials/stacked_summary.html17
-rw-r--r--layouts/partials/utils/get-featured.html9
-rw-r--r--layouts/partials/utils/get-image.html (renamed from layouts/partials/get_image.html)0
-rw-r--r--layouts/partials/utils/get-summary.html29
-rw-r--r--layouts/partials/utils/get-video.html (renamed from layouts/partials/get_video.html)0
-rw-r--r--layouts/partials/utils/hyphenate.html1
-rw-r--r--layouts/partials/utils/standardize-classes.html4
-rw-r--r--layouts/partials/widgets/about.html13
-rw-r--r--layouts/partials/widgets/blank.html1
-rw-r--r--layouts/partials/widgets/details.html3
-rw-r--r--layouts/partials/widgets/pages.html49
-rw-r--r--layouts/partials/widgets/vintage.html21
46 files changed, 528 insertions, 208 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 0b11f59..37360b6 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang='{{ .Site.LanguageCode }}' {{ if eq .Site.Params.colorScheme "dark" }}class="dark" {{ end }}>
-{{- partial "head.html" . }}
+{{- partial "head" . }}
<body class="flex flex-col min-h-screen">
<header class="fixed flex items-center w-full min-h-16 pl-scrollbar z-50 bg-secondary-bg shadow-sm">
<div class="w-full max-w-screen-xl mx-auto">
- {{- partial "header.html" . -}}
+ {{- partial "header" . -}}
</div>
</header>
<main class="flex-grow pt-16">
@@ -21,7 +21,7 @@
</main>
<footer class="pl-scrollbar">
<div class="w-full max-w-screen-xl mx-auto">
- {{- partial "footer.html" . -}}
+ {{- partial "footer" . -}}
</div>
</footer>
</body>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 0d02552..47725d5 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -7,12 +7,8 @@
</div>
{{ end }}
</article>
-<div class="bg-secondary-bg rounded overflow-hidden px-4 divide-y">
- {{ range .Paginator.Pages }}
- <div class="px-2 py-6">
- {{ partial "horizontal_summary.html" . }}
- </div>
- {{ end }}
+<div class="bg-secondary-bg rounded px-6">
+ {{ partial "components/summary-list-plain" .Paginator.Pages }}
</div>
{{ template "_internal/pagination.html" . }}
{{ end }} \ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index a9053bf..8656069 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -5,9 +5,9 @@
<div
class="col-span-2 {{ if not $hasSidebar }} {{- print "lg:col-start-2" -}} {{ end }} lg:col-span-6 bg-secondary-bg rounded px-6 py-8">
<h1 class="font-bold text-3xl text-primary-text">{{ .Title }}</h1>
- {{ partial "post_metadata.html" . }}
+ {{ partial "components/post-metadata" . }}
- {{ $featured := partial "get_featured" . }}
+ {{ $featured := partial "utils/get-featured" . }}
{{ with $featured }}
<div class="my-4">
{{ . }}
@@ -18,27 +18,27 @@
{{ .Content}}
</div>
{{ with .GetTerms "tags" }}
- {{ partial "post_tags.html" . }}
+ {{ partial "components/post-tags" . }}
{{ end }}
{{ if or .Site.Params.repoURL .Site.Params.repoEditURL }}
- {{ partial "post_edit.html" . }}
+ {{ partial "components/post-edit" . }}
{{ end }}
{{ with .GetTerms "authors" }}
- {{ partial "post_author.html" . }}
+ {{ partial "components/post-author" . }}
{{ end }}
- {{ partial "post_footer.html" . }}
+ {{ partial "components/post-footer" . }}
{{ partial "comment.html" . }}
</div>
{{ if $hasSidebar}}
<div class="col-span-2">
{{ if .GetTerms "series" }}
- {{ partial "post_series.html" . }}
+ {{ partial "components/post-series" . }}
{{ end }}
{{ if $hasToc }}
- {{ partial "post_toc.html" . }}
+ {{ partial "components/post-toc" . }}
{{ end }}
</div>
{{ end }}
diff --git a/layouts/authors/list.html b/layouts/authors/list.html
index 7d288ed..90d5fb3 100644
--- a/layouts/authors/list.html
+++ b/layouts/authors/list.html
@@ -1,10 +1,60 @@
{{ define "main" }}
<div class="lg:pt-12">
<div class="bg-secondary-bg rounded primary-text px-6 md:px-16 lg:px-32">
- {{ partial "widgets/about.html" . }}
- {{ partial "widgets/details.html" . }}
+ <div class="flex flex-col lg:flex-row items-center justify-center py-12">
+ {{ $img := partial "utils/get-image" (dict "context" . "url" .Params.avatar "keyword" "*avatar*")}}
+ {{ with $img }}
+ <div class="w-48 mx-auto lg:-my-8 lg:ml-0 lg:mr-8 lg:pr-8 lg:py-8 lg:border-r">
+ <img src="{{ . }}" class="rounded-full" alt="Avatar">
+ </div>
+ {{ end }}
+ <div class="flex-grow mt-4 md:mt-0">
+ <div class="text-3xl leading-tight py-4">{{ .Title }}</div>
+ <div class="w-3/12 xl:w-2/12 border-b"></div>
+
+ <div class="flex items-center pt-4">
+ {{ with or (.Params.role) (.Params.organizations)}}
+ <i class="fas fa-user-tag"></i>
+ {{ end }}
+ <div class="flex flex-wrap">
+ {{ with .Params.role }}
+ <span class="pl-4">{{ . }}</span>
+ {{ end }}
+
+ {{ with .Params.organization }}
+ <a href="{{ .url }}" class="pl-4">{{ .name }}</a>
+ {{ end }}
+ </div>
+
+ </div>
+
+ {{ with .Params.bio }}
+ <div class="py-8 text-lg leading-normal">
+ {{ . }}
+ </div>
+ {{ end }}
+ </div>
+ <div class="flex lg:flex-col justify-center items-end ml-8">
+ {{ $brand := $.Param "social"}}
+ {{ range $brand }}
+ {{/* Deprecation warning(v1.0.0) starts */}}
+ {{ if .icon_pack }}
+ {{ warnf "Param 'icon_pack' in %q is deprecated and will be removed in Eureka v1.0.0. Use 'iconPack' instead." $.File.Path }}
+ {{ end }}
+ {{ $iconPack := .iconPack | default .icon_pack }}
+ {{/* Deprecation warning(v1.0.0) ends */}}
+ {{ $src := print $iconPack " fa-" .icon }}
+ <div class="pb-2 pr-4 lg:pr-0 pt-4 lg:pt-0">
+ <a href="{{ .url }}"><i class="{{ print $src }}"></i></a>
+ </div>
+ {{ end }}
+ </div>
+ </div>
+ <div class="content pb-20">
+ {{ .Content }}
+ </div>
</div>
{{ $pages := .Pages }}
- {{ partial "masonry.html" $pages }}
+ {{ partial "components/masonry" $pages }}
</div>
{{ end }} \ No newline at end of file
diff --git a/layouts/docs/doc-list.html b/layouts/docs/doc-list.html
new file mode 100644
index 0000000..3a0513b
--- /dev/null
+++ b/layouts/docs/doc-list.html
@@ -0,0 +1,3 @@
+{{ define "main" }}
+{{ partial "components/doc-list" . }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/docs/doc_list.html b/layouts/docs/doc_list.html
index 0d02552..a349171 100644
--- a/layouts/docs/doc_list.html
+++ b/layouts/docs/doc_list.html
@@ -1,18 +1,6 @@
+{{/* Deprecation warning(v1.0.0) starts */}}
{{ define "main" }}
-<article class="mx-6 my-8">
- <h1 class="font-bold text-3xl text-primary-text">{{ .Title }}</h1>
- {{ with .Content }}
- <div class="content">
- {{ . }}
- </div>
- {{ end }}
-</article>
-<div class="bg-secondary-bg rounded overflow-hidden px-4 divide-y">
- {{ range .Paginator.Pages }}
- <div class="px-2 py-6">
- {{ partial "horizontal_summary.html" . }}
- </div>
- {{ end }}
-</div>
-{{ template "_internal/pagination.html" . }}
-{{ end }} \ No newline at end of file
+{{ warnf "Value 'doc_list' of layout param in %q is deprecated and will be removed in Eureka v1.0.0. Use 'doc-list' instead." .File.Path }}
+{{ partial "components/doc-list" . }}
+{{ end }}
+{{/* Deprecation warning(v1.0.0) ends */}} \ No newline at end of file
diff --git a/layouts/docs/list.html b/layouts/docs/list.html
index fcee3bb..4abc302 100644
--- a/layouts/docs/list.html
+++ b/layouts/docs/list.html
@@ -1,3 +1,3 @@
{{ define "main" }}
-{{ partial "doc_layout.html" . }}
+{{ partial "components/doc-layout" . }}
{{ end }} \ No newline at end of file
diff --git a/layouts/docs/single.html b/layouts/docs/single.html
index 6244028..09026bf 100644
--- a/layouts/docs/single.html
+++ b/layouts/docs/single.html
@@ -1,3 +1,3 @@
{{ define "main" }}
-{{ partial "doc_layout.html" . }}
+{{ partial "components/doc-layout" . }}
{{ end }}
diff --git a/layouts/index.html b/layouts/index.html
index 9935dc8..84ab544 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,34 +1,176 @@
{{- define "main" }}
-<div class="bg-secondary-bg pl-scrollbar">
- <div class="max-w-screen-xl mx-auto">
- <div class="grid grid-cols-9 grid-rows-5 h-screen -mt-16">
- {{- $imgLeft := partial "get_image.html" (dict "context" . "url" .Site.Params.hero.imgLeft)}}
- {{- with $imgLeft }}
- <div class="col-start-2 col-span-4 row-start-3 row-span-2 bg-local bg-cover z-10 shadow-2xl"
- style="background-image: url({{ . }});"></div>
- {{- end }}
-
- <div class="col-start-3 col-span-5 row-start-2 row-span-3 z-20">
- <div class="flex flex-col items-center justify-center min-h-full">
- <div class="bg-white bg-opacity-75 shadow-2xl -m-12 p-12">
- <span
- class="font-bold text-black text-opacity-75 text-2xl md:text-3xl">{{ .Site.Params.hero.slogan }}</span>
- </div>
- </div>
- </div>
- {{- $imgRight := partial "get_image.html" (dict "context" . "url" .Site.Params.hero.imgRight)}}
- {{- with $imgRight }}
- <div class="col-start-5 col-span-4 row-start-2 row-span-2 bg-local bg-cover shadow-2xl"
- style="background-image: url({{ . }});">
+ {{ $homepage := .Site.GetPage "homepage" }}
+ {{ $widgets := $homepage.Resources }}
+ {{ range $widgets }}
+ {{ if .Params.widget.handler }}
+ {{ partial "widgets/load" . }}
+ {{ else }}
+ {{ errorf "Failed to find widget param in %q" .Path }}
+ {{ end }}
+
+ {{/* Deprecation warning(v1.0.0) starts */}}
+ {{ else }}
+ {{ warnf "Param 'hero' in params.toml is deprecated and will be removed in Eureka v1.0.0. See https://www.wangchucheng.com/en/docs/eureka/homepage-configuration/" }}
+ <div class="bg-secondary-bg pl-scrollbar">
+ <div class="max-w-screen-xl mx-auto">
+ <div class="grid grid-cols-9 grid-rows-5 h-(screen-16)">
+ {{- $imgLeft := partial "utils/get-image" (dict "context" . "url" .Site.Params.hero.imgLeft)}}
+ {{- with $imgLeft }}
+ <div class="col-start-2 col-span-4 row-start-3 row-span-2 bg-local bg-cover z-10 shadow-2xl"
+ style="background-image: url({{ . }});"></div>
+ {{- end }}
+
+ <div class="col-start-3 col-span-5 row-start-2 row-span-3 z-20">
+ <div class="flex flex-col items-center justify-center min-h-full">
+ <div class="bg-white bg-opacity-75 shadow-2xl -m-12 p-12">
+ <span class="font-bold text-black text-opacity-75 text-2xl md:text-3xl">{{ .Site.Params.hero.slogan }}</span>
+ </div>
</div>
- {{- end }}
+ </div>
+ {{- $imgRight := partial "utils/get-image" (dict "context" . "url" .Site.Params.hero.imgRight)}}
+ {{- with $imgRight }}
+ <div class="col-start-5 col-span-4 row-start-2 row-span-2 bg-local bg-cover shadow-2xl"
+ style="background-image: url({{ . }});">
+ </div>
+ {{- end }}
+ </div>
+ </div>
+ </div>
+ <div class="pl-scrollbar">
+ <div class="max-w-screen-xl mx-auto">
+ <div class="pt-12 md:px-4 xl:px-8">
+ {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
+ {{- partial "components/masonry" $pages }}
</div>
+ </div>
+ </div>
+ {{/* Deprecation warning(v1.0.0) ends */}}
+
+ {{ end }}
+{{- end }}
+
+{{ define "partials/widgets/load" }}
+ {{ $widget := .Params.widget }}
+
+ {{ $fullScreenWidgets := slice "vintage" }}
+
+ {{/* background config */}}
+ {{ $backgroundClass := "" }}
+ {{ $backgroundStyle := "" }}
+
+ {{ if $widget.background.image }}
+ {{ $image := partial "utils/get-image.html" (dict "context" . "url" $widget.background.image) }}
+ {{ $backgroundStyle = print $backgroundStyle "background-image: url(" $image ");" }}
+ {{/* background size */}}
+ {{ $size := $widget.background.size }}
+ {{ $sizeOptions := dict "auto" "bg-auto" "cover" "bg-cover" "contain" "bg-contain" }}
+ {{ if $size }}
+ {{ $size = index $sizeOptions $size }}
+ {{ if $size }}
+ {{ $backgroundClass = print $backgroundClass " " $size }}
+ {{ else }}
+ {{/* TODO error */}}
+ {{ end }}
+ {{ end }}
+
+ {{/* background position */}}
+ {{ $position := $widget.background.position }}
+ {{ $positionOptions := dict "center" "bg-center" "top" "bg-top" "right" "bg-right" "bottom" "bg-bottom" "left" "bg-left" }}
+ {{ if $position }}
+ {{ $position = index $positionOptions $position }}
+ {{ if $position }}
+ {{ $backgroundClass = print $backgroundClass " " $position }}
+ {{ else }}
+ {{/* TODO error */}}
+ {{ end }}
+ {{ end }}
+
+ {{/* background position */}}
+ {{ $attachment := $widget.background.attachment }}
+ {{ $attachmentOptions := dict "fixed" "bg-fixed" "local" "bg-local" "scroll" "bg-scroll" }}
+ {{ if $attachment }}
+ {{ $attachment = index $attachmentOptions $attachment }}
+ {{ if $attachment }}
+ {{ $backgroundClass = print $backgroundClass " " $attachment }}
+ {{ else }}
+ {{/* TODO error */}}
+ {{ end }}
+ {{ end }}
+
+ {{ else }}
+ {{/* background color */}}
+ {{ $color := $widget.background.color }}
+ {{ $colorOptions := dict "primary" "bg-primary-bg" "secondary" "bg-secondary-bg" "tertiary" "bg-tertiary-bg" }}
+ {{ if $color }}
+ {{ $colorClass := index $colorOptions $color }}
+ {{ if $colorClass }}
+ {{ $backgroundClass = print $backgroundClass " " $colorClass }}
+ {{ else }}
+ {{ $backgroundStyle = print $backgroundStyle "background-color: " $color ";"}}
+ {{ end }}
+ {{ else }}
+ {{ $colorClass := index $colorOptions "primary" }}
+ {{ $backgroundClass = print $backgroundClass " " $colorClass }}
+ {{ end }}
+ {{ end }}
+
+ {{/* widget config */}}
+ {{ $widgetClass := "" }}
+
+ {{ if not (in $fullScreenWidgets $widget.handler) }}
+ {{/* widget width */}}
+ {{ $width := $widget.width }}
+ {{ $widthOptions := dict "sm" "lg:w-2/3" "md" "lg:w-3/4" "lg" "lg:w-4/5" "xl" "w-full" }}
+ {{ if $width }}
+ {{ $widthClass := index $widthOptions $width }}
+ {{ if $widthClass }}
+ {{ $widgetClass = print $widgetClass " " $widthClass }}
+ {{ end }}
+ {{ else }}
+ {{ $widthClass := index $widthOptions "md" }}
+ {{ $widgetClass = print $widgetClass " " $widthClass }}
+ {{ end }}
+
+ {{/* widget height */}}
+ {{ $height := $widget.height }}
+ {{ $heightOptions := dict "sm" "h-64" "md" "h-96" "lg" "h-128" "xl" "h-160" "screen" "h-(screen-16)" }}
+ {{ if $height }}
+ {{ $heightClass := index $heightOptions $height }}
+ {{ if $heightClass }}
+ {{ $widgetClass = print $widgetClass " " $heightClass }}
+ {{ end }}
+ {{ end }}
+ {{ $widgetClass = print $widgetClass " mx-auto px-6 md:px-8 xl:px-12 py-12" }}
+ {{ end }}
+
+ <div class="pl-scrollbar {{ with $backgroundClass -}}{{ partial "utils/standardize-classes" . }}{{- end }}"
+ {{ with $backgroundStyle }} style="{{ . | safeCSS }}" {{ end }}>
+ <div class="max-w-screen-xl mx-auto">
+ <div id="{{ .File.BaseFileName }}" class="{{ with $widgetClass -}}{{ partial "utils/standardize-classes" . }}{{- end }}">
+ {{ partial "widgets/load-sidebar" . }}
+ </div>
</div>
-</div>
-<div class="max-w-screen-xl mx-auto">
- <div class="pt-12 md:px-4 xl:px-8">
- {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
- {{- partial "masonry" $pages }}
+ </div>
+{{ end }}
+
+{{ define "partials/widgets/load-sidebar" }}
+ {{ $sidebar := .Params.widget.sidebar }}
+
+ {{ if $sidebar.position }}
+
+ {{ $scaleOptions := dict "sm" "lg:w-1/5" "md" "lg:w-1/4" "lg" "lg:w-1/3" "xl" "lg:w-1/2" }}
+ {{ $scaleClass := index $scaleOptions $sidebar.scale | default (index $scaleOptions "md") }}
+ <div class="flex flex-col {{ if eq $sidebar.position "right" -}} lg:flex-row-reverse {{- else -}} lg:flex-row {{- end }}">
+ {{ if $sidebar.position }}
+ <div class="flex-none {{ with $scaleClass -}}{{ partial "utils/standardize-classes" . }}{{- end }} {{ if eq $sidebar.position "left" -}} lg:mr-4 {{- else -}} lg:ml-4 {{- end }}">
+ <h2 class="font-bold text-3xl my-4">{{ .Params.Title }}</h2>
+ </div>
+ {{ end }}
+ <div class="flex-grow {{ if eq $sidebar.position "right" -}} lg:mr-4 {{- else -}} lg:ml-4 {{- end }}">
+ {{ partial (printf "widgets/%s" .Params.widget.handler) . }}
+ </div>
</div>
-</div>
-{{- end }} \ No newline at end of file
+ {{ else }}
+ {{ partial (printf "widgets/%s" .Params.widget.handler) . }}
+ {{ end }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html
index eca996b..96e8a9d 100644
--- a/layouts/partials/comment.html
+++ b/layouts/partials/comment.html
@@ -1,5 +1,5 @@
{{ if eq .Site.Params.comment.platform "disqus" }}
-{{ partial "comment/disqus.html" . }}
+{{ partial "comment/disqus" . }}
{{ else if eq .Site.Params.comment.platform "commento" }}
-{{ partial "comment/commento.html" . }}
+{{ partial "comment/commento" . }}
{{ end }} \ No newline at end of file
diff --git a/layouts/partials/doc_layout.html b/layouts/partials/components/doc-layout.html
index 4cf57bc..7217030 100644
--- a/layouts/partials/doc_layout.html
+++ b/layouts/partials/components/doc-layout.html
@@ -4,18 +4,18 @@
<div class="flex flex-col md:flex-row bg-secondary-bg rounded">
<div class="md:w-1/4 lg:w-1/5 border-r">
<div class="sticky top-16 pt-6">
- {{ template "doc_sidebar" (dict "context" . "permalink" .Permalink) }}
+ {{ 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="w-full lg:w-3/4 pl-6 ml-0 mr-auto">
<h1 class="font-bold text-3xl text-primary-text">{{ .Title }}</h1>
- {{ partial "post_metadata.html" . }}
+ {{ partial "components/post-metadata" . }}
</div>
<div class="flex">
<div class="w-full lg:w-3/4 px-6">
- {{ $featured := partial "get_featured" . }}
+ {{ $featured := partial "utils/get-featured" . }}
{{ with $featured }}
<div class="my-4">
{{ . }}
@@ -25,23 +25,23 @@
{{ .Content}}
</div>
{{ with .GetTerms "tags" }}
- {{ partial "post_tags.html" . }}
+ {{ partial "components/post-tags" . }}
{{ end }}
{{ with .GetTerms "authors" }}
- {{ partial "post_author.html" . }}
+ {{ partial "components/post-author" . }}
{{ end }}
{{ if or .Site.Params.repoURL .Site.Params.repoEditURL }}
- {{ partial "post_edit.html" . }}
+ {{ partial "components/post-edit" . }}
{{ end }}
- {{ partial "post_footer.html" . }}
- {{ partial "comment.html" . }}
+ {{ partial "components/post-footer" . }}
+ {{ partial "comment" . }}
</div>
{{ if $hasSidebar}}
<div class="hidden lg:block lg:w-1/4">
{{ if ne $hasToc false }}
- {{ partial "post_toc.html" . }}
+ {{ partial "components/post-toc" . }}
{{ end }}
</div>
{{ end }}
@@ -61,17 +61,20 @@
})
</script>
-{{ define "doc_sidebar" }}
-{{ if eq .context.Parent.Params.layout "doc_list" }}
-{{ template "list_pages" (dict "context" .context "permalink" .permalink) }}
+{{ 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) }}
+{{ template "list-pages" (dict "context" .context "permalink" .permalink) }}
{{ else }}
-{{ template "doc_sidebar" (dict "context" .context.Parent "permalink" .permalink) }}
+{{ template "doc-sidebar" (dict "context" .context.Parent "permalink" .permalink) }}
{{ end }}
{{ end }}
-{{ define "list_pages" }}
+{{ 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 fa-caret-right ml-1"></i>
@@ -83,7 +86,7 @@
<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) }}
+ {{ $versions := partial "get-versions" (dict "context" .context) }}
{{ if $versions }}
<div class="relative ml-2 cursor-pointer">
<div id="doc-version" class="flex items-center bg-primary-bg md:bg-secondary-bg">
@@ -116,11 +119,11 @@
</div>
- {{ template "list_items" (dict "context" .context "permalink" .permalink) }}
+ {{ template "list-items" (dict "context" .context "permalink" .permalink) }}
</div>
{{ end }}
-{{ define "list_items"}}
+{{ define "list-items"}}
<ul class="pl-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 }}
@@ -131,7 +134,7 @@
href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</div>
{{ if .IsSection }}
- {{ template "list_items" (dict "context" . "permalink" $.permalink) }}
+ {{ template "list-items" (dict "context" . "permalink" $.permalink) }}
{{ end }}
</li>
{{ end }}
@@ -139,10 +142,11 @@
</ul>
{{ end }}
-{{ define "partials/get_versions" }}
-{{ if eq .context.Parent.Params.layout "doc_list" }}
-{{/* {{ $latest := slice .context.Permalink }}
-{{ $.context.Scratch.Add "versions" $latest }} */}}
+{{ 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}}
@@ -151,8 +155,6 @@
{{ end }}
{{ end }}
{{ else }}
-{{/* {{ $latest := slice .context.Parent.Permalink }}
-{{ $.context.Scratch.Add "versions" $latest }} */}}
{{ 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 }}
diff --git a/layouts/partials/components/doc-list.html b/layouts/partials/components/doc-list.html
new file mode 100644
index 0000000..51e71b3
--- /dev/null
+++ b/layouts/partials/components/doc-list.html
@@ -0,0 +1,12 @@
+<article class="mx-6 my-8">
+ <h1 class="font-bold text-3xl text-primary-text">{{ .Title }}</h1>
+ {{ with .Content }}
+ <div class="content">
+ {{ . }}
+ </div>
+ {{ end }}
+</article>
+<div class="bg-secondary-bg rounded px-6">
+ {{ partial "components/summary-list-plain" .Paginator.Pages }}
+</div>
+{{ template "_internal/pagination.html" . }} \ No newline at end of file
diff --git a/layouts/partials/masonry.html b/layouts/partials/components/masonry.html
index fc2f1ac..8bfb4a2 100644
--- a/layouts/partials/masonry.html
+++ b/layouts/partials/components/masonry.html
@@ -7,7 +7,7 @@
{{ range first 10 . }}
<div class="item">
<div class="grid-content">
- {{ partial "stacked_summary.html" . }}
+ {{ partial "components/summary-masonry" . }}
</div>
</div>
{{ end }}
diff --git a/layouts/partials/opengraph.html b/layouts/partials/components/opengraph.html
index 6065b98..a0b9bba 100644
--- a/layouts/partials/opengraph.html
+++ b/layouts/partials/components/opengraph.html
@@ -1,6 +1,6 @@
-<meta property="og:title" content="{{ partial "get_title" . }}" />
+<meta property="og:title" content="{{ partial "get-title" . }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
-{{ $icon := partial "get_image.html" (dict "context" . "url" .Site.Params.icon) }}
+{{ $icon := partial "utils/get-image" (dict "context" . "url" .Site.Params.icon) }}
{{ with $icon }}
<meta property="og:image" content="{{ . }}">
{{ end }}
@@ -64,11 +64,11 @@
{{ end }}
{{ if .GetTerms "series" }}
-{{ $page_link := .Permalink }}
+{{ $pageLink := .Permalink }}
{{ $series := .Site.Taxonomies.series}}
{{ range (.GetTerms "series") }}
{{ range .Pages }}
-{{ if ne .Page.Permalink $page_link }}
+{{ if ne .Page.Permalink $pageLink }}
<meta property="og:see_also" content="{{ .Page.Permalink }}" />
{{ end }}
{{ end }}
diff --git a/layouts/partials/post_author.html b/layouts/partials/components/post-author.html
index 72f3c5f..2695d97 100644
--- a/layouts/partials/post_author.html
+++ b/layouts/partials/components/post-author.html
@@ -2,7 +2,7 @@
{{ range . }}
<div class="flex flex-col md:flex-row items-center my-8">
<a href="{{ .Permalink }}" class="w-24 h-24 md:mr-4">
- {{ $img := partial "get_image.html" (dict "context" . "url" .Params.avatar "keyword" "*avatar*")}}
+ {{ $img := partial "utils/get-image" (dict "context" . "url" .Params.avatar "keyword" "*avatar*")}}
{{ with $img }}
<img src="{{ . }}" class="w-full bg-primary-bg rounded-full" alt="Avatar">
{{ else }}
@@ -13,6 +13,9 @@
<a href="{{ .Permalink }}" class="block font-bold text-lg pb-1 mb-2 border-b">{{ .LinkTitle }}</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 .icon_pack " fa-" .icon }}
<a href="{{ .url }}" class="mr-1">
<i class="{{ print $src }}"></i>
diff --git a/layouts/partials/post_edit.html b/layouts/partials/components/post-edit.html
index 254b9e7..14c07af 100644
--- a/layouts/partials/post_edit.html
+++ b/layouts/partials/components/post-edit.html
@@ -1,5 +1,5 @@
<div class="flex md:justify-end my-4">
- {{ $repoEditURL := partial "get_edit_url" . }}
+ {{ $repoEditURL := partial "get-edit-url" . }}
{{ $contentDir := cond .Site.IsMultiLingual .Site.Params.contentDir "/content/" }}
{{ $path := path.Join $repoEditURL $contentDir .File.Path }}
{{ $path := replace $path "http:/" "http://" 1 }}
@@ -11,7 +11,7 @@
</a>
</div>
-{{ define "partials/get_edit_url" }}
+{{ define "partials/get-edit-url" }}
{{ with .Site.Params.repoEditURL }}
{{ $.Scratch.Set "repoEditURL" . }}
{{ else }}
diff --git a/layouts/partials/post_footer.html b/layouts/partials/components/post-footer.html
index 90db30f..90db30f 100644
--- a/layouts/partials/post_footer.html
+++ b/layouts/partials/components/post-footer.html
diff --git a/layouts/partials/post_metadata.html b/layouts/partials/components/post-metadata.html
index eacaadd..9fa9a40 100644
--- a/layouts/partials/post_metadata.html
+++ b/layouts/partials/components/post-metadata.html
@@ -1,4 +1,4 @@
-<div class="flex flex-wrap flex-row items-center my-2 text-tertiary-text">
+<div class="flex flex-wrap flex-row items-center mt-2 text-tertiary-text">
<div class="mr-6 my-2">
<i class="fas fa-calendar mr-1"></i>
<span>{{ .Date.Format (.Site.Params.dateFormat | default "2006-01-02") }}</span>
diff --git a/layouts/partials/post_series.html b/layouts/partials/components/post-series.html
index ebc3810..ebc3810 100644
--- a/layouts/partials/post_series.html
+++ b/layouts/partials/components/post-series.html
diff --git a/layouts/partials/post_tags.html b/layouts/partials/components/post-tags.html
index cac5fba..cac5fba 100644
--- a/layouts/partials/post_tags.html
+++ b/layouts/partials/components/post-tags.html
diff --git a/layouts/partials/post_toc.html b/layouts/partials/components/post-toc.html
index 66fd401..66fd401 100644
--- a/layouts/partials/post_toc.html
+++ b/layouts/partials/components/post-toc.html
diff --git a/layouts/partials/schema_node.html b/layouts/partials/components/schema-node.html
index ec4fda0..0c4cba5 100644
--- a/layouts/partials/schema_node.html
+++ b/layouts/partials/components/schema-node.html
@@ -6,7 +6,7 @@
{{- with $pages }}
<script type="application/ld+json">
{
- "@context":"https://schema.org",
+ "@context":"https://components/schema.org",
"@type":"ItemList",
"itemListElement":[
{{- range $index, $value := . -}}
@@ -16,7 +16,7 @@
"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 "get_image.html" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
+ {{- $img := partial "utils/get-image" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
{{- with $img }}
"image": {{ . }},
{{- end }}
diff --git a/layouts/partials/schema_page.html b/layouts/partials/components/schema-page.html
index b231b0a..4829647 100644
--- a/layouts/partials/schema_page.html
+++ b/layouts/partials/components/schema-page.html
@@ -1,13 +1,13 @@
<script type="application/ld+json">
{
- "@context": "https://schema.org",
+ "@context": "https://components/schema.org",
"@type": "Article",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": {{ .Permalink }}
},
- "headline": "{{ partial "get_title" . }}",
- {{- $img := partial "get_image.html" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
+ "headline": "{{ partial "get-title" . }}",
+ {{- $img := partial "utils/get-image" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
{{- with $img }}
"image": {{ . }},
{{ end -}}
@@ -43,8 +43,8 @@
{{ else -}}
"name": {{ .Site.Title }},
{{ end -}}
- {{ $publisherLogo := partial "get_image.html" (dict "context" . "url" .Site.Params.publisherLogo) -}}
- {{ $icon := partial "get_image.html" (dict "context" . "url" .Site.Params.icon) -}}
+ {{ $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",
diff --git a/layouts/partials/schema.html b/layouts/partials/components/schema.html
index 6be8946..03b840c 100644
--- a/layouts/partials/schema.html
+++ b/layouts/partials/components/schema.html
@@ -1,11 +1,11 @@
<meta name="description"
content="{{ if .Description }}{{ .Description }}{{ else if .Summary }}{{ .Summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ end }}">
-{{- $bundles := partial "get_bundles" . }}
+{{- $bundles := partial "get-bundles" . }}
{{- if gt (len $bundles) 1 }}
<script type="application/ld+json">
{
- "@context": "https://schema.org",
+ "@context": "https://components/schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{{- range $index, $value := $bundles.Reverse -}}
@@ -22,10 +22,13 @@
</script>
{{- end }}
-{{- if and (eq .Type "docs") (ne .Params.layout "doc_list") }}
-{{- partial "schema_page.html" . }}
+{{/* 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 "schema_node.html" . }}
+{{- partial "components/schema-node" . }}
{{- else if .IsPage }}
-{{- partial "schema_page.html" . }}
+{{- partial "components/schema-page" . }}
{{- end }} \ No newline at end of file
diff --git a/layouts/partials/components/summary-card.html b/layouts/partials/components/summary-card.html
new file mode 100644
index 0000000..f38d6b7
--- /dev/null
+++ b/layouts/partials/components/summary-card.html
@@ -0,0 +1,3 @@
+<div class="bg-secondary-bg rounded border shadow hover:shadow-lg transition ease-in-out duration-200 px-6 pt-6 pb-4">
+ {{ partial "components/summary-plain" . }}
+</div> \ No newline at end of file
diff --git a/layouts/partials/components/summary-list-card.html b/layouts/partials/components/summary-list-card.html
new file mode 100644
index 0000000..3829230
--- /dev/null
+++ b/layouts/partials/components/summary-list-card.html
@@ -0,0 +1,5 @@
+{{ range . }}
+<div class="mb-6">
+ {{ partial "components/summary-card" . }}
+</div>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/components/summary-list-masonry.html b/layouts/partials/components/summary-list-masonry.html
new file mode 100644
index 0000000..8e82a6e
--- /dev/null
+++ b/layouts/partials/components/summary-list-masonry.html
@@ -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> \ No newline at end of file
diff --git a/layouts/partials/components/summary-list-plain.html b/layouts/partials/components/summary-list-plain.html
new file mode 100644
index 0000000..78d324c
--- /dev/null
+++ b/layouts/partials/components/summary-list-plain.html
@@ -0,0 +1,8 @@
+<div class="overflow-hidden divide-y">
+ {{ range . }}
+ <div class="py-6">
+ {{ partial "components/summary-plain" . }}
+ </div>
+ {{ end }}
+</div>
+
diff --git a/layouts/partials/components/summary-masonry.html b/layouts/partials/components/summary-masonry.html
new file mode 100644
index 0000000..1ee347a
--- /dev/null
+++ b/layouts/partials/components/summary-masonry.html
@@ -0,0 +1,17 @@
+<div class="bg-secondary-bg rounded overflow-hidden border shadow hover:shadow-lg transition ease-in-out duration-200">
+ {{ $featured := partial "utils/get-featured" . }}
+ {{ with $featured }}
+ {{ . }}
+ {{ end }}
+ <div class="px-6 pt-6">
+ <div class="font-bold text-xl text-primary-text mb-2">
+ <a href="{{ .Permalink }}" class="hover:text-eureka">{{ .LinkTitle }}</a>
+ </div>
+ <div class="">
+ {{- .Summary | plainify -}}
+ </div>
+ </div>
+ <div class="px-6 pb-2">
+ {{ partial "components/post-metadata" . }}
+ </div>
+</div> \ No newline at end of file
diff --git a/layouts/partials/components/summary-plain.html b/layouts/partials/components/summary-plain.html
new file mode 100644
index 0000000..981ab36
--- /dev/null
+++ b/layouts/partials/components/summary-plain.html
@@ -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:ml-8">
+ {{ . }}
+ </div>
+ {{ end }}
+</div> \ No newline at end of file
diff --git a/layouts/partials/custom_head.html b/layouts/partials/custom-head.html
index f9424d4..f9424d4 100644
--- a/layouts/partials/custom_head.html
+++ b/layouts/partials/custom-head.html
diff --git a/layouts/partials/get_featured.html b/layouts/partials/get_featured.html
deleted file mode 100644
index aa99e78..0000000
--- a/layouts/partials/get_featured.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{{ $video := partial "get_video" (dict "context" . "url" .Params.featuredVideo "keyword" "*featured*") }}
-{{ $image := partial "get_image.html" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
-{{ $featured := ""}}
-{{ if $video }}
-{{ $featured = $video }}
-{{ else if $image }}
-{{ $featured = print "<img src=\"" $image "\" class=\"w-full\" alt=\"Featured Image\">" | safeHTML }}
-{{ end }}
-{{ return $featured }} \ No newline at end of file
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 8a831a5..258e5b1 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,7 +1,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
-{{ define "partials/get_title" }}
+{{ define "partials/get-title" }}
{{ $separator := .Site.Params.titleSeparator | default "|" }}
{{ $primarySep := $separator }}
{{ $secondarySep := $separator }}
@@ -14,12 +14,19 @@
{{ $prefix := "" }}
{{ if .Params.Title }}
{{ $prefix = .Params.Title }}
-{{ if and (eq .Type "docs") (ne .Layout "doc_list") }}
+{{/* 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") }}
{{ $docTitle := "" }}
-{{ $bundles := partial "get_bundles" . }}
+{{ $bundles := partial "get-bundles" . }}
{{ range $bundles.Reverse }}
{{ $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-]+)*))?" (path.Base .Permalink) }}
-{{ if and (eq .Parent.Layout "doc_list") (ne .Layout "doc_list") }}
+{{/* Deprecation warning(v1.0.0) starts */}}
+{{ $parentLayout := partial "utils/hyphenate" (.Parent.Layout | default .Parent.Type) }}
+{{ $layout := partial "utils/hyphenate" (.Layout | default .Type) }}
+{{/* Deprecation warning(v1.0.0) ends */}}
+{{ if and (eq $parentLayout "doc-list") (ne $layout "doc-list") }}
{{ $docTitle = .Title }}
{{ else if $version }}
{{ $docTitle = .Title }}
@@ -27,7 +34,10 @@
{{ end }}
{{/* Doc title */}}
{{ $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-]+)*))?" (path.Base .Permalink) }}
-{{ if or (eq .Parent.Layout "doc_list") $version }}
+{{/* Deprecation warning(v1.0.0) starts */}}
+{{ $parentLayout := partial "utils/hyphenate" (.Parent.Layout | default .Parent.Type) }}
+{{/* Deprecation warning(v1.0.0) ends */}}
+{{ if or (eq $parentLayout "doc-list") $version }}
{{ $prefix = $docTitle }}
{{ else }}
{{ $prefix = print $prefix " " $secondarySep " " $docTitle }}
@@ -40,7 +50,7 @@
{{ end }}
{{ return $title }}
{{ end }}
-<title>{{ partial "get_title" . }}</title>
+<title>{{ partial "get-title" . }}</title>
{{- $eurekaCSS := resources.Get "css/eureka.css" | postCSS (dict "config" "./assets/css/postcss.config.js") }}
{{- $eurekaCSS := $eurekaCSS | minify }}
@@ -63,11 +73,11 @@
<script defer src="{{ printf $assets.fontawesome.js.url $assets.fontawesome.version }}"
{{ with $assets.fontawesome.js.sri }} integrity="{{ . }}" {{ end }} crossorigin></script>
-{{ define "partials/get_bundles" }}
+{{ define "partials/get-bundles" }}
{{ $currentPage := . }}
{{ $bundles := slice $currentPage }}
{{ if and (ne $currentPage.Kind "taxonomy") (or (ne $currentPage $currentPage.FirstSection) (eq $currentPage.Kind "term")) }}
-{{ $currentBundles := partial "get_bundles" $currentPage.Parent }}
+{{ $currentBundles := partial "get-bundles" $currentPage.Parent }}
{{ $bundles = $bundles | append $currentBundles }}
{{ end }}
{{ return $bundles }}
@@ -75,7 +85,7 @@
{{- $enableMath := false }}
{{- if .Site.Params.math.handler }}
-{{- $bundles := partial "get_bundles" . }}
+{{- $bundles := partial "get-bundles" . }}
{{- $enableMath = true }}
{{- range $bundles.Reverse }}
{{- if and (ne .Params.math nil) (ne .Params.math "") }}
@@ -122,21 +132,21 @@
</script>
{{- end }}
-{{ partial "custom_head.html" . }}
+{{ partial "custom-head" . }}
{{- with .Site.Params.icon }}
-<link rel="icon" type="image/png" sizes="32x32" href="{{ (partial "get_icon" (dict "icon" . "size" 32)).Permalink }}">
-<link rel="apple-touch-icon" sizes="180x180" href="{{ (partial "get_icon" (dict "icon" . "size" 180)).Permalink }}">
+<link rel="icon" type="image/png" sizes="32x32" href="{{ (partial "get-icon" (dict "icon" . "size" 32)).Permalink }}">
+<link rel="apple-touch-icon" sizes="180x180" href="{{ (partial "get-icon" (dict "icon" . "size" 180)).Permalink }}">
{{- end }}
-{{ define "partials/get_icon" }}
+{{ define "partials/get-icon" }}
{{ $icon := resources.GetMatch .icon }}
-{{ $icon_resized := $icon.Fill (printf "%sx%s Center" (string .size) (string .size)) }}
-{{ return $icon_resized }}
+{{ $iconResized := $icon.Fill (printf "%sx%s Center" (string .size) (string .size)) }}
+{{ return $iconResized }}
{{ end }}
-{{- partial "schema.html" . }}
-{{- partial "opengraph.html" . }}
+{{- partial "components/schema" . }}
+{{- partial "components/opengraph" . }}
{{- range .AlternativeOutputFormats }}
{{- printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{- end }} \ No newline at end of file
diff --git a/layouts/partials/horizontal_summary.html b/layouts/partials/horizontal_summary.html
deleted file mode 100644
index d95cb52..0000000
--- a/layouts/partials/horizontal_summary.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<div class="flex flex-col-reverse lg:flex-row justify-between">
- {{ $featured := partial "get_featured" . }}
- <div class="w-full {{ with $featured }}lg:w-2/3{{ end }}">
- <div class="my-2">
- <div class="mb-4">
- <a href="{{ .Permalink }}" class="font-bold text-xl hover:text-eureka">{{ .LinkTitle }}</a>
- </div>
- <div class="content">
- {{ .Summary | plainify }}
- </div>
- </div>
- {{ if eq .Type "docs" }}
- <div class="px-6 pt-4">
- {{ range $index, $value := first 3 .Pages }}
- {{ if gt $index 0 }}
- <div class="-mx-4 my-4 border-t"></div>
- {{ end -}}
- <div class="">
- <div class="mb-2">
- <a href="{{ .Permalink }}" class="font-semibold hover:text-eureka">{{ .LinkTitle }}</a>
- </div>
- <div class="">
- {{- .Summary | plainify -}}
- </div>
- </div>
- {{ end }}
- <div class="pt-6 hover:text-eureka">
- <a href="{{ .Permalink }}" class="font-semibold">{{ i18n "readMore" }}</a>
- <i class="fas fa-caret-right ml-1"></i>
- </div>
-
- </div>
- {{ else }}
- {{ partial "post_metadata.html" . }}
- {{ end }}
- </div>
-
- {{ with $featured }}
- <div class="w-full lg:w-1/3 mb-4 lg:mb-0 lg:ml-8">
- {{ . }}
- </div>
- {{ end }}
-</div> \ No newline at end of file
diff --git a/layouts/partials/stacked_summary.html b/layouts/partials/stacked_summary.html
deleted file mode 100644
index b354d40..0000000
--- a/layouts/partials/stacked_summary.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<div class="bg-secondary-bg rounded overflow-hidden hover:shadow-lg transition ease-in-out duration-200">
- {{ $featured := partial "get_featured" . }}
- {{ with $featured }}
- {{ . }}
- {{ end }}
- <div class="px-6 pt-6">
- <div class="font-bold text-xl text-primary-text mb-2">
- <a href="{{ .Permalink }}" class="hover:text-eureka">{{ .LinkTitle }}</a>
- </div>
- <div class="">
- {{- .Summary | plainify -}}
- </div>
- </div>
- <div class="px-6 pb-2">
- {{ partial "post_metadata.html" . }}
- </div>
-</div> \ No newline at end of file
diff --git a/layouts/partials/utils/get-featured.html b/layouts/partials/utils/get-featured.html
new file mode 100644
index 0000000..89483ae
--- /dev/null
+++ b/layouts/partials/utils/get-featured.html
@@ -0,0 +1,9 @@
+{{ $video := partial "utils/get-video" (dict "context" . "url" .Params.featuredVideo "keyword" "*featured*") }}
+{{ $image := partial "utils/get-image" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
+{{ $featured := ""}}
+{{ if $video }}
+{{ $featured = $video }}
+{{ else if $image }}
+{{ $featured = print "<img src=\"" $image "\" class=\"w-full\" alt=\"Featured Image\">" | safeHTML }}
+{{ end }}
+{{ return $featured }} \ No newline at end of file
diff --git a/layouts/partials/get_image.html b/layouts/partials/utils/get-image.html
index 59785f2..59785f2 100644
--- a/layouts/partials/get_image.html
+++ b/layouts/partials/utils/get-image.html
diff --git a/layouts/partials/utils/get-summary.html b/layouts/partials/utils/get-summary.html
new file mode 100644
index 0000000..311acdf
--- /dev/null
+++ b/layouts/partials/utils/get-summary.html
@@ -0,0 +1,29 @@
+<div class="mb-4">
+ <a href="{{ .Permalink }}" class="font-bold text-xl hover:text-eureka">{{ .LinkTitle }}</a>
+</div>
+<div class="content">
+ {{ .Summary | plainify }}
+</div>
+{{ if eq .Type "docs" }}
+<div class="px-6 pt-4">
+ {{ range $index, $value := first 3 .Pages }}
+ {{ if gt $index 0 }}
+ <div class="-mx-4 my-4 border-t"></div>
+ {{ end -}}
+ <div class="">
+ <div class="mb-2">
+ <a href="{{ .Permalink }}" class="font-semibold hover:text-eureka">{{ .LinkTitle }}</a>
+ </div>
+ <div class="">
+ {{- .Summary | plainify -}}
+ </div>
+ </div>
+ {{ end }}
+ <div class="pt-6 hover:text-eureka">
+ <a href="{{ .Permalink }}" class="font-semibold">{{ i18n "readMore" }}</a>
+ <i class="fas fa-caret-right ml-1"></i>
+ </div>
+</div>
+{{ else }}
+{{ partial "components/post-metadata" . }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/get_video.html b/layouts/partials/utils/get-video.html
index a0a1cd9..a0a1cd9 100644
--- a/layouts/partials/get_video.html
+++ b/layouts/partials/utils/get-video.html
diff --git a/layouts/partials/utils/hyphenate.html b/layouts/partials/utils/hyphenate.html
new file mode 100644
index 0000000..9533068
--- /dev/null
+++ b/layouts/partials/utils/hyphenate.html
@@ -0,0 +1 @@
+{{ return replace . "_" "-" }} \ No newline at end of file
diff --git a/layouts/partials/utils/standardize-classes.html b/layouts/partials/utils/standardize-classes.html
new file mode 100644
index 0000000..035943c
--- /dev/null
+++ b/layouts/partials/utils/standardize-classes.html
@@ -0,0 +1,4 @@
+{{ $classes := replaceRE " +" " " . }}
+{{ $classes = strings.TrimLeft " " $classes }}
+{{ $classes = strings.TrimRight " " $classes }}
+{{ return $classes }} \ No newline at end of file
diff --git a/layouts/partials/widgets/about.html b/layouts/partials/widgets/about.html
index 744527f..e761c53 100644
--- a/layouts/partials/widgets/about.html
+++ b/layouts/partials/widgets/about.html
@@ -1,5 +1,5 @@
<div class="flex flex-col lg:flex-row items-center justify-center py-12">
- {{ $img := partial "get_image.html" (dict "context" . "url" .Params.avatar "keyword" "*avatar*")}}
+ {{ $img := partial "utils/get-image" (dict "context" . "url" .Params.avatar "keyword" "*avatar*")}}
{{ with $img }}
<div class="w-48 mx-auto lg:-my-8 lg:ml-0 lg:mr-8 lg:pr-8 lg:py-8 lg:border-r">
<img src="{{ . }}" class="rounded-full" alt="Avatar">
@@ -34,10 +34,19 @@
<div class="flex lg:flex-col justify-center items-end ml-8">
{{ $brand := $.Param "social"}}
{{ range $brand }}
- {{ $src := print .icon_pack " fa-" .icon }}
+ {{/* Deprecation warning(v1.0.0) starts */}}
+ {{ if .icon_pack }}
+ {{ warnf "Param 'icon_pack' in %q is deprecated and will be removed in Eureka v1.0.0. Use 'iconPack' instead." $.File.Path }}
+ {{ end }}
+ {{ $iconPack := .iconPack | default .icon_pack }}
+ {{/* Deprecation warning(v1.0.0) ends */}}
+ {{ $src := print $iconPack " fa-" .icon }}
<div class="pb-2 pr-4 lg:pr-0 pt-4 lg:pt-0">
<a href="{{ .url }}"><i class="{{ print $src }}"></i></a>
</div>
{{ end }}
</div>
+</div>
+<div class="content">
+ {{ .Content }}
</div> \ No newline at end of file
diff --git a/layouts/partials/widgets/blank.html b/layouts/partials/widgets/blank.html
new file mode 100644
index 0000000..fb3ffc2
--- /dev/null
+++ b/layouts/partials/widgets/blank.html
@@ -0,0 +1 @@
+{{ .Content }} \ No newline at end of file
diff --git a/layouts/partials/widgets/details.html b/layouts/partials/widgets/details.html
deleted file mode 100644
index df381b0..0000000
--- a/layouts/partials/widgets/details.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<div class="content pb-20">
- {{ .Content }}
-</div> \ No newline at end of file
diff --git a/layouts/partials/widgets/pages.html b/layouts/partials/widgets/pages.html
new file mode 100644
index 0000000..be201b0
--- /dev/null
+++ b/layouts/partials/widgets/pages.html
@@ -0,0 +1,49 @@
+{{ if not .Params.widget.sidebar.position }}
+<h2 class=" font-bold text-3xl my-4">{{ .Params.Title }}</h2>
+{{ end }}
+{{ if eq .Params.style "plain" }}
+{{ partial "widgets/pages-plain" . }}
+{{ else if eq .Params.style "masonry" }}
+{{ partial "widgets/pages-masonry" . }}
+{{ else }}
+{{ partial "widgets/pages-card" . }}
+{{ end }}
+
+{{ define "partials/widgets/pages-get" }}
+{{- $section := .Site.GetPage .Params.section }}
+{{ $pages := $section.Pages }}
+{{ $count := .Params.count | default 5 }}
+{{ with $count }}
+{{ $pages = first $count $pages }}
+{{ end }}
+{{ return $pages }}
+{{ end }}
+
+{{ define "partials/widgets/pages-plain" }}
+{{ $pages := partial "widgets/pages-get" . }}
+{{ partial "components/summary-list-plain" $pages }}
+<div class="pt-2 hover:text-eureka">
+ <a href="{{ .Permalink }}" class="font-semibold">{{ i18n "readMore" }}</a>
+ <i class="fas fa-caret-right ml-1"></i>
+</div>
+{{ end }}
+
+{{ define "partials/widgets/pages-card" }}
+{{ $pages := partial "widgets/pages-get" . }}
+<div class="overflow-hidden">
+ {{ partial "components/summary-list-card" $pages }}
+ <div class="px-8 pt-2 hover:text-eureka">
+ <a href="{{ .Permalink }}" class="font-semibold">{{ i18n "readMore" }}</a>
+ <i class="fas fa-caret-right ml-1"></i>
+ </div>
+</div>
+{{ end }}
+
+{{ define "partials/widgets/pages-masonry" }}
+<div class="pb-2 text-right hover:text-eureka">
+ <a href="{{ .Permalink }}" class="font-semibold">{{ i18n "readMore" }}</a>
+ <i class="fas fa-caret-right ml-1"></i>
+</div>
+{{ $pages := partial "widgets/pages-get" . }}
+{{ partial "components/summary-list-masonry" $pages }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/widgets/vintage.html b/layouts/partials/widgets/vintage.html
new file mode 100644
index 0000000..9075f4b
--- /dev/null
+++ b/layouts/partials/widgets/vintage.html
@@ -0,0 +1,21 @@
+<div class="grid grid-cols-9 grid-rows-5 h-(screen-16)">
+ {{- $imgLeft := partial "utils/get-image" (dict "context" . "url" .Params.imgLeft)}}
+ {{- with $imgLeft }}
+ <div class="col-start-2 col-span-4 row-start-3 row-span-2 bg-local bg-cover z-10 shadow-2xl"
+ style="background-image: url({{ . }});"></div>
+ {{- end }}
+
+ <div class="col-start-3 col-span-5 row-start-2 row-span-3 z-20">
+ <div class="flex flex-col items-center justify-center min-h-full">
+ <div class="bg-white bg-opacity-75 shadow-2xl -m-12 p-12">
+ <span class="font-bold text-black text-opacity-75 text-2xl md:text-3xl">{{ .Params.slogan }}</span>
+ </div>
+ </div>
+ </div>
+ {{- $imgRight := partial "utils/get-image" (dict "context" . "url" .Params.imgRight)}}
+ {{- with $imgRight }}
+ <div class="col-start-5 col-span-4 row-start-2 row-span-2 bg-local bg-cover shadow-2xl"
+ style="background-image: url({{ . }});">
+ </div>
+ {{- end }}
+</div> \ No newline at end of file