summaryrefslogtreecommitdiff
path: root/themes/CodeIT/layouts
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2021-08-29 11:48:16 +0200
committerChristoph Cullmann <cullmann@kde.org>2021-08-29 11:48:16 +0200
commit0321812a29e6ec32663556fa7abe2bf2880e5762 (patch)
treeabe0294bd63c046d2b5a164d987d67a64db2c2f6 /themes/CodeIT/layouts
parentf2375511935010a1aeee5683c30b3efb928bef2e (diff)
update to https://github.com/sunt-programator/CodeIT/releases/tag/v0.2.0
Diffstat (limited to 'themes/CodeIT/layouts')
-rw-r--r--themes/CodeIT/layouts/_default/baseof.html3
-rw-r--r--themes/CodeIT/layouts/_default/single.html29
-rw-r--r--themes/CodeIT/layouts/index.rss.xml2
-rw-r--r--themes/CodeIT/layouts/partials/comment.html41
-rw-r--r--themes/CodeIT/layouts/partials/function/content.html26
-rw-r--r--themes/CodeIT/layouts/partials/home/profile.html7
-rw-r--r--themes/CodeIT/layouts/partials/plugin/share.html7
-rw-r--r--themes/CodeIT/layouts/partials/rss/item.html15
-rw-r--r--themes/CodeIT/layouts/posts/rss.xml2
-rw-r--r--themes/CodeIT/layouts/posts/single.html11
-rw-r--r--themes/CodeIT/layouts/shortcodes/mapbox.html7
-rw-r--r--themes/CodeIT/layouts/taxonomy/rss.xml2
12 files changed, 129 insertions, 23 deletions
diff --git a/themes/CodeIT/layouts/_default/baseof.html b/themes/CodeIT/layouts/_default/baseof.html
index 4303015..804bb28 100644
--- a/themes/CodeIT/layouts/_default/baseof.html
+++ b/themes/CodeIT/layouts/_default/baseof.html
@@ -18,7 +18,8 @@
<body header-desktop="{{ .Site.Params.header.desktopMode }}" header-mobile="{{ .Site.Params.header.mobileMode }}">
{{- /* Check theme isDark before body rendering */ -}}
{{- $theme := .Site.Params.defaulttheme -}}
- <script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>
+ {{- $cookieConsentEnabled := .Site.Params.cookieconsent.enable -}}
+ <script type="text/javascript">('{{ $cookieConsentEnabled }}' === 'true' && window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>
<div id="mask"></div>
diff --git a/themes/CodeIT/layouts/_default/single.html b/themes/CodeIT/layouts/_default/single.html
index a34e22b..8861185 100644
--- a/themes/CodeIT/layouts/_default/single.html
+++ b/themes/CodeIT/layouts/_default/single.html
@@ -2,6 +2,22 @@
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}
+
+ {{- $toc := $params.toc -}}
+ {{- if eq $toc true -}}
+ {{- $toc = .Site.Params.page.toc | default dict -}}
+ {{- else if eq $toc false -}}
+ {{- $toc = dict "enable" false -}}
+ {{- end -}}
+
+ {{- /* Auto TOC */ -}}
+ {{- if ne $toc.enable false -}}
+ <div class="toc" id="toc-auto">
+ <h2 class="toc-title">{{ T "contents" }}</h2>
+ <div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}" id="toc-content-auto"></div>
+ </div>
+ {{- end -}}
+
<div class="page single special">
{{- /* Title */ -}}
<h1 class="single-title animated pulse faster">
@@ -13,6 +29,19 @@
<h2 class="single-subtitle">{{ . }}</h2>
{{- end -}}
+ {{- /* Static TOC */ -}}
+ {{- if ne $toc.enable false -}}
+ <div class="details toc" id="toc-static" kept="{{ if $toc.keepStatic }}true{{ end }}">
+ <div class="details-summary toc-title">
+ <span>{{ T "contents" }}</span>
+ <span><i class="details-icon fas fa-angle-right"></i></span>
+ </div>
+ <div class="details-content toc-content" id="toc-content-static">
+ {{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
+ </div>
+ </div>
+ {{- end -}}
+
{{- /* Content */ -}}
<div class="content" id="content">
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
diff --git a/themes/CodeIT/layouts/index.rss.xml b/themes/CodeIT/layouts/index.rss.xml
index 355c26a..137d7e2 100644
--- a/themes/CodeIT/layouts/index.rss.xml
+++ b/themes/CodeIT/layouts/index.rss.xml
@@ -1,4 +1,4 @@
-<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
+<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title>
{{- .Site.Title -}}
diff --git a/themes/CodeIT/layouts/partials/comment.html b/themes/CodeIT/layouts/partials/comment.html
index 0382ae1..f977957 100644
--- a/themes/CodeIT/layouts/partials/comment.html
+++ b/themes/CodeIT/layouts/partials/comment.html
@@ -124,6 +124,47 @@
Please enable JavaScript to view the comments powered by <a href="https://utteranc.es/">Utterances</a>.
</noscript>
{{- end -}}
+
+ {{- /* Waline Comment System */ -}}
+ {{- $waline := $comment.waline | default dict -}}
+ {{- if $waline.enable -}}
+ <div id="waline"></div>
+ {{- $source := $cdn.walineJS | default "/lib/waline/Waline.min.js" -}}
+ {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
+ <script src='{{ $source }}'></script>
+ <script>
+ Waline({
+ el: '#waline',
+ serverURL: '{{ $waline.serverURL }}',
+ visitor: '{{ $waline.visitor }}',
+ dark: '{{ $waline.dark }}',
+ });
+ </script>
+ <noscript>
+ Please enable JavaScript to view the comments powered by <a href="https://waline.js.org/">Waline</a>.
+ </noscript>
+ {{- end -}}
+
+ {{- /* Twikoo Comment System */ -}}
+ {{- $twikoo := $comment.twikoo | default dict -}}
+ {{- if $twikoo.enable -}}
+ <div id="twikoo"></div>
+ {{- $source := $cdn.twikooJS | default "/lib/twikoo/twikoo.all.min.js" -}}
+ {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
+ <script src='{{ $source }}'></script>
+ <script>
+ twikoo.init({
+ envId: '{{ $twikoo.evnId }}',
+ el: '#twikoo',
+ // region: 'ap-guangzhou',
+ // path: 'window.location.pathname',
+ })
+ </script>
+ <noscript>
+ Please enable JavaScript to view the comments powered by <a href="https://twikoo.js.org/">Twikoo</a>.
+ </noscript>
+ {{- end -}}
+
</div>
{{- end -}}
diff --git a/themes/CodeIT/layouts/partials/function/content.html b/themes/CodeIT/layouts/partials/function/content.html
index f1d7ce8..250a5b7 100644
--- a/themes/CodeIT/layouts/partials/function/content.html
+++ b/themes/CodeIT/layouts/partials/function/content.html
@@ -1,19 +1,23 @@
{{- $content := .Content -}}
-{{- if .Ruby -}}
- {{- $content = partial "function/ruby.html" $content -}}
-{{- end -}}
+{{- if $content -}}
-{{- if .Fraction -}}
- {{- $content = partial "function/fraction.html" $content -}}
-{{- end -}}
+ {{- if .Ruby -}}
+ {{- $content = partial "function/ruby.html" $content -}}
+ {{- end -}}
-{{- if .Fontawesome -}}
- {{- $content = partial "function/fontawesome.html" $content -}}
-{{- end -}}
+ {{- if .Fraction -}}
+ {{- $content = partial "function/fraction.html" $content -}}
+ {{- end -}}
-{{- $content = partial "function/checkbox.html" $content -}}
+ {{- if .Fontawesome -}}
+ {{- $content = partial "function/fontawesome.html" $content -}}
+ {{- end -}}
-{{- $content = partial "function/escape.html" $content -}}
+ {{- $content = partial "function/checkbox.html" $content -}}
+
+ {{- $content = partial "function/escape.html" $content -}}
+
+{{- end -}}
{{- return $content -}}
diff --git a/themes/CodeIT/layouts/partials/home/profile.html b/themes/CodeIT/layouts/partials/home/profile.html
index 7a573ae..ba2462e 100644
--- a/themes/CodeIT/layouts/partials/home/profile.html
+++ b/themes/CodeIT/layouts/partials/home/profile.html
@@ -7,16 +7,17 @@
{{- if $avatar -}}
<div class="home-avatar">
{{- $menus := $.Site.Menus.main | default slice -}}
+ {{- $avatarAlt := $profile.avatarAlt | default .Site.Author.name -}}
{{- with index $menus 0 -}}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
- {{- dict "Src" $avatar | partial "plugin/image.html" -}}
+ {{- dict "Src" $avatar "Alt" $avatarAlt | partial "plugin/image.html" -}}
</a>
{{- else -}}
- {{- dict "Src" $avatar | partial "plugin/image.html" -}}
+ {{- dict "Src" $avatar "Alt" $avatarAlt | partial "plugin/image.html" -}}
{{- end -}}
</div>
{{- end -}}
@@ -34,7 +35,7 @@
<div id="{{ $id }}" class="typeit"></div>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
- {{- . -}}
+ {{- . | safeHTML -}}
{{- end -}}
</h2>
{{- end -}}
diff --git a/themes/CodeIT/layouts/partials/plugin/share.html b/themes/CodeIT/layouts/partials/plugin/share.html
index 941647c..3273f9f 100644
--- a/themes/CodeIT/layouts/partials/plugin/share.html
+++ b/themes/CodeIT/layouts/partials/plugin/share.html
@@ -196,4 +196,11 @@
{{- dict "Class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
+
+ {{- /* 029: Telegram */ -}}
+ {{- if $share.Telegram -}}
+ <a href="javascript:void(0);" title="{{ T `shareOn` }} Telegram" data-sharer="telegram" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
+ {{- dict "Class" "fab fa-telegram-plane fa-fw" | partial "plugin/icon.html" -}}
+ </a>
+ {{- end -}}
{{- end -}}
diff --git a/themes/CodeIT/layouts/partials/rss/item.html b/themes/CodeIT/layouts/partials/rss/item.html
index 28256b4..64da953 100644
--- a/themes/CodeIT/layouts/partials/rss/item.html
+++ b/themes/CodeIT/layouts/partials/rss/item.html
@@ -1,4 +1,4 @@
-{{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Author.name) -}}
+{{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Author.name "email" .Site.Author.email) -}}
<item>
<title>
{{- .Page.Title -}}
@@ -9,9 +9,16 @@
<pubDate>
{{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate>
- <author>
- {{- .params.author | default (T "author") -}}
- </author>
+ {{- with $params.email -}}
+ <author>
+ {{- $params.email -}}
+ </author>
+ {{- end -}}
+ {{- with $params.author -}}
+ <dc:creator>
+ {{- $params.author -}}
+ </dc:creator>
+ {{- end -}}
<guid>
{{- .Page.Permalink -}}
</guid>
diff --git a/themes/CodeIT/layouts/posts/rss.xml b/themes/CodeIT/layouts/posts/rss.xml
index 454cdec..3231bd4 100644
--- a/themes/CodeIT/layouts/posts/rss.xml
+++ b/themes/CodeIT/layouts/posts/rss.xml
@@ -1,4 +1,4 @@
-<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
+<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title>
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}}
diff --git a/themes/CodeIT/layouts/posts/single.html b/themes/CodeIT/layouts/posts/single.html
index 8f788a2..3eab250 100644
--- a/themes/CodeIT/layouts/posts/single.html
+++ b/themes/CodeIT/layouts/posts/single.html
@@ -60,6 +60,17 @@
<i class="far fa-eye fa-fw"></i>&nbsp;<span class=leancloud-visitors-count></span>&nbsp;{{ T "views" }}
</span>&nbsp;
{{- end -}}
+ {{- if $comment.enable | and $comment.waline.enable | and $comment.waline.visitor -}}
+ <span id="{{ .RelPermalink }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
+ <i class="far fa-eye fa-fw"></i>&nbsp;<span class=leancloud-visitors-count></span>&nbsp;{{ T "views" }}
+ </span>&nbsp;
+ <a href="#comments" id="post-meta-vcount" title="{{ T `viewComments` }}">
+ <i class="fas fa-comment fa-fw"></i>&nbsp;<span id="{{ .RelPermalink }}" class="waline-comment-count"></span>&nbsp;条评论
+ </a>
+ {{- end -}}
+ {{- if $comment.enable | and $comment.twikoo.enable -}}
+ <i class="far fa-eye fa-fw"></i>&nbsp;<span id="twikoo_visitors">0</span>&nbsp;{{ T "views" }}
+ {{- end -}}
</div>
</div>
diff --git a/themes/CodeIT/layouts/shortcodes/mapbox.html b/themes/CodeIT/layouts/shortcodes/mapbox.html
index 516d370..5ae9d76 100644
--- a/themes/CodeIT/layouts/shortcodes/mapbox.html
+++ b/themes/CodeIT/layouts/shortcodes/mapbox.html
@@ -12,6 +12,7 @@
{{- $fullscreen := $mapbox.fullscreen -}}
{{- $width := "100%" -}}
{{- $height := "20rem" -}}
+{{- $properties := "" -}}
{{- if .IsNamedParams -}}
{{- $lightStyle = .Get "light-style" | default $lightStyle -}}
@@ -22,12 +23,16 @@
{{- $fullscreen = .Get "fullscreen" | ne false | and $fullscreen -}}
{{- $width = .Get "width" | default $width -}}
{{- $height = .Get "height" | default $height -}}
+ {{- $properties = .Get "properties" | default "" -}}
{{- else -}}
{{- $lightStyle = .Get 4 | default $lightStyle -}}
{{- $darkStyle = .Get 5 | default $darkStyle -}}
{{- end -}}
+
+{{- $optionsJson := getJSON $properties -}}
+
{{- $darkStyle = $darkStyle | default $lightStyle -}}
-{{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen -}}
+{{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen "optionsJson" $optionsJson -}}
{{- $id := dict "Content" $options "Scratch" .Page.Scratch | partial "function/id.html" -}}
<div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
{{- .Page.Scratch.SetInMap "this" "mapbox" true -}}
diff --git a/themes/CodeIT/layouts/taxonomy/rss.xml b/themes/CodeIT/layouts/taxonomy/rss.xml
index a597e56..45263a5 100644
--- a/themes/CodeIT/layouts/taxonomy/rss.xml
+++ b/themes/CodeIT/layouts/taxonomy/rss.xml
@@ -1,4 +1,4 @@
-<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
+<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title>
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}