Add post: 暗黑能天使
This commit is contained in:
5
layouts/404.html
Normal file
5
layouts/404.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{{ define "main" }}
|
||||
<div class="bg-secondary-bg rounded overflow-hidden mt-12 px-4 py-32 text-center">
|
||||
<span class="text-3xl">404 - Page not found</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
35
layouts/_default/baseof.html
Normal file
35
layouts/_default/baseof.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
lang="{{ .Site.LanguageCode }}"
|
||||
dir="{{ .Site.Language.LanguageDirection | default "ltr" }}"
|
||||
{{ if eq .Site.Params.colorScheme "dark" }}class="dark"{{ end }}
|
||||
>
|
||||
{{- partial "head" . }}
|
||||
|
||||
|
||||
<body class="flex min-h-screen flex-col">
|
||||
<header
|
||||
class="min-h-16 pl-scrollbar bg-secondary-bg fixed z-50 flex w-full items-center shadow-sm"
|
||||
>
|
||||
<div class="mx-auto w-full max-w-screen-xl">
|
||||
{{- partial "header" . -}}
|
||||
</div>
|
||||
</header>
|
||||
<main class="grow pt-16">
|
||||
{{- if or .IsHome (and (eq .Type "authors") (eq .Kind "term")) }}
|
||||
{{- block "main" . }}{{- end }}
|
||||
{{- else }}
|
||||
<div class="pl-scrollbar">
|
||||
<div class="mx-auto w-full max-w-screen-xl lg:px-4 xl:px-8">
|
||||
{{- block "main" . }}{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</main>
|
||||
<footer class="pl-scrollbar">
|
||||
<div class="mx-auto w-full max-w-screen-xl">
|
||||
{{- partial "footer" . -}}
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
7
layouts/_default/list.html
Normal file
7
layouts/_default/list.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "components/list-article" . }}
|
||||
<div class="bg-secondary-bg rounded px-6">
|
||||
{{ partial "components/summary-list-plain" .Paginator.Pages }}
|
||||
</div>
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
{{ end }}
|
||||
60
layouts/_default/single.html
Normal file
60
layouts/_default/single.html
Normal file
@@ -0,0 +1,60 @@
|
||||
{{ define "main" }}
|
||||
{{ $hasToc := and (in .TableOfContents "<li>" ) (.Params.toc) }}
|
||||
{{ $hasSidebar := or ($hasToc) (.Params.series) }}
|
||||
<div class="grid grid-cols-2 gap-4 lg:grid-cols-8 lg:pt-12">
|
||||
<div
|
||||
class="{{ if not $hasSidebar }}
|
||||
{{- print "lg:col-start-2" -}}
|
||||
{{ end }} bg-secondary-bg col-span-2 rounded px-6 py-8 lg:col-span-6"
|
||||
>
|
||||
{{ partial "components/post-article" . }}
|
||||
|
||||
{{ with .GetTerms "tags" }}
|
||||
{{ partial "components/post-tags" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/post-edit" . }}
|
||||
|
||||
{{ with .GetTerms "authors" }}
|
||||
{{ partial "components/post-author" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "components/post-footer" . }}
|
||||
{{ partial "comment.html" . }}
|
||||
</div>
|
||||
{{ if $hasSidebar }}
|
||||
<div class="col-span-2">
|
||||
{{ if .GetTerms "series" }}
|
||||
{{ partial "components/post-series" . }}
|
||||
{{ end }}
|
||||
{{ if $hasToc }}
|
||||
{{ partial "components/post-toc" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ $related := .Site.RegularPages.Related . | first 6 }}
|
||||
{{ with $related }}
|
||||
<div
|
||||
class="{{ if not $hasSidebar }}
|
||||
{{- print "lg:col-start-2" -}}
|
||||
{{ end }} bg-secondary-bg prose col-span-2 rounded p-6 lg:col-span-6"
|
||||
>
|
||||
<h3>{{ i18n "seeAlso" }}</h3>
|
||||
{{ range . }}
|
||||
<a href="{{ .Permalink }}" class="no-underline">{{ .LinkTitle }}</a>
|
||||
<br />
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{/* highlight.js */}}
|
||||
{{- if eq .Site.Params.highlight.handler "highlightjs" }}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
hljs.highlightAll();
|
||||
});
|
||||
</script>
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
12
layouts/_default/terms.html
Normal file
12
layouts/_default/terms.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "components/list-article" . }}
|
||||
<div class="bg-secondary-bg rounded px-6 py-8">
|
||||
{{ range .Pages }}
|
||||
<h2 class="text-primary-text my-2 text-lg">
|
||||
<a href="{{ .Permalink }}" class="text-eureka hover:underline"
|
||||
>{{ .LinkTitle }}</a
|
||||
>
|
||||
</h2>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
16
layouts/authors/list.html
Normal file
16
layouts/authors/list.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{ define "main" }}
|
||||
<div class="pl-scrollbar bg-secondary-bg">
|
||||
<div class="mx-auto max-w-screen-xl">
|
||||
<div class="mx-auto px-6 py-12 md:px-8 lg:w-3/4 xl:px-12">
|
||||
{{ partial "widgets/about" . }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pl-scrollbar bg-primary-bg">
|
||||
<div class="mx-auto max-w-screen-xl">
|
||||
<div class="mx-auto px-6 py-12 md:px-8 lg:w-3/4 xl:px-12">
|
||||
{{ partial "components/summary-list-plain" .Pages }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
12
layouts/authors/terms.html
Normal file
12
layouts/authors/terms.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "components/list-article" . }}
|
||||
<div class="bg-secondary-bg rounded px-6 py-8">
|
||||
{{ range .Pages }}
|
||||
<h2 class="text-primary-text my-2 text-lg">
|
||||
<a href="{{ .Permalink }}" class="text-eureka hover:underline"
|
||||
>{{ .LinkTitle }}</a
|
||||
>
|
||||
</h2>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
3
layouts/docs/doc-list.html
Normal file
3
layouts/docs/doc-list.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "components/doc-list" . }}
|
||||
{{ end }}
|
||||
6
layouts/docs/doc_list.html
Normal file
6
layouts/docs/doc_list.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{ define "main" }}
|
||||
{{ warnf "Value 'doc_list' of layout param in %q is deprecated and will be removed in Eureka v1.0.0. Please use 'doc-list' instead." .File.Path }}
|
||||
{{ partial "components/doc-list" . }}
|
||||
{{ end }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
3
layouts/docs/list.html
Normal file
3
layouts/docs/list.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "components/doc-layout" . }}
|
||||
{{ end }}
|
||||
3
layouts/docs/single.html
Normal file
3
layouts/docs/single.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "components/doc-layout" . }}
|
||||
{{ end }}
|
||||
237
layouts/index.html
Normal file
237
layouts/index.html
Normal file
@@ -0,0 +1,237 @@
|
||||
{{- define "main" }}
|
||||
{{ $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/hugo-eureka/homepage-configuration/" }}
|
||||
<div class="bg-secondary-bg pl-scrollbar">
|
||||
<div class="mx-auto max-w-screen-xl">
|
||||
<div class="h-(screen-16) grid grid-cols-9 grid-rows-5">
|
||||
{{- $imgLeft := partial "utils/get-image" (dict "context" . "url" .Site.Params.hero.imgLeft) }}
|
||||
{{- with $imgLeft }}
|
||||
<div
|
||||
class="z-10 col-span-4 col-start-2 row-span-2 row-start-3 bg-cover bg-local shadow-2xl"
|
||||
style="background-image: url({{ . }});"
|
||||
></div>
|
||||
{{- end }}
|
||||
|
||||
|
||||
<div class="z-20 col-span-5 col-start-3 row-span-3 row-start-2">
|
||||
<div class="flex min-h-full flex-col items-center justify-center">
|
||||
<div class="-m-12 bg-white bg-opacity-75 p-12 shadow-2xl">
|
||||
<span
|
||||
class="text-2xl font-bold text-black text-opacity-75 md:text-3xl"
|
||||
>{{ .Site.Params.hero.slogan }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{- $imgRight := partial "utils/get-image" (dict "context" . "url" .Site.Params.hero.imgRight) }}
|
||||
{{- with $imgRight }}
|
||||
<div
|
||||
class="col-span-4 col-start-5 row-span-2 row-start-2 bg-cover bg-local shadow-2xl"
|
||||
style="background-image: url({{ . }});"
|
||||
></div>
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pl-scrollbar">
|
||||
<div class="mx-auto max-w-screen-xl">
|
||||
<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="mx-auto max-w-screen-xl">
|
||||
<div
|
||||
id="{{ .File.BaseFileName }}"
|
||||
class="{{ with $widgetClass -}}
|
||||
{{ partial "utils/standardize-classes" . }}
|
||||
{{- end }}"
|
||||
>
|
||||
{{ partial "widgets/load-sidebar" . }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "partials/widgets/load-sidebar" }}
|
||||
{{ $sidebar := .Params.widget.sidebar }}
|
||||
|
||||
{{ if $sidebar.position }}
|
||||
|
||||
{{ $scaleClass := "" }}
|
||||
{{/* widget width */}}
|
||||
{{ $scale := $sidebar.scale }}
|
||||
{{ $scaleOptions := dict "sm" "lg:w-1/5" "md" "lg:w-1/4" "lg" "lg:w-1/3" "xl" "lg:w-1/2" }}
|
||||
{{ if $scale }}
|
||||
{{ $scaleClass = index $scaleOptions $scale }}
|
||||
{{ else }}
|
||||
{{ $scaleClass = index $scaleOptions "md" }}
|
||||
{{ end }}
|
||||
<div
|
||||
class="{{ if eq $sidebar.position "right" -}}
|
||||
lg:flex-row-reverse
|
||||
{{- else -}}
|
||||
lg:flex-row
|
||||
{{- end }} flex flex-col"
|
||||
>
|
||||
<div
|
||||
class="{{ with $scaleClass -}}
|
||||
{{ partial "utils/standardize-classes" . }}
|
||||
{{- end }} {{ if eq $sidebar.position "left" -}}
|
||||
lg:me-4
|
||||
{{- else -}}
|
||||
lg:ms-4
|
||||
{{- end }} flex-none"
|
||||
>
|
||||
<h2 class="my-4 text-3xl font-bold">{{ .Params.Title }}</h2>
|
||||
</div>
|
||||
<div
|
||||
class="{{ if eq $sidebar.position "right" -}}
|
||||
lg:me-4
|
||||
{{- else -}}
|
||||
lg:ms-4
|
||||
{{- end }} grow"
|
||||
>
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{- if eq .Params.widget.handler "experiences" }}
|
||||
{{- warnf "Value `experiences` for `widget.handler` in %s is deprecated and will be removed in Eureka v1.0.0. Please use `experience` instead." .File.Path }}
|
||||
{{ partial (printf "widgets/%s" "experience") . }}
|
||||
{{- else }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{ partial (printf "widgets/%s" .Params.widget.handler) . }}
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{- end }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{ else }}
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{- if eq .Params.widget.handler "experiences" }}
|
||||
{{- warnf "Value `experiences` for `widget.handler` in %s is deprecated and will be removed in Eureka v1.0.0. Please use `experience` instead." .File.Path }}
|
||||
{{ partial (printf "widgets/%s" "experience") . }}
|
||||
{{- else }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{ partial (printf "widgets/%s" .Params.widget.handler) . }}
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{- end }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
22
layouts/partials/comment.html
Normal file
22
layouts/partials/comment.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{- if .Site.Params.comment.platform }}
|
||||
{{- warnf "Param `comment.platform` in params.yaml is deprecated and will be removed in Eureka v1.0.0. Please use `comment.handler` instead." }}
|
||||
{{- end }}
|
||||
{{- $commentHandler := .Site.Params.comment.handler | default .Site.Params.comment.platform }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
|
||||
{{- $enableComment := false }}
|
||||
|
||||
{{- if $commentHandler }}
|
||||
{{- $bundles := partial "utils/get-bundles" . }}
|
||||
{{- $enableComment = true }}
|
||||
{{- range $bundles.Reverse }}
|
||||
{{- if and (ne .Params.enableComment nil) (ne .Params.enableComment "") }}
|
||||
{{- $enableComment = .Params.enableComment }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{ if $enableComment }}
|
||||
{{ partial (printf "comment/%s" $commentHandler) . }}
|
||||
{{ end }}
|
||||
5
layouts/partials/comment/commento.html
Normal file
5
layouts/partials/comment/commento.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<div id="commento"></div>
|
||||
<script defer
|
||||
src="{{ .Site.Params.comment.commento.url | default "https://cdn.commento.io"}}/js/commento.js">
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to load the comments.</noscript>
|
||||
22
layouts/partials/comment/disqus.html
Normal file
22
layouts/partials/comment/disqus.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{ if .Site.Params.comment.disqus.shortname }}
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
var disqus_config = function () {
|
||||
{{ with .Site.Params.comment.disqus.identifier }}this.page.identifier = '{{ . }}';{{ end }}
|
||||
{{ with .Site.Params.comment.disqus.title }}this.page.title = '{{ . }}';{{ end }}
|
||||
{{ with .Site.Params.comment.disqus.url }}this.page.url = '{{ . | html }}';{{ end }}
|
||||
};
|
||||
(function() {
|
||||
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
|
||||
document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.';
|
||||
return;
|
||||
}
|
||||
var d = document, s = d.createElement('script'); s.async = true;
|
||||
s.src = '//' + {{ .Site.Params.comment.disqus.shortname }} + '.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
||||
{{ end }}
|
||||
38
layouts/partials/comment/utterances.html
Normal file
38
layouts/partials/comment/utterances.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<script id="utterances" src="https://utteranc.es/client.js"
|
||||
{{- range $key, $value := .Site.Params.comment.utterances }}
|
||||
{{- if and (eq $key "theme") (eq $value "eureka") }}
|
||||
{{- if eq $.Site.Params.colorScheme "light" }}
|
||||
{{ printf "%s=%v" $key "github-light" | safeHTMLAttr }}
|
||||
{{- else if eq $.Site.Params.colorScheme "dark" }}
|
||||
{{ printf "%s=%v" $key "github-dark" | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{ printf "%s=%v" $key "preferred-color-scheme" | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- else if or $value (eq $value false) }}
|
||||
{{ printf "%s=%v" $key $value | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
crossorigin="anonymous"
|
||||
async>
|
||||
</script>
|
||||
<script>
|
||||
{{- if eq .Site.Params.colorScheme "light" }}
|
||||
if (storageColorScheme == "Auto") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'preferred-color-scheme')
|
||||
} else if (storageColorScheme == "Dark") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'github-dark')
|
||||
}
|
||||
{{- else if eq .Site.Params.colorScheme "dark" }}
|
||||
if (storageColorScheme == "Auto") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'preferred-color-scheme')
|
||||
} else if (storageColorScheme == "Light") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'github-light')
|
||||
}
|
||||
{{- else }}
|
||||
if (storageColorScheme == "Light") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'github-light')
|
||||
} else if (storageColorScheme == "Dark") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'github-dark')
|
||||
}
|
||||
{{- end }}
|
||||
</script>
|
||||
14
layouts/partials/comment/valine.html
Normal file
14
layouts/partials/comment/valine.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<div id="valine-comments" class="mt-4"></div>
|
||||
{{- $assets := .Site.Data.assets }}
|
||||
<script defer src="{{ printf $assets.valine.js.url $assets.valine.version }}" {{ with $assets.valine.js.sri }}
|
||||
integrity="{{ . }}" {{ end }} crossorigin></script>
|
||||
{{- with .Site.Params.comment.valine }}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
new Valine({
|
||||
el: "#valine-comments",
|
||||
{{- partial "utils/get-js-configs" . | safeJS }}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{{- end }}
|
||||
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>
|
||||
1
layouts/partials/custom-head.html
Normal file
1
layouts/partials/custom-head.html
Normal file
@@ -0,0 +1 @@
|
||||
{{/* Do not modify this file! */}}
|
||||
3
layouts/partials/footer.html
Normal file
3
layouts/partials/footer.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="text-center p-6 pin-b">
|
||||
<p class="text-sm text-tertiary-text">{{ with .Site.Copyright }}{{ replace . "{year}" now.Year | safeHTML }} · {{ end }} Powered by the <a href="https://github.com/wangchucheng/hugo-eureka" class="hover:text-eureka">Eureka</a> theme for <a href="https://gohugo.io" class="hover:text-eureka">Hugo</a></p>
|
||||
</div>
|
||||
186
layouts/partials/head.html
Normal file
186
layouts/partials/head.html
Normal file
@@ -0,0 +1,186 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{ define "partials/get-title" }}
|
||||
{{ $separator := .Site.Params.titleSeparator | default "|" }}
|
||||
{{ $primarySep := $separator }}
|
||||
{{ $secondarySep := $separator }}
|
||||
{{ if reflect.IsSlice $separator }}
|
||||
{{ $primarySep = index $separator 0 }}
|
||||
{{ $secondarySep = index $separator 1 | default (index $separator 0) }}
|
||||
{{ end }}
|
||||
{{ $title := .Site.Title }}
|
||||
{{/* Generate prefix */}}
|
||||
{{ $prefix := "" }}
|
||||
{{ if .Params.Title }}
|
||||
{{ $prefix = .Params.Title }}
|
||||
{{/* 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 "utils/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) }}
|
||||
{{/* 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 }}
|
||||
{{ end }}
|
||||
{{ 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) }}
|
||||
{{/* 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 }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{/* Add prefix */}}
|
||||
{{ with $prefix }}
|
||||
{{ $title = print . " " $primarySep " " $title }}
|
||||
{{ end }}
|
||||
{{ return $title }}
|
||||
{{ end }}
|
||||
<title>{{ partial "get-title" . }}</title>
|
||||
|
||||
<meta name="generator" content="Hugo Eureka {{ .Site.Data.eureka.version }}" />
|
||||
|
||||
{{- $eurekaCSS := resources.Get "css/eureka.css" | postCSS (dict "config" "./assets/css/postcss.config.js" "inlineImports" true) | resources.ExecuteAsTemplate "css/eureka.css" . | minify | fingerprint "sha384" }}
|
||||
<link rel="stylesheet" href="{{ $eurekaCSS.Permalink }}">
|
||||
|
||||
{{- $eurekaJS := resources.Get "js/eureka.js" | resources.ExecuteAsTemplate "js/eureka.js" . | minify | fingerprint "sha384" }}
|
||||
<script defer src="{{ $eurekaJS.Permalink }}"></script>
|
||||
|
||||
{{ $googleFonts := "" }}
|
||||
{{ range $index, $value := partial "utils/get-style-fonts" (dict "context" . "param" "googleFonts") }}
|
||||
{{ with $value }}
|
||||
{{ $googleFonts = print $googleFonts "family=" . "&" }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ with $googleFonts }}
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="preload"
|
||||
href="{{ printf "https://fonts.googleapis.com/css2?%sdisplay=swap" . }}"
|
||||
as="style" onload="this.onload=null;this.rel='stylesheet'">
|
||||
{{ end }}
|
||||
|
||||
{{- $assets := .Site.Data.assets }}
|
||||
|
||||
{{/* highlight */}}
|
||||
{{- if eq .Site.Params.highlight.handler "chroma" }}
|
||||
{{- $highlightCSS := resources.Get "css/syntax.css" | minify | fingerprint "sha384" }}
|
||||
<link rel="stylesheet" href="{{ $highlightCSS.Permalink }}" media="print" onload="this.media='all';this.onload=null">
|
||||
{{- else if eq .Site.Params.highlight.handler "highlightjs" }}
|
||||
{{- $highlightjsStyle := .Site.Params.highlight.highlightjs.style | default "base16/solarized-light" }}
|
||||
<link rel="stylesheet" href="{{ printf $assets.highlightjs.css.url $assets.highlightjs.version $highlightjsStyle }}"
|
||||
{{ with $assets.highlightjs.css.sri }} integrity="{{ . }}" {{ end }} media="print"
|
||||
onload="this.media='all';this.onload=null" crossorigin>
|
||||
<script defer src="{{ printf $assets.highlightjs.js.url $assets.highlightjs.version }}"
|
||||
{{ with $assets.highlightjs.js.sri }} integrity="{{ . }}" {{ end }} crossorigin></script>
|
||||
{{- range .Site.Params.highlight.highlightjs.languages }}
|
||||
<script defer src="{{ printf $assets.highlightjs.languages.url $assets.highlightjs.version . }}"
|
||||
{{ with $assets.highlightjs.languages.sri }} integrity="{{ . }}" {{ end }} crossorigin></script>
|
||||
{{- end }}
|
||||
{{- $highlightjsCSS := resources.Get "css/highlightjs.css" | minify | fingerprint "sha384" }}
|
||||
<link rel="stylesheet" href="{{ $highlightjsCSS.Permalink }}" media="print" onload="this.media='all';this.onload=null">
|
||||
{{- end }}
|
||||
|
||||
{{ $fontawesomeJS := resources.Get "js/fontawesome.js" | resources.ExecuteAsTemplate "js/fontawesome.js" . | js.Build (dict "minify" true) | minify | fingerprint "sha384" }}
|
||||
<script defer type="text/javascript" src="{{ $fontawesomeJS.Permalink }}"></script>
|
||||
|
||||
|
||||
{{- $enableMath := false }}
|
||||
{{- if .Site.Params.math.handler }}
|
||||
{{- $bundles := partial "utils/get-bundles" . }}
|
||||
{{- $enableMath = true }}
|
||||
{{- range $bundles.Reverse }}
|
||||
{{- if and (ne .Params.enableMath nil) (ne .Params.enableMath "") }}
|
||||
{{- $enableMath = .Params.enableMath }}
|
||||
{{/* Deprecation warning(v1.0.0) starts */}}
|
||||
{{- else if and (ne .Params.math nil) (ne .Params.math "") }}
|
||||
{{ warnf "Param 'math' in %q is deprecated and will be removed in Eureka v1.0.0. Please use 'enableMath' instead." .File.Path }}
|
||||
{{- $enableMath = .Params.math }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* KaTeX */}}
|
||||
{{- if and (eq .Site.Params.math.handler "katex") $enableMath }}
|
||||
<link rel="stylesheet" href="{{ printf $assets.katex.css.url $assets.katex.version }}"
|
||||
{{ with $assets.katex.css.sri }} integrity="{{ . }}" {{ end }} media="print"
|
||||
onload="this.media='all';this.onload=null" crossorigin>
|
||||
<script defer src="{{ printf $assets.katex.js.url $assets.katex.version }}" {{ with $assets.katex.js.sri }}
|
||||
integrity="{{ . }}" {{ end }} crossorigin></script>
|
||||
<script defer src="{{ printf $assets.katex.autoRender.url $assets.katex.version }}"
|
||||
{{ with $assets.katex.autoRender.sri }} integrity="{{ . }}" {{ end }} crossorigin></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
renderMathInElement(document.body, {
|
||||
delimiters: [
|
||||
{ left: "$$", right: "$$", display: true },
|
||||
{ left: "$", right: "$", display: false },
|
||||
{ left: "\\(", right: "\\)", display: false },
|
||||
{ left: "\\[", right: "\\]", display: true }
|
||||
],
|
||||
{{- partial "utils/get-js-configs" .Site.Params.math.katex | safeJS }}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{- end }}
|
||||
|
||||
{{/* Mermaid */}}
|
||||
{{- if eq .Site.Params.diagram.handler "mermaid" }}
|
||||
<script defer src="{{ printf $assets.mermaid.js.url $assets.mermaid.version }}" {{ with $assets.mermaid.js.sri }}
|
||||
integrity="{{ . }}" {{ end }} crossorigin></script>
|
||||
{{- with .Site.Params.diagram.mermaid }}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
mermaid.initialize({
|
||||
{{- partial "utils/get-js-configs" . | safeJS }}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Site.GoogleAnalytics hugo.IsProduction }}
|
||||
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.GoogleAnalytics }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() { dataLayer.push(arguments); }
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{ .Site.GoogleAnalytics }}');
|
||||
</script>
|
||||
{{- end }}
|
||||
|
||||
{{ 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 }}">
|
||||
{{- end }}
|
||||
|
||||
{{ define "partials/get-icon" }}
|
||||
{{ $icon := resources.GetMatch .icon }}
|
||||
{{ $iconResized := $icon.Fill (printf "%sx%s Center" (string .size) (string .size)) }}
|
||||
{{ return $iconResized }}
|
||||
{{ end }}
|
||||
|
||||
{{- 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 }}
|
||||
130
layouts/partials/header.html
Normal file
130
layouts/partials/header.html
Normal file
@@ -0,0 +1,130 @@
|
||||
<script>
|
||||
let storageColorScheme = localStorage.getItem("lightDarkMode")
|
||||
{{- if eq .Site.Params.colorScheme "light" }}
|
||||
if ((storageColorScheme == 'Auto' && window.matchMedia("(prefers-color-scheme: dark)").matches) || storageColorScheme == "Dark") {
|
||||
document.getElementsByTagName('html')[0].classList.add('dark')
|
||||
}
|
||||
{{- else if eq .Site.Params.colorScheme "dark" }}
|
||||
if ((storageColorScheme == 'Auto' && window.matchMedia("(prefers-color-scheme: light)").matches) || storageColorScheme == "Light") {
|
||||
document.getElementsByTagName('html')[0].classList.remove('dark')
|
||||
}
|
||||
{{- else }}
|
||||
if (((storageColorScheme == 'Auto' || storageColorScheme == null) && window.matchMedia("(prefers-color-scheme: dark)").matches) || storageColorScheme == "Dark") {
|
||||
document.getElementsByTagName('html')[0].classList.add('dark')
|
||||
}
|
||||
{{- end }}
|
||||
</script>
|
||||
<nav class="flex items-center justify-between flex-wrap px-4 py-4 md:py-0">
|
||||
<a href="{{ "/" | relLangURL }}" class="me-6 text-primary-text text-xl font-bold">{{ .Site.Title }}</a>
|
||||
<button id="navbar-btn" class="md:hidden flex items-center px-3 py-2" aria-label="Open Navbar">
|
||||
<i class="fas fa-bars"></i>
|
||||
</button>
|
||||
|
||||
<div id="target"
|
||||
class="hidden block md:flex md:grow md:justify-between md:items-center w-full md:w-auto text-primary-text z-20">
|
||||
<div class="md:flex md:h-16 text-sm md:grow pb-4 md:pb-0 border-b md:border-b-0">
|
||||
{{- $relPermalink := .RelPermalink }}
|
||||
{{- range .Site.Menus.main }}
|
||||
{{- $url := .URL | relLangURL }}
|
||||
<a href="{{ $url }}" class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 {{ if hasPrefix $relPermalink $url }} selected-menu-item {{ else }} border-transparent {{ end }} me-4">{{ .Name }}</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
|
||||
<div class="flex">
|
||||
<div class="relative pt-4 md:pt-0">
|
||||
<div class="cursor-pointer hover:text-eureka" id="lightDarkMode">
|
||||
{{- if eq .Site.Params.colorScheme "dark" }}
|
||||
<i class="fas fa-moon"></i>
|
||||
{{- else if eq .Site.Params.colorScheme "light" }}
|
||||
<i class="fas fa-sun"></i>
|
||||
{{- else }}
|
||||
<i class="fas fa-adjust"></i>
|
||||
{{- end }}
|
||||
</div>
|
||||
<div class="fixed hidden inset-0 opacity-0 h-full w-full cursor-default z-30" id="is-open">
|
||||
</div>
|
||||
<div class="absolute flex flex-col start-0 md:start-auto end-auto md:end-0 hidden bg-secondary-bg w-48 rounded py-2 border border-tertiary-bg cursor-pointer z-40"
|
||||
id='lightDarkOptions'>
|
||||
<span class="px-4 py-1 hover:text-eureka" name="Light">{{i18n "light"}}</span>
|
||||
<span class="px-4 py-1 hover:text-eureka" name="Dark">{{i18n "dark"}}</span>
|
||||
<span class="px-4 py-1 hover:text-eureka" name="Auto">{{i18n "auto"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{- if .IsTranslated }}
|
||||
<div class="relative pt-4 ps-4 md:pt-0">
|
||||
<div class="cursor-pointer hover:text-eureka" id="languageMode">
|
||||
<i class="fas fa-globe"></i>
|
||||
<span class="ps-1">{{ .Language.LanguageName }}</span>
|
||||
</div>
|
||||
<div class="fixed hidden inset-0 opacity-0 h-full w-full cursor-default z-30" id="is-open-lang">
|
||||
</div>
|
||||
<div class="absolute flex flex-col start-0 md:start-auto end-auto md:end-0 hidden bg-secondary-bg w-48 rounded py-2 border border-tertiary-bg cursor-pointer z-40"
|
||||
id='languageOptions'>
|
||||
<a class="px-4 py-1 hover:text-eureka" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
|
||||
{{- range .Translations }}
|
||||
<a class="px-4 py-1 hover:text-eureka" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fixed hidden inset-0 opacity-0 h-full w-full cursor-default z-0" id="is-open-mobile">
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
<script>
|
||||
// change icon and add listener if auto
|
||||
let element = document.getElementById('lightDarkMode')
|
||||
{{- if eq .Site.Params.colorScheme "light" }}
|
||||
if (storageColorScheme == 'Auto') {
|
||||
element.firstElementChild.classList.remove('fa-sun')
|
||||
element.firstElementChild.setAttribute("data-icon", 'adjust')
|
||||
element.firstElementChild.classList.add('fa-adjust')
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener('change', switchDarkMode)
|
||||
})
|
||||
} else if (storageColorScheme == "Dark") {
|
||||
element.firstElementChild.classList.remove('fa-sun')
|
||||
element.firstElementChild.setAttribute("data-icon", 'moon')
|
||||
element.firstElementChild.classList.add('fa-moon')
|
||||
}
|
||||
{{- else if eq .Site.Params.colorScheme "dark" }}
|
||||
if (storageColorScheme == 'Auto') {
|
||||
element.firstElementChild.classList.remove('fa-moon')
|
||||
element.firstElementChild.setAttribute("data-icon", 'adjust')
|
||||
element.firstElementChild.classList.add('fa-adjust')
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener('change', switchDarkMode)
|
||||
})
|
||||
} else if (storageColorScheme == "Light") {
|
||||
element.firstElementChild.classList.remove('fa-moon')
|
||||
element.firstElementChild.setAttribute("data-icon", 'sun')
|
||||
element.firstElementChild.classList.add('fa-sun')
|
||||
}
|
||||
{{- else }}
|
||||
if (storageColorScheme == null || storageColorScheme == 'Auto') {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener('change', switchDarkMode)
|
||||
})
|
||||
} else if (storageColorScheme == "Light") {
|
||||
element.firstElementChild.classList.remove('fa-adjust')
|
||||
element.firstElementChild.setAttribute("data-icon", 'sun')
|
||||
element.firstElementChild.classList.add('fa-sun')
|
||||
} else if (storageColorScheme == "Dark") {
|
||||
element.firstElementChild.classList.remove('fa-adjust')
|
||||
element.firstElementChild.setAttribute("data-icon", 'moon')
|
||||
element.firstElementChild.classList.add('fa-moon')
|
||||
}
|
||||
{{- end }}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
getcolorscheme();
|
||||
switchBurger();
|
||||
{{- if .IsTranslated }}
|
||||
switchLanguage()
|
||||
{{- end }}
|
||||
});
|
||||
</script>
|
||||
8
layouts/partials/utils/camelize.html
Normal file
8
layouts/partials/utils/camelize.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ $input := . }}
|
||||
{{ $regexp := "(-|_)([a-z])" }}
|
||||
{{ $matches := findRE $regexp $input }}
|
||||
{{ range $matches }}
|
||||
{{ $input = $input | replaceRE . (upper .) }}
|
||||
{{ end }}
|
||||
{{ $input = $input | replaceRE "(-|_)" "" }}
|
||||
{{ return $input }}
|
||||
7
layouts/partials/utils/get-bundles.html
Normal file
7
layouts/partials/utils/get-bundles.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{ $currentPage := . }}
|
||||
{{ $bundles := slice $currentPage }}
|
||||
{{ if and (ne $currentPage.Kind "taxonomy") (or (ne $currentPage $currentPage.FirstSection) (eq $currentPage.Kind "term")) }}
|
||||
{{ $currentBundles := partial "utils/get-bundles" $currentPage.Parent }}
|
||||
{{ $bundles = $bundles | append $currentBundles }}
|
||||
{{ end }}
|
||||
{{ return $bundles }}
|
||||
9
layouts/partials/utils/get-featured.html
Normal file
9
layouts/partials/utils/get-featured.html
Normal file
@@ -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 }}
|
||||
56
layouts/partials/utils/get-fontawesome-icons.html
Normal file
56
layouts/partials/utils/get-fontawesome-icons.html
Normal file
@@ -0,0 +1,56 @@
|
||||
{{ $fasIcons := slice }}
|
||||
{{ $fabIcons := slice }}
|
||||
{{ $farIcons := slice }}
|
||||
|
||||
{{/* eureka */}}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-adjust") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-bars") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-calendar") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-caret-down") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-caret-left") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-caret-right") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-clock") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-edit") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-folder") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-globe") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-moon") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-sun") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-th-list") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-user") }}
|
||||
{{ $fasIcons = $fasIcons | append (partial "utils/camelize" "fa-user-circle") }}
|
||||
|
||||
{{/* authors */}}
|
||||
{{ range (.Site.GetPage "taxonomyTerm" "authors").Pages }}
|
||||
{{ range .Params.social }}
|
||||
{{ $icon := partial "utils/camelize" (print "fa-" .icon) }}
|
||||
{{ if and (eq .iconPack "fas") (not (in $fasIcons $icon)) }}
|
||||
{{ $fasIcons = $fasIcons | append $icon }}
|
||||
{{ else if and (eq .iconPack "fab") (not (in $fabIcons $icon)) }}
|
||||
{{ $fabIcons = $fabIcons | append $icon }}
|
||||
{{ else if and (eq .iconPack "far") (not (in $farIcons $icon)) }}
|
||||
{{ $farIcons = $farIcons | append $icon }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* homepage.about */}}
|
||||
{{ $homepage := .Site.GetPage "homepage" }}
|
||||
{{ $widgets := $homepage.Resources }}
|
||||
{{ range $widgets }}
|
||||
{{ if eq .Params.widget.handler "about" }}
|
||||
{{ range .Params.social }}
|
||||
{{ $icon := partial "utils/camelize" (print "fa-" .icon) }}
|
||||
{{ if and (eq .iconPack "fas") (not (in $fasIcons $icon)) }}
|
||||
{{ $fasIcons = $fasIcons | append $icon }}
|
||||
{{ else if and (eq .iconPack "fab") (not (in $fabIcons $icon)) }}
|
||||
{{ $fabIcons = $fabIcons | append $icon }}
|
||||
{{ else if and (eq .iconPack "far") (not (in $farIcons $icon)) }}
|
||||
{{ $farIcons = $farIcons | append $icon }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $icons := dict "fas" $fasIcons "fab" $fabIcons "far" $farIcons }}
|
||||
|
||||
{{ return $icons }}
|
||||
17
layouts/partials/utils/get-image.html
Normal file
17
layouts/partials/utils/get-image.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{- $img := "" }}
|
||||
{{- $validKeyword := false }}
|
||||
{{- if .keyword }}
|
||||
{{- if (.context.Resources.ByType "image").GetMatch .keyword }}
|
||||
{{- $validKeyword = true}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $validKeyword }}
|
||||
{{- $img = ((.context.Resources.ByType "image").GetMatch .keyword).Permalink }}
|
||||
{{- else if or (hasPrefix .url "//") (or (hasPrefix .url "http://") (hasPrefix .url "https://")) }}
|
||||
{{- $img = (.url | absURL) }}
|
||||
{{- else if resources.GetMatch .url }}
|
||||
{{- $img = (resources.GetMatch .url).Permalink }}
|
||||
{{- else if .url }}
|
||||
{{- $img = (.url | absURL) }}
|
||||
{{- end }}
|
||||
{{- return $img }}
|
||||
13
layouts/partials/utils/get-js-configs.html
Normal file
13
layouts/partials/utils/get-js-configs.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{{- range $key, $value := . }}
|
||||
{{- if or $value (eq $value false) }}
|
||||
{{- $key = partial "utils/camelize" $key }}
|
||||
{{- $key }}:
|
||||
{{- if reflect.IsMap $value }}
|
||||
{
|
||||
{{ partial "utils/get-js-configs" . }}
|
||||
},
|
||||
{{- else -}}
|
||||
"{{ $value }}",
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
18
layouts/partials/utils/get-style-color.html
Normal file
18
layouts/partials/utils/get-style-color.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{{ $style := (index .context.Site.Data.styles (.context.Site.Params.style | default "default")) }}
|
||||
{{ $result := $style.colors }}
|
||||
{{ if $result }}
|
||||
{{ range .path }}
|
||||
{{ if $result }}
|
||||
{{ $result = index $result . }}
|
||||
{{ else }}
|
||||
{{ errorf "Param %s is undefined in style %s" (delimit $.path ".") $.context.Site.Params.style }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if $result }}
|
||||
{{ return $result }}
|
||||
{{ else }}
|
||||
{{ errorf "Param %s is undefined in style %s" (delimit $.path ".") $.context.Site.Params.style }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ errorf "Could not find colors section in style %s." .context.Site.Params.style }}
|
||||
{{ end }}
|
||||
12
layouts/partials/utils/get-style-fonts.html
Normal file
12
layouts/partials/utils/get-style-fonts.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ $style := (index .context.Site.Data.styles (.context.Site.Params.style | default "default")) }}
|
||||
{{ $result := slice }}
|
||||
{{ range $style.fonts }}
|
||||
{{ $item := index . $.param }}
|
||||
{{ if $item }}
|
||||
{{ $result = $result | append $item }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{/* TODO: use realtime location */}}
|
||||
{{ errorf "Could not find fonts section in style %s." .context.Site.Params.style }}
|
||||
{{ end }}
|
||||
{{ return $result }}
|
||||
38
layouts/partials/utils/get-summary.html
Normal file
38
layouts/partials/utils/get-summary.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<div class="prose">
|
||||
<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 }}
|
||||
|
||||
{{ if eq .Type "docs" }}
|
||||
<div class="mx-6">
|
||||
{{ range $index, $value := first 3 .Pages }}
|
||||
{{ if gt $index 0 }}
|
||||
<div class="-mx-4 my-4 border-t"></div>
|
||||
{{ end -}}
|
||||
<a href="{{ .Permalink }}" class="no-underline">
|
||||
<h4>{{ .LinkTitle }}</h4>
|
||||
</a>
|
||||
{{ if .Description }}
|
||||
{{ .Description | plainify | htmlUnescape }}
|
||||
{{ else if .Summary }}
|
||||
{{ .Summary | plainify | htmlUnescape }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<a href="{{ .Permalink }}" class="no-underline">
|
||||
<h4>
|
||||
{{ i18n "readMore" }}
|
||||
<i
|
||||
class="fas {{ cond (eq .Site.Language.LanguageDirection "rtl") "fa-caret-left" "fa-caret-right" }} ms-1"
|
||||
></i>
|
||||
</h4>
|
||||
</a>
|
||||
</div>
|
||||
{{ else }}
|
||||
{{ partial "components/post-metadata" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
7
layouts/partials/utils/get-video.html
Normal file
7
layouts/partials/utils/get-video.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{ if or (hasPrefix .url "//") (or (hasPrefix .url "http://") (hasPrefix .url "https://")) }}
|
||||
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
|
||||
<iframe src="{{ .url }}" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
{{ else if .url }}
|
||||
<video class="w-full" src="{{ .url | absURL }}" controls></video>
|
||||
{{ end }}
|
||||
1
layouts/partials/utils/hyphenate.html
Normal file
1
layouts/partials/utils/hyphenate.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ return replace . "_" "-" }}
|
||||
4
layouts/partials/utils/standardize-classes.html
Normal file
4
layouts/partials/utils/standardize-classes.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{{ $classes := replaceRE " +" " " . }}
|
||||
{{ $classes = strings.TrimLeft " " $classes }}
|
||||
{{ $classes = strings.TrimRight " " $classes }}
|
||||
{{ return $classes }}
|
||||
51
layouts/partials/widgets/about.html
Normal file
51
layouts/partials/widgets/about.html
Normal file
@@ -0,0 +1,51 @@
|
||||
<div class="mb-12 flex flex-col items-center justify-center md:flex-row">
|
||||
{{ $img := partial "utils/get-image" (dict "context" . "url" .Params.avatar "keyword" "*avatar*") }}
|
||||
{{ with $img }}
|
||||
<div class="md:ms-0 md:me-8 md:pe-8 md:border-e mx-auto w-48 flex-none">
|
||||
<img src="{{ . }}" class="rounded-full" alt="Avatar" />
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="mt-4 w-full grow md:mt-0">
|
||||
<h1 class="py-4 text-3xl">{{ .Title }}</h1>
|
||||
<div class="w-3/12 border-b xl:w-2/12"></div>
|
||||
|
||||
<div class="flex items-center pt-4">
|
||||
{{ with or (.Params.role) (.Params.organizations) }}
|
||||
<i class="fas fa-user"></i>
|
||||
{{ end }}
|
||||
<div class="flex flex-wrap">
|
||||
{{ with .Params.role }}
|
||||
<span class="ps-4">{{ . | markdownify }}</span>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.organization }}
|
||||
<a href="{{ .url }}" class="ps-4">{{ .name | markdownify }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ with .Params.bio }}
|
||||
<div class="py-8 text-lg leading-normal">
|
||||
{{ . | markdownify }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="md:ms-8 flex items-end justify-center md:flex-col">
|
||||
{{ $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. Please use 'iconPack' instead." $.File.Path }}
|
||||
{{ end }}
|
||||
{{ $iconPack := .iconPack | default .icon_pack }}
|
||||
{{/* Deprecation warning(v1.0.0) ends */}}
|
||||
{{ $src := print $iconPack " fa-" .icon }}
|
||||
<div class="mx-2 mb-2 mt-4 md:mx-0 md:mt-2">
|
||||
<a href="{{ .url }}"><i class="{{ print $src }}"></i></a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="prose">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
1
layouts/partials/widgets/blank.html
Normal file
1
layouts/partials/widgets/blank.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ .Content }}
|
||||
30
layouts/partials/widgets/experience.html
Normal file
30
layouts/partials/widgets/experience.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{{ range .Params.experiences }}
|
||||
<div class="mb-6">
|
||||
<div
|
||||
class="bg-secondary-bg prose dark:border-tertiary-bg rounded border p-6 transition duration-200 ease-in-out hover:shadow-lg"
|
||||
>
|
||||
<h3 class="">{{ .title }}</h3>
|
||||
<div class="flex flex-col md:flex-row md:justify-between">
|
||||
<div>
|
||||
{{ if .organization.url }}
|
||||
<a href="{{ .organization.url }}" class="no-underline">
|
||||
{{ .organization.name | markdownify }}
|
||||
</a>
|
||||
{{ else }}
|
||||
<span>{{ .organization.name | markdownify }}</span>
|
||||
{{ end }}
|
||||
|
||||
{{ if and .organization.name .location }}
|
||||
<span class="ms-2 me-2">·</span>
|
||||
{{ end }}
|
||||
|
||||
|
||||
<span>{{ .location | markdownify }} </span>
|
||||
</div>
|
||||
<div class="shrink-0">{{ .dates | markdownify }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5">{{ .writeup | markdownify }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
52
layouts/partials/widgets/pages.html
Normal file
52
layouts/partials/widgets/pages.html
Normal file
@@ -0,0 +1,52 @@
|
||||
{{ 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">
|
||||
{{ partial "widgets/pages-readmore" . }}
|
||||
</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">
|
||||
{{ partial "widgets/pages-readmore" . }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "partials/widgets/pages-masonry" }}
|
||||
<div class="pb-2 text-right hover:text-eureka">
|
||||
{{ partial "widgets/pages-readmore" . }}
|
||||
</div>
|
||||
{{ $pages := partial "widgets/pages-get" . }}
|
||||
{{ partial "components/summary-list-masonry" $pages }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "partials/widgets/pages-readmore" }}
|
||||
{{- $section := .Site.GetPage .Params.section }}
|
||||
<a href="{{ $section.Permalink }}" class="font-semibold">{{ i18n "readMore" }}</a>
|
||||
<i class='fas {{ cond (eq .Site.Language.LanguageDirection "rtl") "fa-caret-left" "fa-caret-right" }} ms-1'></i>
|
||||
{{ end }}
|
||||
21
layouts/partials/widgets/vintage.html
Normal file
21
layouts/partials/widgets/vintage.html
Normal file
@@ -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>
|
||||
Reference in New Issue
Block a user