use maintained theme
This commit is contained in:
parent
640572ecab
commit
0c7cb4486a
1779 changed files with 41468 additions and 26258 deletions
19
themes/CodeIT/layouts/404.html
Normal file
19
themes/CodeIT/layouts/404.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{{- define "title" }}
|
||||
{{- T "pageNotFound" | printf "404 %v" }} - {{ .Site.Title -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
<div class="page" id="content-404">
|
||||
<h1 id="error-emoji"></h1>
|
||||
<p class="error-text">
|
||||
{{- T "pageNotFoundText" -}}
|
||||
<a href="javascript:void(0);" title="{{ T `back` }}" onclick="window.history.back();"><i class="far fa-hand-point-left fa-fw"></i></a>
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var emojiArray = ['\\(o_o)/', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)','(=\'X\'=)', '(>_<)', '(;-;)'];
|
||||
document.getElementById('error-emoji').appendChild(document.createTextNode(emojiArray[Math.floor(Math.random() * emojiArray.length)]));
|
||||
})();
|
||||
</script>
|
||||
{{- end -}}
|
10
themes/CodeIT/layouts/_default/_markup/render-image.html
Normal file
10
themes/CodeIT/layouts/_default/_markup/render-image.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{{- if .Title -}}
|
||||
<figure>
|
||||
{{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- .Title | safeHTML -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
{{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
6
themes/CodeIT/layouts/_default/_markup/render-link.html
Normal file
6
themes/CodeIT/layouts/_default/_markup/render-link.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{- $destination := .Destination -}}
|
||||
{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "Destination" $destination "Title" .Title "Content" .Text -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
51
themes/CodeIT/layouts/_default/baseof.html
Normal file
51
themes/CodeIT/layouts/_default/baseof.html
Normal file
|
@ -0,0 +1,51 @@
|
|||
{{- partial "init.html" . -}}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.LanguageCode }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="robots" content="noodp" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
|
||||
<title>
|
||||
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
|
||||
</title>
|
||||
|
||||
{{- partial "head/meta.html" . -}}
|
||||
{{- partial "head/link.html" . -}}
|
||||
{{- partial "head/seo.html" . -}}
|
||||
</head>
|
||||
<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>
|
||||
|
||||
<div id="mask"></div>
|
||||
|
||||
{{- /* Body wrapper */ -}}
|
||||
<div class="wrapper">
|
||||
{{- partial "header.html" . -}}
|
||||
<main class="main">
|
||||
<div class="container">
|
||||
{{- block "content" . }}{{ end -}}
|
||||
</div>
|
||||
</main>
|
||||
{{- partial "footer.html" . -}}
|
||||
</div>
|
||||
|
||||
<div id="fixed-buttons">
|
||||
{{- /* top button */ -}}
|
||||
<a href="#" id="back-to-top" class="fixed-button" title="{{ T `backToTop` }}">
|
||||
<i class="fas fa-arrow-up fa-fw"></i>
|
||||
</a>
|
||||
|
||||
{{- /* comment button */ -}}
|
||||
<a href="#" id="view-comments" class="fixed-button" title="{{ T `viewComments` }}">
|
||||
<i class="fas fa-comment fa-fw"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{{- /* Load JavaScript scripts and CSS */ -}}
|
||||
{{- partial "assets.html" . -}}
|
||||
</body>
|
||||
</html>
|
36
themes/CodeIT/layouts/_default/section.html
Normal file
36
themes/CodeIT/layouts/_default/section.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{- define "title" }}
|
||||
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
<div class="page archive">
|
||||
{{- /* Title */ -}}
|
||||
<h2 class="single-title animated pulse faster">
|
||||
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" -}}
|
||||
</h2>
|
||||
|
||||
{{- /* Paginate */ -}}
|
||||
{{- if .Pages -}}
|
||||
{{- $pages := .Pages.GroupByDate "2006" -}}
|
||||
{{- with .Site.Params.section.paginate | default .Site.Params.paginate -}}
|
||||
{{- $pages = $.Paginate $pages . -}}
|
||||
{{- else -}}
|
||||
{{- $pages = .Paginate $pages -}}
|
||||
{{- end -}}
|
||||
{{- range $pages.PageGroups -}}
|
||||
<h3 class="group-title">{{ .Key }}</h3>
|
||||
{{- range .Pages -}}
|
||||
<article class="archive-item">
|
||||
<a href="{{ .RelPermalink }}" class="archive-item-link">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
<span class="archive-item-date">
|
||||
{{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}}
|
||||
</span>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- partial "paginator.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
24
themes/CodeIT/layouts/_default/single.html
Normal file
24
themes/CodeIT/layouts/_default/single.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
<div class="page single special">
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title animated pulse faster">
|
||||
{{- .Title -}}
|
||||
</h1>
|
||||
|
||||
{{- /* Subtitle */ -}}
|
||||
{{- with $params.subtitle -}}
|
||||
<h2 class="single-subtitle">{{ . }}</h2>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Content */ -}}
|
||||
<div class="content" id="content">
|
||||
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
</div>
|
||||
|
||||
{{- /* Comment */ -}}
|
||||
{{- partial "comment.html" . -}}
|
||||
</div>
|
||||
{{- end -}}
|
3
themes/CodeIT/layouts/_default/single.md
Normal file
3
themes/CodeIT/layouts/_default/single.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# {{ .Title }}
|
||||
|
||||
{{ .RawContent }}
|
75
themes/CodeIT/layouts/_default/summary.html
Normal file
75
themes/CodeIT/layouts/_default/summary.html
Normal file
|
@ -0,0 +1,75 @@
|
|||
{{- $params := .Params | merge .Site.Params.page -}}
|
||||
|
||||
<article class="single summary" itemscope itemtype="http://schema.org/Article">
|
||||
{{- /* Featured image */ -}}
|
||||
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}}
|
||||
{{- with .Resources.GetMatch "featured-image" -}}
|
||||
{{- $image = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- with .Resources.GetMatch "featured-image-preview" -}}
|
||||
{{- $image = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- with $image -}}
|
||||
<div class="featured-image-preview">
|
||||
<a href="{{ $.RelPermalink }}">
|
||||
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title" itemprop="name headline">
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</h1>
|
||||
|
||||
{{- /* Meta */ -}}
|
||||
<div class="post-meta">
|
||||
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
|
||||
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
|
||||
<span class="post-author">
|
||||
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
</span>
|
||||
|
||||
{{- with .Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format -}}
|
||||
<span class="post-publish">
|
||||
{{- printf `<time datetime="%v">%v</time>` . . | dict "Date" | T "publishedOnDate" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- $categories := slice -}}
|
||||
{{- range .Params.categories -}}
|
||||
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
||||
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
|
||||
{{- end -}}
|
||||
{{- with delimit $categories " " -}}
|
||||
<span class="post-category">
|
||||
{{- dict "Categories" . | T "includedInCategories" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Summary content */ -}}
|
||||
<div class="content">
|
||||
{{- with .Summary -}}
|
||||
{{- dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- .Description | safeHTML -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Footer */ -}}
|
||||
<div class="post-footer">
|
||||
<a href="{{ .RelPermalink }}">{{ T "readMore" }}</a>
|
||||
{{- with .Params.tags -}}
|
||||
<div class="post-tags">
|
||||
<i class="fas fa-tags fa-fw"></i>
|
||||
{{- range $index, $value := . -}}
|
||||
{{- if gt $index 0 }}, {{ end -}}
|
||||
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
|
||||
<a href="{{ $tag.RelPermalink }}">{{ $tag.Title }}</a>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</article>
|
41
themes/CodeIT/layouts/index.html
Normal file
41
themes/CodeIT/layouts/index.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
{{- define "content" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $profile := .Site.Params.home.profile -}}
|
||||
{{- $posts := .Site.Params.home.posts -}}
|
||||
|
||||
<div class="page home"{{ if ne $posts.enable false }} posts{{ end }}>
|
||||
{{- /* Profile */ -}}
|
||||
{{- if ne $profile.enable false -}}
|
||||
{{- partial "home/profile.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Content */ -}}
|
||||
{{- if .Content -}}
|
||||
<div class="single">
|
||||
<div class="content" id="content">
|
||||
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Posts */ -}}
|
||||
{{- if ne $posts.enable false | and .Site.RegularPages -}}
|
||||
{{- /* Paginate */ -}}
|
||||
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
|
||||
{{- if .Site.Params.page.hiddenFromHomePage -}}
|
||||
{{- $pages = where $pages "Params.hiddenfromhomepage" false -}}
|
||||
{{- else -}}
|
||||
{{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}}
|
||||
{{- end -}}
|
||||
{{- with $posts.paginate | default .Site.Params.paginate -}}
|
||||
{{- $pages = $.Paginate $pages . -}}
|
||||
{{- else -}}
|
||||
{{- $pages = .Paginate $pages -}}
|
||||
{{- end -}}
|
||||
{{- range $pages.Pages -}}
|
||||
{{- .Render "summary" -}}
|
||||
{{- end -}}
|
||||
{{- partial "paginator.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
46
themes/CodeIT/layouts/index.json
Normal file
46
themes/CodeIT/layouts/index.json
Normal file
|
@ -0,0 +1,46 @@
|
|||
{{- if .Site.Params.search -}}
|
||||
{{- $index := slice -}}
|
||||
{{- $pages := .Site.RegularPages -}}
|
||||
{{- if .Site.Params.page.hiddenFromSearch -}}
|
||||
{{- $pages = where $pages "Params.hiddenfromsearch" false -}}
|
||||
{{- else -}}
|
||||
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
|
||||
{{- end -}}
|
||||
{{- range $pages -}}
|
||||
{{- $uri := .RelPermalink -}}
|
||||
{{- if $.Site.Params.search.absoluteURL -}}
|
||||
{{- $uri = .Permalink -}}
|
||||
{{- end -}}
|
||||
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories -}}
|
||||
{{- $meta = $.Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format | dict "date" | merge $meta -}}
|
||||
{{- with .Description -}}
|
||||
{{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}}
|
||||
{{- end -}}
|
||||
{{- $params := .Params | merge $.Site.Params.page -}}
|
||||
{{/* Extended Markdown syntax */}}
|
||||
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
|
||||
{{/* Remove line number for code */}}
|
||||
{{- $content = $content | replaceRE `<span class="lnt?"> *\d*\n?</span>` "" -}}
|
||||
{{- range $i, $contenti := split $content "<h2 id=" -}}
|
||||
{{- if gt $i 0 -}}
|
||||
{{- $contenti = printf "<h2 id=%v" $contenti -}}
|
||||
{{- end -}}
|
||||
{{- range $j, $contentj := split $contenti "<h3 id=" -}}
|
||||
{{- if gt $j 0 -}}
|
||||
{{- $contentj = printf "<h3 id=%v" $contentj -}}
|
||||
{{- end -}}
|
||||
{{/* Plainify, unescape and remove (\n, \t) */}}
|
||||
{{- $contentj = $contentj | plainify | htmlUnescape | replaceRE `[\n\t ]+` " " -}}
|
||||
{{- if gt $.Site.Params.search.contentLength 0 -}}
|
||||
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}}
|
||||
{{- end -}}
|
||||
{{- if $contentj | and (ne $contentj " ") -}}
|
||||
{{- $one := printf "%v:%v:%v" $uri $i $j | dict "content" $contentj "objectID" | merge $meta -}}
|
||||
{{- $index = $index | append $one -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $index | jsonify | safeJS -}}
|
||||
{{- end -}}
|
43
themes/CodeIT/layouts/index.rss.xml
Normal file
43
themes/CodeIT/layouts/index.rss.xml
Normal file
|
@ -0,0 +1,43 @@
|
|||
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
|
||||
<channel>
|
||||
<title>
|
||||
{{- .Site.Title -}}
|
||||
</title>
|
||||
<link>
|
||||
{{- .Permalink -}}
|
||||
</link>
|
||||
<description>
|
||||
{{- .Site.Params.description | default .Site.Title -}}
|
||||
</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
{{- with .Site.LanguageCode -}}
|
||||
<language>
|
||||
{{- . -}}
|
||||
</language>
|
||||
{{- end -}}
|
||||
{{- with .Site.Author.email -}}
|
||||
<managingEditor>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</managingEditor>
|
||||
<webMaster>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</webMaster>
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
<copyright>
|
||||
{{- . -}}
|
||||
</copyright>
|
||||
{{- end -}}
|
||||
{{- if not .Date.IsZero -}}
|
||||
<lastBuildDate>
|
||||
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
|
||||
</lastBuildDate>
|
||||
{{- end -}}
|
||||
{{ with .OutputFormats.Get "RSS" }}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end }}
|
||||
{{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}}
|
||||
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
|
||||
{{- end -}}
|
||||
</channel>
|
||||
</rss>
|
207
themes/CodeIT/layouts/partials/assets.html
Normal file
207
themes/CodeIT/layouts/partials/assets.html
Normal file
|
@ -0,0 +1,207 @@
|
|||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $config := (.Scratch.Get "this").config -}}
|
||||
|
||||
{{- /* Smooth Scroll */ -}}
|
||||
{{- $source := $cdn.smoothScrollJS | default "lib/smooth-scroll/smooth-scroll.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* Search */ -}}
|
||||
{{- if .Site.Params.search | and .Site.Params.search.enable -}}
|
||||
{{- $search := .Site.Params.search -}}
|
||||
{{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "noResultsFound") | dict "search" | merge $config -}}
|
||||
{{- if eq $search.type "lunr" -}}
|
||||
{{- with .Site.Home.OutputFormats.Get "json" -}}
|
||||
{{- $config = dict "type" "lunr" "lunrIndexURL" .RelPermalink | dict "search" | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- $source := $cdn.lunrJS | default "lib/lunr/lunr.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- if T "lunrLanguageLib" -}}
|
||||
{{- $config = T "lunrLanguageCode" | dict "lunrLanguageCode" | dict "search" | merge $config -}}
|
||||
{{- with T "lunrSegmentitLib" -}}
|
||||
{{- $config = dict "lunrSegmentitURL" (resources.Get .).RelPermalink | dict "search" | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" "lib/lunr/lunr.stemmer.support.js" "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" (T "lunrLanguageLib") "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- else if eq $search.type "algolia" -}}
|
||||
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* lazysizes */ -}}
|
||||
{{- $source := $cdn.lazysizesJS | default "lib/lazysizes/lazysizes.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* twemoji */ -}}
|
||||
{{- if $params.twemoji -}}
|
||||
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "twemoji" true | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* lightgallery.js */ -}}
|
||||
{{- if $params.lightgallery -}}
|
||||
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/lightgallery.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/lg-thumbnail.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/lg-zoom.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false | dict "lightGallery" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $code := $params.code | default dict -}}
|
||||
{{- $config = cond (ne $code.maxShownLines nil) $code.maxShownLines 10 | dict "maxShownLines" | dict "code" | merge $config -}}
|
||||
|
||||
{{- /* clipboard.js */ -}}
|
||||
{{- if ne $code.copy false -}}
|
||||
{{- $source := $cdn.clipboardJS | default "lib/clipboard/clipboard.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = T "copyToClipboard" | dict "copyTitle" | dict "code" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Sharer.js */ -}}
|
||||
{{- if $params.share.enable -}}
|
||||
{{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* TypeIt */ -}}
|
||||
{{- with (.Scratch.Get "this").typeitMap -}}
|
||||
{{- $typeit := $.Site.Params.typeit -}}
|
||||
{{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* KaTeX */ -}}
|
||||
{{- $math := $params.math -}}
|
||||
{{- if eq $math true -}}
|
||||
{{- $math = .Site.Params.page.math | default dict -}}
|
||||
{{- else if eq $math false -}}
|
||||
{{- $math = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
{{- if $math.enable -}}
|
||||
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- if $math.copyTex -}}
|
||||
{{- $source := $cdn.katexCopyTexCSS | default "lib/katex/copy-tex.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- if $math.mhchem -}}
|
||||
{{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}}
|
||||
{{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" $math.blockLeftDelimiter "right" $math.blockRightDelimiter "display" true) -}}
|
||||
{{- end -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" "$" "right" "$" "display" false) (dict "left" "\\(" "right" "\\)" "display" false) -}}
|
||||
{{- if and $math.inlineLeftDelimiter $math.inlineRightDelimiter -}}
|
||||
{{- $delimiters = $delimiters | append (dict "left" $math.inlineRightDelimiter "right" $math.inlineRightDelimiter "display" false) -}}
|
||||
{{- end -}}
|
||||
{{- $config = dict "strict" false "delimiters" $delimiters | dict "math" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* mermaid */ -}}
|
||||
{{- if (.Scratch.Get "this").mermaid -}}
|
||||
{{- $source := $cdn.mermaidJS | default "lib/mermaid/mermaid.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $options := dict "targetPath" "lib/mermaid/mermaid.min.css" "enableSourceMap" true -}}
|
||||
{{- dict "Source" "lib/mermaid/mermaid.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* ECharts */ -}}
|
||||
{{- if (.Scratch.Get "this").echarts -}}
|
||||
{{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $source := $cdn.echartsMacaronsJS | default "lib/echarts/macarons.js" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Mapbox GL */ -}}
|
||||
{{- if (.Scratch.Get "this").mapbox -}}
|
||||
{{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Music */ -}}
|
||||
{{- if (.Scratch.Get "this").music -}}
|
||||
{{- /* APlayer */ -}}
|
||||
{{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}}
|
||||
{{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* MetingJS */ -}}
|
||||
{{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Cookie Consent */ -}}
|
||||
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
|
||||
{{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}}
|
||||
{{- $cookieconsentConfig = .Site.Params.cookieconsent | merge $cookieconsentConfig -}}
|
||||
{{- $cookieconsentConfig = dict "message" ($cookieconsentConfig.content.message | default (T "cookieconsentMessage")) "dismiss" ($cookieconsentConfig.content.dismiss | default (T "cookieconsentDismiss")) "link" ($cookieconsentConfig.content.link | default (T "cookieconsentLink")) | dict "content" | merge $cookieconsentConfig -}}
|
||||
{{- $config = $cookieconsentConfig | dict "cookieconsent" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.css -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $params.library.js -}}
|
||||
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with (.Scratch.Get "this").styleArr -}}
|
||||
{{- $content := delimit . "" -}}
|
||||
{{- $path := substr (md5 $content) 0 6 | printf "css/%v" -}}
|
||||
{{- $options := printf "%v.min.css" $path | dict "targetPath" -}}
|
||||
{{- dict "Content" $content "Path" (printf "%v.scss" $path) "ToCSS" $options | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Config script */ -}}
|
||||
{{- $config | jsonify | printf "window.config=%s;" | dict "Content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
|
||||
{{- /* Theme script */ -}}
|
||||
{{- dict "Source" "js/theme.min.js" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}}
|
||||
|
||||
{{- with (.Scratch.Get "this").scriptArr -}}
|
||||
{{- delimit . "\n" | dict "Content" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range (.Scratch.Get "this").style -}}
|
||||
{{- partial "plugin/style.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range (.Scratch.Get "this").script -}}
|
||||
{{- partial "plugin/script.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- partial "plugin/analytics.html" . -}}
|
130
themes/CodeIT/layouts/partials/comment.html
Normal file
130
themes/CodeIT/layouts/partials/comment.html
Normal file
|
@ -0,0 +1,130 @@
|
|||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
{{- $comment := .Scratch.Get "comment" | default dict -}}
|
||||
{{- $commentConfig := dict -}}
|
||||
|
||||
{{- if $comment.enable -}}
|
||||
<div id="comments">
|
||||
{{- /* Disqus Comment System */ -}}
|
||||
{{- $disqus := $comment.disqus | default dict -}}
|
||||
{{- if $disqus.enable -}}
|
||||
<div id="disqus_thread" class="comment"></div>
|
||||
{{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}}
|
||||
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript">Disqus</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Gitalk Comment System */ -}}
|
||||
{{- $gitalk := $comment.gitalk | default dict -}}
|
||||
{{- if $gitalk.enable -}}
|
||||
<div id="gitalk" class="comment"></div>
|
||||
{{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}}
|
||||
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk"></a>Gitalk</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Valine Comment System */ -}}
|
||||
{{- $valine := $comment.valine | default dict -}}
|
||||
{{- if $valine.enable -}}
|
||||
<div id="valine" class="comment"></div>
|
||||
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
|
||||
{{- dict "Source" "lib/valine/valine.scss" "ToCSS" $options | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
|
||||
{{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}}
|
||||
{{- with $valine.avatar -}}
|
||||
{{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}}
|
||||
{{- end -}}
|
||||
{{- with $valine.meta -}}
|
||||
{{- $commentConfig = dict "meta" . | dict "valine" | merge $commentConfig -}}
|
||||
{{- end -}}
|
||||
{{- with $valine.pageSize -}}
|
||||
{{- $commentConfig = dict "pageSize" . | dict "valine" | merge $commentConfig -}}
|
||||
{{- end -}}
|
||||
{{- with $valine.serverURLs -}}
|
||||
{{- $commentConfig = dict "serverURLs" . | dict "valine" | merge $commentConfig -}}
|
||||
{{- end -}}
|
||||
{{- $commentConfig = $valine.emoji | default "google.yml" | printf "data/emoji/%v" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://valine.js.org/">Valine</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Facebook Comment System */ -}}
|
||||
{{- $facebook := $comment.facebook | default dict -}}
|
||||
{{- if $facebook.enable -}}
|
||||
<div id="fb-root" class="comment"></div>
|
||||
<div
|
||||
class="fb-comments"
|
||||
data-href="{{ .Permalink }}"
|
||||
data-width="{{ $facebook.width }}"
|
||||
data-numposts="{{ $facebook.numPosts }}"
|
||||
></div>
|
||||
{{- $source := printf "https://connect.facebook.net/%v/sdk.js#xfbml=1&version=v5.0&appId=%v&autoLogAppEvents=1" ($facebook.languageCode | default (T "facebookLanguageCode")) $facebook.appId -}}
|
||||
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/"></a>Facebook</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Telegram Comments System */ -}}
|
||||
{{- $telegram := $comment.telegram | default dict -}}
|
||||
{{- if $telegram.enable -}}
|
||||
<div id="telegram-comments" class="comment"></div>
|
||||
{{- $attr := printf `data-comments-app-website="%v"` $telegram.siteID -}}
|
||||
{{- $attr = printf `%v data-limit="%v"` $attr ($telegram.limit | default 5) -}}
|
||||
{{- with $telegram.height -}}
|
||||
{{- $attr = printf `%v data-height="%v"` $attr . -}}
|
||||
{{- end -}}
|
||||
{{- with $telegram.color -}}
|
||||
{{- $attr = printf `%v data-color="%v"` $attr . -}}
|
||||
{{- end -}}
|
||||
{{- if $telegram.colorful -}}
|
||||
{{- $attr = printf `%v data-colorful="1"` $attr -}}
|
||||
{{- end -}}
|
||||
{{- if $telegram.dislikes -}}
|
||||
{{- $attr = printf `%v data-dislikes="1"` $attr -}}
|
||||
{{- end -}}
|
||||
{{- if $telegram.outlined -}}
|
||||
{{- $attr = printf `%v data-outlined="1"` $attr -}}
|
||||
{{- end -}}
|
||||
{{- dict "Source" "https://comments.app/js/widget.js?2" "Defer" true "Attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Commento Comment System */ -}}
|
||||
{{- $commento := $comment.commento | default dict -}}
|
||||
{{- if $commento.enable -}}
|
||||
<div id="commento"></div>
|
||||
{{- dict "Source" "https://cdn.commento.io/js/commento.js" "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Utterances Comment System */ -}}
|
||||
{{- $utterances := $comment.utterances | default dict -}}
|
||||
{{- if $utterances.enable -}}
|
||||
<div id="utterances"></div>
|
||||
{{- $commentConfig = dict "repo" $utterances.repo | dict "utterances" | merge $commentConfig -}}
|
||||
{{- $commentConfig = $utterances.issueTerm | default "pathname" | dict "issueTerm" | dict "utterances" | merge $commentConfig -}}
|
||||
{{- $commentConfig = dict "label" $utterances.label | dict "utterances" | merge $commentConfig -}}
|
||||
{{- $commentConfig = $utterances.lightTheme | default "github-light" | dict "lightTheme" | dict "utterances" | merge $commentConfig -}}
|
||||
{{- $commentConfig = $utterances.darkTheme | default "github-dark" | dict "darkTheme" | dict "utterances" | merge $commentConfig -}}
|
||||
<noscript>
|
||||
Please enable JavaScript to view the comments powered by <a href="https://utteranc.es/">Utterances</a>.
|
||||
</noscript>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- dict "comment" $commentConfig | dict "config" | merge (.Scratch.Get "this") | .Scratch.Set "this" -}}
|
51
themes/CodeIT/layouts/partials/footer.html
Normal file
51
themes/CodeIT/layouts/partials/footer.html
Normal file
|
@ -0,0 +1,51 @@
|
|||
{{- if ne .Site.Params.footer.enable false -}}
|
||||
<footer class="footer">
|
||||
<div class="footer-container">
|
||||
{{- /* Custom Content */ -}}
|
||||
{{- with .Site.Params.footer.custom -}}
|
||||
<div class="footer-line">
|
||||
{{- safeHTML . -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Hugo and CodeIT */ -}}
|
||||
{{- if ne .Site.Params.footer.hugo false -}}
|
||||
<div class="footer-line">
|
||||
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener noreferrer" title="Hugo %v">Hugo</a>` hugo.Version -}}
|
||||
{{- $theme := .Scratch.Get "version" | printf `<a href="https://github.com/sunt-programator/CodeIT" target="_blank" rel="noopener noreferrer" title="CodeIT %v"><i class="fas fa-laptop-code fa-fw"></i> CodeIT</a>` -}}
|
||||
{{- dict "Hugo" $hugo "Theme" $theme | T "poweredBySome" | safeHTML }}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
<div class="footer-line">
|
||||
{{- /* Copyright year */ -}}
|
||||
{{- if ne .Site.Params.footer.copyright false -}}
|
||||
<i class="far fa-copyright fa-fw"></i>
|
||||
{{- with .Site.Params.footer.since -}}
|
||||
<span itemprop="copyrightYear">
|
||||
{{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}}
|
||||
</span>
|
||||
{{- else -}}
|
||||
<span itemprop="copyrightYear">{{ now.Year }}</span>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Author */ -}}
|
||||
{{- if ne .Site.Params.footer.author false -}}
|
||||
<span class="author" itemprop="copyrightHolder"> <a href="{{ $.Site.Author.link | default .Site.Home.RelPermalink }}" target="_blank" rel="noopener noreferrer">{{ .Site.Author.name }}</a></span>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* License */ -}}
|
||||
{{- with .Site.Params.footer.license -}}
|
||||
| <span class="license">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* ICP */ -}}
|
||||
{{- with .Site.Params.footer.icp -}}
|
||||
<span class="icp-splitter"> | </span><br class="icp-br"/>
|
||||
<span class="icp">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
{{- end -}}
|
9
themes/CodeIT/layouts/partials/function/checkbox.html
Normal file
9
themes/CodeIT/layouts/partials/function/checkbox.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{- /* Checkbox unchecked */ -}}
|
||||
{{- $old := `<input disabled="" type="checkbox">` -}}
|
||||
{{- $new := `<i class="far fa-square fa-fw"></i>` -}}
|
||||
{{- $content := replace . $old $new -}}
|
||||
|
||||
{{- /* Checkbox checked */ -}}
|
||||
{{- $old = `<input checked="" disabled="" type="checkbox">` -}}
|
||||
{{- $new = `<i class="far fa-check-square fa-fw"></i>` -}}
|
||||
{{- return replace $content $old $new -}}
|
19
themes/CodeIT/layouts/partials/function/content.html
Normal file
19
themes/CodeIT/layouts/partials/function/content.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{{- $content := .Content -}}
|
||||
|
||||
{{- if .Ruby -}}
|
||||
{{- $content = partial "function/ruby.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Fraction -}}
|
||||
{{- $content = partial "function/fraction.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Fontawesome -}}
|
||||
{{- $content = partial "function/fontawesome.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $content = partial "function/checkbox.html" $content -}}
|
||||
|
||||
{{- $content = partial "function/escape.html" $content -}}
|
||||
|
||||
{{- return $content -}}
|
5
themes/CodeIT/layouts/partials/function/escape.html
Normal file
5
themes/CodeIT/layouts/partials/function/escape.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{- /* Escape character */ -}}
|
||||
{{- /* {?X} -> X */ -}}
|
||||
{{- $REin := `\{\?(.)\}` -}}
|
||||
{{- $REout := `$1` -}}
|
||||
{{- return replaceRE $REin $REout . -}}
|
14
themes/CodeIT/layouts/partials/function/fontawesome.html
Normal file
14
themes/CodeIT/layouts/partials/function/fontawesome.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{{- /* Font Awesome */ -}}
|
||||
{{- /* :(far fa-circle): -> <i class="far fa-circle fa-fw"></i> */ -}}
|
||||
|
||||
{{- $REin := ` (:\([\w- ]+?\):)` -}}
|
||||
{{- $REout := ` $1` -}}
|
||||
{{- $content := replaceRE $REin $REout . -}}
|
||||
|
||||
{{- $REin = `(:\([\w- ]+?\):) ` -}}
|
||||
{{- $REout = `$1 ` -}}
|
||||
{{- $content = replaceRE $REin $REout . -}}
|
||||
|
||||
{{- $REin = `:\(([\w- ]+?)\):` -}}
|
||||
{{- $REout = `<i class="$1"></i>` -}}
|
||||
{{- return replaceRE $REin $REout $content -}}
|
5
themes/CodeIT/layouts/partials/function/fraction.html
Normal file
5
themes/CodeIT/layouts/partials/function/fraction.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{- /* Fraction */ -}}
|
||||
{{- /* [A]/[B] -> <sup>A</sup>/<sub>B</sub> */ -}}
|
||||
{{- $REin := `\[(.+?)\]/\[(.+?)\]` -}}
|
||||
{{- $REout := `<sup>$1</sup>/<sub>$2</sub>` -}}
|
||||
{{- return replaceRE $REin $REout . -}}
|
8
themes/CodeIT/layouts/partials/function/id.html
Normal file
8
themes/CodeIT/layouts/partials/function/id.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{{- /* ID */ -}}
|
||||
{{- $count := (.Scratch.Get "this").count | default 1 -}}
|
||||
{{- $id := printf "id-%d" $count -}}
|
||||
{{- $count | add 1 | .Scratch.SetInMap "this" "count" -}}
|
||||
{{- with .Content -}}
|
||||
{{- dict $id . | dict "data" | dict "config" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
|
||||
{{- end -}}
|
||||
{{- return $id -}}
|
3
themes/CodeIT/layouts/partials/function/path.html
Normal file
3
themes/CodeIT/layouts/partials/function/path.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{- /* https://discourse.gohugo.io/t/how-decode-urls-in-hugo/7549/4 */ -}}
|
||||
{{- $URL := . | urlize | urls.Parse -}}
|
||||
{{- return $URL.Path -}}
|
16
themes/CodeIT/layouts/partials/function/resource.html
Normal file
16
themes/CodeIT/layouts/partials/function/resource.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{{- $resource := 0 -}}
|
||||
{{- $url := urls.Parse .Path -}}
|
||||
{{- if not $url.Host | and $url.Path | and (strings.HasSuffix $url.Path "/" | not) -}}
|
||||
{{- if .Resources -}}
|
||||
{{- with .Resources.GetMatch $url.Path -}}
|
||||
{{- $resource = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not $resource -}}
|
||||
{{- with resources.Get $url.Path -}}
|
||||
{{- $resource = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $resource -}}
|
5
themes/CodeIT/layouts/partials/function/ruby.html
Normal file
5
themes/CodeIT/layouts/partials/function/ruby.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{- /* Ruby */ -}}
|
||||
{{- /* [EN]^(English) -> <strong><ruby>EN<rt>English</rt></ruby></strong> */ -}}
|
||||
{{- $REin := `\[(.+?)\]\^\((.+?)\)` -}}
|
||||
{{- $REout := `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
||||
{{- return replaceRE $REin $REout . -}}
|
51
themes/CodeIT/layouts/partials/head/link.html
Normal file
51
themes/CodeIT/layouts/partials/head/link.html
Normal file
|
@ -0,0 +1,51 @@
|
|||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
|
||||
{{- if not .Site.Params.app.noFavicon -}}
|
||||
{{- with .Site.Params.app.svgFavicon -}}
|
||||
<link rel="icon" href="{{ . }}">
|
||||
{{- else -}}
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
{{- end -}}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
{{- with .Site.Params.app.iconColor -}}
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="{{ . }}">
|
||||
{{- end -}}
|
||||
<link rel="manifest" href="/site.webmanifest">
|
||||
{{- end -}}
|
||||
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
{{- if .PrevInSection -}}
|
||||
<link rel="prev" href="{{ .PrevInSection.Permalink }}" />
|
||||
{{- end -}}
|
||||
{{- if .NextInSection -}}
|
||||
<link rel="next" href="{{ .NextInSection.Permalink }}" />
|
||||
{{- end -}}
|
||||
|
||||
{{- with .OutputFormats.Get "RSS" -}}
|
||||
<link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
|
||||
<link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
|
||||
{{- end -}}
|
||||
|
||||
{{- /* normalize.css */ -}}
|
||||
{{- $source := $cdn.normalizeCSS | default "lib/normalize/normalize.min.css" -}}
|
||||
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{- /* style.min.css */ -}}
|
||||
{{- $style := dict "Source" "css/style.scss" "Fingerprint" $fingerprint -}}
|
||||
{{- $options := dict "targetPath" "css/style.min.css" "enableSourceMap" true -}}
|
||||
{{- $style = dict "Context" . "ToCSS" $options | merge $style -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{- /* Font Awesome */ -}}
|
||||
{{- $source := $cdn.fontawesomeFreeCSS | default "lib/fontawesome-free/all.min.css" -}}
|
||||
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
{{- /* Animate.css */ -}}
|
||||
{{- $source := $cdn.animateCSS | default "lib/animate/animate.min.css" -}}
|
||||
{{- $style := dict "Source" $source "Fingerprint" $fingerprint -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
17
themes/CodeIT/layouts/partials/head/meta.html
Normal file
17
themes/CodeIT/layouts/partials/head/meta.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
<meta name="description" content="{{ $params.description | default .Site.Params.description }}">
|
||||
|
||||
{{- template "_internal/opengraph.html" . -}}
|
||||
{{- template "_internal/twitter_cards.html" . -}}
|
||||
|
||||
<meta name="application-name" content="{{ .Site.Params.app.title | default .Site.Title }}">
|
||||
<meta name="apple-mobile-web-app-title" content="{{ .Site.Params.app.title | default .Site.Title }}">
|
||||
|
||||
{{- with .Site.Params.app.themeColor -}}
|
||||
<meta name="theme-color" content="{{ . }}">
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Site.Params.app.tileColor -}}
|
||||
<meta name="msapplication-TileColor" content="{{ . }}">
|
||||
{{- end -}}
|
153
themes/CodeIT/layouts/partials/head/seo.html
Normal file
153
themes/CodeIT/layouts/partials/head/seo.html
Normal file
|
@ -0,0 +1,153 @@
|
|||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
{{- with .Site.Params.verification.google -}}
|
||||
<meta name="google-site-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.verification.bing -}}
|
||||
<meta name="msvalidate.01" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.verification.yandex -}}
|
||||
<meta name="yandex-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.verification.pinterest -}}
|
||||
<meta name="p:domain_verify" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.verification.baidu -}}
|
||||
<meta name="baidu-site-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Home SEO */ -}}
|
||||
{{- if .IsHome -}}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "WebSite",
|
||||
"url": "{{ .Permalink }}",
|
||||
{{- with .Site.LanguageCode -}}
|
||||
"inLanguage": "{{ . }}",
|
||||
{{- end -}}
|
||||
{{- with .Site.Author.name -}}
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": {{ . | safeHTML }}
|
||||
},
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.description -}}
|
||||
"description": {{ . | safeHTML }},
|
||||
{{- end -}}
|
||||
{{- $image := .Site.Params.seo.image -}}
|
||||
{{- with dict "Path" $image "Resources" .Resources | partial "function/resource.html" -}}
|
||||
"image": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ .Permalink }}",
|
||||
"width": {{ .Width }},
|
||||
"height": {{ .Height }}
|
||||
},
|
||||
{{- else -}}
|
||||
{{- with $image -}}
|
||||
"image": "{{ . | absURL }}",
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.seo.thumbnailUrl -}}
|
||||
{{- with dict "Path" . "Resources" $.Resources | partial "function/resource.html" -}}
|
||||
"thumbnailUrl": "{{ .Permalink }}",
|
||||
{{- else -}}
|
||||
"thumbnailUrl": "{{ . | absURL }}",
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
"license": "{{ . | safeHTML }}",
|
||||
{{- end -}}
|
||||
"name": {{ .Site.Title | safeHTML }}
|
||||
}
|
||||
</script>
|
||||
|
||||
{{- /* Page SEO */ -}}
|
||||
{{- else if .IsPage -}}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
"headline": {{ .Title | safeHTML }},
|
||||
"inLanguage": "{{ .Site.LanguageCode }}",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "{{ .Permalink }}"
|
||||
},
|
||||
{{- $images := $params.seo.images | default slice -}}
|
||||
{{- if not $images -}}
|
||||
{{- with .Resources.GetMatch "featured-image-preview" -}}
|
||||
{{- $images = slice "featured-image-preview" -}}
|
||||
{{- end -}}
|
||||
{{- with .Resources.GetMatch "featured-image" -}}
|
||||
{{- $images = slice "featured-image" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.seo.image -}}
|
||||
{{- $images = $images | default (slice .) -}}
|
||||
{{- end -}}
|
||||
{{- with $images -}}
|
||||
"image": [
|
||||
{{- range $index, $value := . -}}
|
||||
{{- if gt $index 0 }},{{ end -}}
|
||||
{{- with dict "Path" $value "Resources" $.Resources | partial "function/resource.html" -}}
|
||||
{
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ .Permalink }}",
|
||||
"width": {{ .Width }},
|
||||
"height": {{ .Height }}
|
||||
}
|
||||
{{- else -}}
|
||||
{{- with $value -}}
|
||||
"{{ . | absURL }}"
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
],
|
||||
{{- end -}}
|
||||
"genre": "{{ .Type }}",
|
||||
{{- with .Params.tags -}}
|
||||
"keywords": "{{ delimit . ", " }}",
|
||||
{{- end -}}
|
||||
"wordcount": {{ .WordCount }},
|
||||
"url": "{{ .Permalink }}",
|
||||
{{- if not .PublishDate.IsZero -}}
|
||||
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }},
|
||||
{{- else if not .Date.IsZero -}}
|
||||
"datePublished": {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }},
|
||||
{{- end -}}
|
||||
{{- with .Lastmod -}}
|
||||
"dateModified": {{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }},
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
"license": {{ . | safeHTML }},
|
||||
{{- end -}}
|
||||
{{- $publisher := .Params.author | default .Site.Author.name | default (T "author") | dict "name" -}}
|
||||
{{- $publisher = $params.seo.publisher | default dict | merge $publisher -}}
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
"name": {{ $publisher.name | safeHTML }}
|
||||
{{- $logo := $publisher.logoUrl -}}
|
||||
{{- with dict "Path" $logo "Resources" .Resources | partial "function/resource.html" -}}
|
||||
,"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ .Permalink }}",
|
||||
"width": {{ .Width }},
|
||||
"height": {{ .Height }}
|
||||
}
|
||||
{{- else -}}
|
||||
{{- with $logo -}}
|
||||
,"logo": "{{ . | absURL }}"
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
},
|
||||
{{- with .Params.author | default .Site.Author.name | default (T "author") -}}
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": {{ . | safeHTML }}
|
||||
},
|
||||
{{- end -}}
|
||||
"description": {{ .Description | safeHTML }}
|
||||
}
|
||||
</script>
|
||||
{{- end -}}
|
181
themes/CodeIT/layouts/partials/header.html
Normal file
181
themes/CodeIT/layouts/partials/header.html
Normal file
|
@ -0,0 +1,181 @@
|
|||
{{- /* Desktop header */ -}}
|
||||
<header class="desktop" id="header-desktop">
|
||||
<div class="header-wrapper">
|
||||
<div class="header-title">
|
||||
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
|
||||
{{- with .Site.Params.header.title -}}
|
||||
{{- with .logo -}}
|
||||
{{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
{{- with .pre -}}
|
||||
<span class="header-title-pre">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
{{- if .typeit -}}
|
||||
{{- $id := dict "Content" .name "Scratch" $.Scratch | partial "function/id.html" -}}
|
||||
<span id="{{ $id }}" class="typeit"></span>
|
||||
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
|
||||
{{- else -}}
|
||||
{{- .name -}}
|
||||
{{- end -}}
|
||||
{{- with .post -}}
|
||||
<span class="header-title-post">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Site.Title -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="menu">
|
||||
<div class="menu-inner">
|
||||
{{- range .Site.Menus.main -}}
|
||||
{{- $url := .URL | relLangURL -}}
|
||||
{{- with .Page -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<a class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}" href="{{ $url }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
|
||||
{{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- if .Site.Menus.main -}}
|
||||
<span class="menu-item delimiter"></span>
|
||||
{{- end -}}
|
||||
{{- if .Site.IsMultiLingual -}}
|
||||
<a href="javascript:void(0);" class="menu-item language" title="{{ T "selectLanguage" }}">
|
||||
{{- .Language.LanguageName -}}
|
||||
<i class="fas fa-chevron-right fa-fw"></i>
|
||||
<select class="language-select" id="language-select-desktop" onchange="location = this.value;">
|
||||
{{- if eq .Kind "404" -}}
|
||||
{{- range .Sites -}}
|
||||
{{- $link := printf "%v/404.html" .LanguagePrefix -}}
|
||||
<option value="{{ $link }}"{{ if eq . $.Site }} selected{{ end }}>
|
||||
{{- .Language.LanguageName -}}
|
||||
</option>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- range .AllTranslations -}}
|
||||
<option value="{{ .RelPermalink }}"{{ if eq .Lang $.Lang }} selected{{ end }}>
|
||||
{{- .Language.LanguageName -}}
|
||||
</option>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</select>
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- if .Site.Params.search.enable -}}
|
||||
<span class="menu-item search" id="search-desktop">
|
||||
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `searchPlaceholder`) }}" id="search-input-desktop">
|
||||
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-desktop" title="{{ T `search` }}">
|
||||
<i class="fas fa-search fa-fw"></i>
|
||||
</a>
|
||||
<a href="javascript:void(0);" class="search-button search-clear" id="search-clear-desktop" title="{{ T `clear` }}">
|
||||
<i class="fas fa-times-circle fa-fw"></i>
|
||||
</a>
|
||||
<span class="search-button search-loading" id="search-loading-desktop">
|
||||
<i class="fas fa-spinner fa-fw fa-spin"></i>
|
||||
</span>
|
||||
</span>
|
||||
{{- end -}}
|
||||
<a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
|
||||
<i class="fas fa-adjust fa-fw"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{{- /* Mobile header */ -}}
|
||||
<header class="mobile" id="header-mobile">
|
||||
<div class="header-container">
|
||||
<div class="header-wrapper">
|
||||
<div class="header-title">
|
||||
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
|
||||
{{- with .Site.Params.header.title -}}
|
||||
{{- with .logo -}}
|
||||
{{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
{{- with .pre -}}
|
||||
<span class="header-title-pre">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
{{- if .typeit -}}
|
||||
{{- $id := dict "Content" .name "Scratch" $.Scratch | partial "function/id.html" -}}
|
||||
<span id="{{ $id }}" class="typeit"></span>
|
||||
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
|
||||
{{- else -}}
|
||||
{{- .name -}}
|
||||
{{- end -}}
|
||||
{{- with .post -}}
|
||||
<span class="header-title-post">{{ . | safeHTML }}</span>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Site.Title -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="menu-toggle" id="menu-toggle-mobile">
|
||||
<span></span><span></span><span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu" id="menu-mobile">
|
||||
{{- if .Site.Params.search.enable -}}
|
||||
<div class="search-wrapper">
|
||||
<div class="search mobile" id="search-mobile">
|
||||
<input type="text" placeholder="{{ .Site.Params.search.placeholder | default (T `searchPlaceholder`) }}" id="search-input-mobile">
|
||||
<a href="javascript:void(0);" class="search-button search-toggle" id="search-toggle-mobile" title="{{ T `search` }}">
|
||||
<i class="fas fa-search fa-fw"></i>
|
||||
</a>
|
||||
<a href="javascript:void(0);" class="search-button search-clear" id="search-clear-mobile" title="{{ T `clear` }}">
|
||||
<i class="fas fa-times-circle fa-fw"></i>
|
||||
</a>
|
||||
<span class="search-button search-loading" id="search-loading-mobile">
|
||||
<i class="fas fa-spinner fa-fw fa-spin"></i>
|
||||
</span>
|
||||
</div>
|
||||
<a href="javascript:void(0);" class="search-cancel" id="search-cancel-mobile">
|
||||
{{ T `cancel` }}
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- $currentPage := . -}}
|
||||
{{- range .Site.Menus.main -}}
|
||||
{{- $url := .URL | relLangURL -}}
|
||||
{{- with .Page -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<a class="menu-item" href="{{ $url }}" title="{{ .Title }}"{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
|
||||
{{- .Pre | safeHTML }}{{ .Name }}{{ .Post | safeHTML -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
<a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
|
||||
<i class="fas fa-adjust fa-fw"></i>
|
||||
</a>
|
||||
{{- if .Site.IsMultiLingual -}}
|
||||
<a href="javascript:void(0);" class="menu-item" title="{{ T "selectLanguage" }}">
|
||||
{{- .Language.LanguageName -}}
|
||||
<i class="fas fa-chevron-right fa-fw"></i>
|
||||
<select class="language-select" onchange="location = this.value;">
|
||||
{{- if eq .Kind "404" -}}
|
||||
{{- range .Sites -}}
|
||||
{{- $link := printf "%v/404.html" .LanguagePrefix -}}
|
||||
<option value="{{ $link }}"{{ if eq . $.Site }} selected{{ end }}>
|
||||
{{- .Language.LanguageName -}}
|
||||
</option>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- range .AllTranslations -}}
|
||||
<option value="{{ .RelPermalink }}"{{ if eq .Lang $.Lang }} selected{{ end }}>
|
||||
{{- .Language.LanguageName -}}
|
||||
</option>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</select>
|
||||
</a>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="search-dropdown desktop">
|
||||
<div id="search-dropdown-desktop"></div>
|
||||
</div>
|
||||
<div class="search-dropdown mobile">
|
||||
<div id="search-dropdown-mobile"></div>
|
||||
</div>
|
95
themes/CodeIT/layouts/partials/home/profile.html
Normal file
95
themes/CodeIT/layouts/partials/home/profile.html
Normal file
|
@ -0,0 +1,95 @@
|
|||
{{- $profile := .Site.Params.home.profile -}}
|
||||
<div class="home-profile">
|
||||
{{- $avatar := $profile.avatarURL -}}
|
||||
{{- with $profile.gravatarEmail -}}
|
||||
{{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%v?s=240&d=mp" -}}
|
||||
{{- end -}}
|
||||
{{- if $avatar -}}
|
||||
<div class="home-avatar">
|
||||
{{- $menus := $.Site.Menus.main | default slice -}}
|
||||
{{- 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" -}}
|
||||
</a>
|
||||
{{- else -}}
|
||||
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- with $profile.title -}}
|
||||
<h1 class="home-title">
|
||||
{{- . | safeHTML -}}
|
||||
</h1>
|
||||
{{- end -}}
|
||||
|
||||
{{- with $profile.subtitle -}}
|
||||
<h2 class="home-subtitle">
|
||||
{{- if $profile.typeit -}}
|
||||
{{- $id := dict "Content" . "Scratch" $.Scratch | partial "function/id.html" -}}
|
||||
<div id="{{ $id }}" class="typeit"></div>
|
||||
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
|
||||
{{- else -}}
|
||||
{{- . -}}
|
||||
{{- end -}}
|
||||
</h2>
|
||||
{{- end -}}
|
||||
|
||||
{{- if $profile.social -}}
|
||||
<div class="links">
|
||||
{{- $socialMap := resources.Get "data/social.yml" | transform.Unmarshal -}}
|
||||
{{- $socialArr := slice -}}
|
||||
{{- range $key, $value := .Site.Params.social -}}
|
||||
{{- $social := $key | lower | index $socialMap | default dict -}}
|
||||
{{- if $value -}}
|
||||
{{- if reflect.IsMap $value -}}
|
||||
{{- with $value.weight -}}
|
||||
{{- $social = dict "Weight" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.prefix -}}
|
||||
{{- $social = dict "Prefix" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.template -}}
|
||||
{{- $social = dict "Template" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.id -}}
|
||||
{{- $social = dict "Id" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.url -}}
|
||||
{{- $social = dict "Url" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.title -}}
|
||||
{{- $social = dict "Title" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.newtab -}}
|
||||
{{- $social = dict "Newtab" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.icon -}}
|
||||
{{- $social = dict "Icon" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- else if ne $value true -}}
|
||||
{{- $social = dict "Id" $value | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- if $social.Icon.Simpleicons -}}
|
||||
{{- $prefix := ($.Scratch.Get "cdn" | default dict).simpleIconsPrefix -}}
|
||||
{{- $social = dict "Prefix" $prefix | dict "Icon" | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- $socialArr = $socialArr | append $social -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- range sort $socialArr "Weight" -}}
|
||||
{{- partial "plugin/social.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- with $profile.disclaimer -}}
|
||||
<h3 class="home-disclaimer">
|
||||
{{- . | safeHTML -}}
|
||||
</h3>
|
||||
{{- end -}}
|
||||
</div>
|
41
themes/CodeIT/layouts/partials/init.html
Normal file
41
themes/CodeIT/layouts/partials/init.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
{{- .Scratch.Set "version" "0.2.10" -}}
|
||||
|
||||
{{- /* CodeIT theme version detection */ -}}
|
||||
{{- $VERSION := "0.2.X" -}}
|
||||
{{- if eq .Site .Sites.First -}}
|
||||
{{- if not .Site.Params.version -}}
|
||||
{{- errorf "Configuration Error 配置文件错误\n\nYou haven't configured the CodeIT version param correctly yet. See https://codeit.suntprogramator.dev/theme-documentation-basics/#basic-configuration\n你还没有正确配置 CodeIT 的版本参数. 参考 https://hugoCodeIT.com/zh-cn/theme-documentation-basics/#basic-configuration\n" -}}
|
||||
{{- else if ne .Site.Params.version $VERSION -}}
|
||||
{{- errorf (printf "Compatibility Error 兼容性错误\n\n%v -> %v:\nYou have an incompatible update. See https://github.com/suntprogramator/CodeIT/releases\n你进行了一次不兼容的更新. 参考 https://github.com/suntprogramator/CodeIT/releases\n" .Site.Params.version $VERSION) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $params := .Params | merge .Site.Params.page -}}
|
||||
|
||||
{{- if eq hugo.Environment "production" -}}
|
||||
{{- $cdn := .Site.Params.cdn -}}
|
||||
{{- with $cdn.data -}}
|
||||
{{- $cdnData := printf "data/cdn/%v" . | resources.Get | transform.Unmarshal -}}
|
||||
{{- $cdn = dict "simpleIconsPrefix" $cdnData.prefix.simpleIcons -}}
|
||||
{{- $prefix := $cdnData.prefix.libFiles | default "" -}}
|
||||
{{- range $key, $value := $cdnData.libFiles -}}
|
||||
{{- $cdn = printf "%v%v" $prefix $value | dict $key | merge $cdn -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "cdn" $cdn -}}
|
||||
{{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
|
||||
{{- .Scratch.Set "analytics" .Site.Params.analytics -}}
|
||||
{{- .Scratch.Set "comment" $params.comment -}}
|
||||
{{- if eq .Params.comment true -}}
|
||||
{{- .Scratch.Set "comment" .Site.Params.comment -}}
|
||||
{{- else if eq .Params.comment false -}}
|
||||
{{- .Scratch.Set "comment" dict -}}
|
||||
{{- end -}}
|
||||
{{- else if eq .Site .Sites.First -}}
|
||||
{{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- .Scratch.Set "params" $params -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
|
||||
{{- partial "plugin/compatibility.html" . -}}
|
30
themes/CodeIT/layouts/partials/paginator.html
Normal file
30
themes/CodeIT/layouts/partials/paginator.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
{{- if gt .Paginator.TotalPages 1 -}}
|
||||
<ul class="pagination">
|
||||
{{- .Scratch.Set "paginator.ellipsed" false -}}
|
||||
{{- range $.Paginator.Pagers -}}
|
||||
{{- $right := sub .TotalPages .PageNumber -}}
|
||||
{{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
|
||||
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $.Paginator.PageNumber 3)) (lt .PageNumber (add $.Paginator.PageNumber 3))) -}}
|
||||
{{- if $showNumber -}}
|
||||
{{- $.Scratch.Set "paginator.ellipsed" false -}}
|
||||
{{- $.Scratch.Set "paginator.shouldEllipse" false -}}
|
||||
{{- else -}}
|
||||
{{- $.Scratch.Set "paginator.shouldEllipse" (not ($.Scratch.Get "paginator.ellipsed") ) -}}
|
||||
{{- $.Scratch.Set "paginator.ellipsed" true -}}
|
||||
{{- end -}}
|
||||
{{- if $showNumber -}}
|
||||
<li class="page-item {{ if eq . $.Paginator }}active{{ end }}">
|
||||
<span class="page-link">
|
||||
<a href="{{ .URL }}">
|
||||
{{- .PageNumber -}}
|
||||
</a>
|
||||
</span>
|
||||
</li>
|
||||
{{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
|
||||
<li class="page-item ">
|
||||
<span class="page-link" aria-hidden="true">…</span>
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- end -}}
|
27
themes/CodeIT/layouts/partials/plugin/analytics.html
Normal file
27
themes/CodeIT/layouts/partials/plugin/analytics.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{{- $analytics := .Scratch.Get "analytics" | default dict -}}
|
||||
|
||||
{{- if $analytics.enable -}}
|
||||
{{- /* Google Analytics */ -}}
|
||||
{{- with $analytics.google.id -}}
|
||||
<script type="text/javascript">
|
||||
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());
|
||||
gtag('config', '{{ . }}'{{ if $analytics.google.anonymizeIP }}, { 'anonymize_ip': true }{{ end }});
|
||||
</script>
|
||||
{{- printf "https://www.googletagmanager.com/gtag/js?id=%v" . | dict "Async" true "Source" | partial "plugin/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Fathom Analytics */ -}}
|
||||
{{- with $analytics.fathom.id -}}
|
||||
<script type="text/javascript">
|
||||
window.fathom=window.fathom||function(){(fathom.q=fathom.q||[]).push(arguments);};
|
||||
fathom('set', 'siteId', '{{ . }}');
|
||||
fathom('trackPageview');
|
||||
</script>
|
||||
{{- dict "Source" ($analytics.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "Async" true "Attr" "id=fathom-script" | partial "plugin/script.html" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Plausible Analytics */ -}}
|
||||
{{- with $analytics.plausible.domain -}}
|
||||
{{- dict "Source" "https://plausible.io/js/plausible.js" "Async" true "Defer" true "Attr" ($analytics.plausible.domain | printf `data-domain="%v"`) | partial "plugin/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
22
themes/CodeIT/layouts/partials/plugin/compatibility.html
Normal file
22
themes/CodeIT/layouts/partials/plugin/compatibility.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
{{- $compatibility := .Site.Params.compatibility | default dict -}}
|
||||
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
||||
|
||||
{{- /* Polyfill.io */ -}}
|
||||
{{- if $compatibility.polyfill -}}
|
||||
{{- $features := slice -}}
|
||||
{{- range resources.Get "data/polyfill.yml" | transform.Unmarshal -}}
|
||||
{{- range . -}}
|
||||
{{- $features = $features | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with $features | uniq -}}
|
||||
{{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "Source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* object-fit-images */ -}}
|
||||
{{- if $compatibility.objectFit -}}
|
||||
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- end -}}
|
13
themes/CodeIT/layouts/partials/plugin/icon.html
Normal file
13
themes/CodeIT/layouts/partials/plugin/icon.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{- with .Class -}}
|
||||
<i class="{{ . }}"></i>
|
||||
{{- else -}}
|
||||
{{- $src := .Src -}}
|
||||
{{- with .Simpleicons -}}
|
||||
{{- $prefix := $.Prefix | default "lib/simple-icons/icons" | strings.TrimSuffix "/" -}}
|
||||
{{- $src = printf "%v/%v.svg" $prefix . -}}
|
||||
{{- end -}}
|
||||
{{- if (urls.Parse $src).Host | not -}}
|
||||
{{- $src = (resources.Get $src | minify).RelPermalink -}}
|
||||
{{- end -}}
|
||||
<i data-svg-src="{{ $src }}"></i>
|
||||
{{- end -}}
|
38
themes/CodeIT/layouts/partials/plugin/image.html
Normal file
38
themes/CodeIT/layouts/partials/plugin/image.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
{{- /* lazysizes and lightgallery.js */ -}}
|
||||
{{- $src := .Src -}}
|
||||
{{- with dict "Path" .Src "Resources" .Resources | partial "function/resource.html" -}}
|
||||
{{- $src = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $small := .SrcSmall | default $src -}}
|
||||
{{- with dict "Path" .SrcSmall "Resources" .Resources | partial "function/resource.html" -}}
|
||||
{{- $small = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $large := .SrcLarge | default $src -}}
|
||||
{{- with dict "Path" .SrcLarge "Resources" .Resources | partial "function/resource.html" -}}
|
||||
{{- $large = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $alt := .Alt | default $src -}}
|
||||
{{- $loading := resources.Get "svg/loading.svg" | minify -}}
|
||||
{{- if .Linked -}}
|
||||
<a class="lightgallery" href="{{ $large | safeURL }}" title="{{ .Title | default $alt }}" data-thumbnail="{{ $small | safeURL }}"{{ with .Caption }} data-sub-html="<h2>{{ . }}</h2>{{ with $.Title }}<p>{{ . }}</p>{{ end }}"{{ end }}{{ with .Rel }} rel="{{ . }}"{{ end }}>
|
||||
<img
|
||||
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
|
||||
src="{{ $loading.RelPermalink }}"
|
||||
data-src="{{ .Src | safeURL }}"
|
||||
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
|
||||
data-sizes="auto"
|
||||
alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
|
||||
</a>
|
||||
{{- else -}}
|
||||
<img
|
||||
class="lazyload{{ with .Class }} {{ . }}{{ end }}"
|
||||
src="{{ $loading.RelPermalink }}"
|
||||
data-src="{{ .Src | safeURL }}"
|
||||
data-srcset="{{ $small | safeURL }}, {{ .Src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
|
||||
data-sizes="auto"
|
||||
alt="{{ $alt }}"
|
||||
title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} />
|
||||
{{- end -}}
|
9
themes/CodeIT/layouts/partials/plugin/link.html
Normal file
9
themes/CodeIT/layouts/partials/plugin/link.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{- $rel := "" -}}
|
||||
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .Destination).Host | or .Newtab }}{{ $rel = "noopener noreferrer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"{{ with .Class }} class="{{ . }}"{{ end }}>
|
||||
{{- with .Icon -}}
|
||||
{{- partial "plugin/icon.html" . -}}
|
||||
{{- end -}}
|
||||
{{- with .Content -}}
|
||||
{{- . | safeHTML -}}
|
||||
{{- end -}}
|
||||
</a>
|
25
themes/CodeIT/layouts/partials/plugin/script.html
Normal file
25
themes/CodeIT/layouts/partials/plugin/script.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{- if .Content -}}
|
||||
<script type="text/javascript">
|
||||
{{- .Content | safeJS -}}
|
||||
</script>
|
||||
{{- else if strings.HasPrefix .Source "<script" -}}
|
||||
{{- safeHTML .Source -}}
|
||||
{{- else -}}
|
||||
{{- $src := .Source -}}
|
||||
{{- $integrity := .Integrity -}}
|
||||
{{- if (urls.Parse $src).Host | not -}}
|
||||
{{- $resource := resources.Get $src -}}
|
||||
{{- with .Template -}}
|
||||
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
|
||||
{{- end -}}
|
||||
{{- if .Minify -}}
|
||||
{{- $resource = $resource | minify -}}
|
||||
{{- end -}}
|
||||
{{- with .Fingerprint -}}
|
||||
{{- $resource = $resource | fingerprint . -}}
|
||||
{{- $integrity = $resource.Data.Integrity -}}
|
||||
{{- end -}}
|
||||
{{- $src = $resource.RelPermalink -}}
|
||||
{{- end -}}
|
||||
<script type="text/javascript" src="{{ $src }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ if .Async }} async{{ end }}{{ if .Defer }} defer{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}></script>
|
||||
{{- end -}}
|
199
themes/CodeIT/layouts/partials/plugin/share.html
Normal file
199
themes/CodeIT/layouts/partials/plugin/share.html
Normal file
|
@ -0,0 +1,199 @@
|
|||
{{- $share := (.Scratch.Get "params").share | default dict -}}
|
||||
|
||||
{{- if $share.enable -}}
|
||||
{{- /* 001: Twitter */ -}}
|
||||
{{- if $share.Twitter -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Twitter" data-sharer="twitter" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.tags }} data-hashtags="{{ delimit . `,` }}"{{ end }}>
|
||||
{{- dict "Class" "fab fa-twitter fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 002: Facebook */ -}}
|
||||
{{- if $share.Facebook -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Facebook" data-sharer="facebook" data-url="{{ .Permalink }}"{{ with .Params.tags }} data-hashtag="{{ index . 0 }}"{{ end }}>
|
||||
{{- dict "Class" "fab fa-facebook-square fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 003: Linkedin */ -}}
|
||||
{{- if $share.Linkedin -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Linkedin" data-sharer="linkedin" data-url="{{ .Permalink }}">
|
||||
{{- dict "Class" "fab fa-linkedin fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 004: WhatsApp */ -}}
|
||||
{{- if $share.Whatsapp -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} WhatsApp" data-sharer="whatsapp" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-web>
|
||||
{{- dict "Class" "fab fa-whatsapp fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 005: Viber */ -}}
|
||||
{{- if $share.Viber -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Viber" data-sharer="viber" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Class" "fab fa-viber fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 006: Pinterest */ -}}
|
||||
{{- if $share.Pinterest -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pinterest" data-sharer="pinterest" data-url="{{ .Permalink }}"{{ with .Description }} data-description="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
|
||||
{{- dict "Class" "fab fa-pinterest fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 007: Tumblr */ -}}
|
||||
{{- if $share.Tumblr -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Tumblr" data-sharer="tumblr" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.tags }} data-tags="{{ delimit . `,` }}"{{ end }}>
|
||||
{{- dict "Class" "fab fa-tumblr fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 008: Hacker News */ -}}
|
||||
{{- if $share.Hackernews -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Hacker News" data-sharer="hackernews" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Class" "fab fa-hacker-news fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 009: Reddit */ -}}
|
||||
{{- if $share.Reddit -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Reddit" data-sharer="reddit" data-url="{{ .Permalink }}">
|
||||
{{- dict "Class" "fab fa-reddit fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 010: VK */ -}}
|
||||
{{- if $share.VK -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} VK" data-sharer="vk" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
|
||||
{{- dict "Class" "fab fa-vk fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 011: Buffer */ -}}
|
||||
{{- if $share.Buffer -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Buffer" data-sharer="buffer" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Twitter }} data-via="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-picture="{{ . }}"{{ end }}>
|
||||
{{- dict "Class" "fab fa-buffer fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 012: Xing */ -}}
|
||||
{{- if $share.Xing -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Xing" data-sharer="xing" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Class" "fab fa-xing fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 013: Line */ -}}
|
||||
{{- if $share.Line -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Line" data-sharer="line" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Simpleicons" "line" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 014: Instapaper */ -}}
|
||||
{{- if $share.Instapaper -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Instapaper" data-sharer="instapaper" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- dict "Simpleicons" "instapaper" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 015: Pocket */ -}}
|
||||
{{- if $share.Pocket -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pocket" data-sharer="pocket" data-url="{{ .Permalink }}">
|
||||
{{- dict "Class" "fab fa-get-pocket fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 016: Digg */ -}}
|
||||
{{- if $share.Digg -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Digg" data-sharer="digg" data-url="{{ .Permalink }}">
|
||||
{{- dict "Class" "fab fa-digg fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 017: StumbleUpon */ -}}
|
||||
{{- if $share.Stumbleupon -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} StumbleUpon" data-sharer="stumbleupon" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Class" "fab fa-stumbleupon fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 018: Flipboard */ -}}
|
||||
{{- if $share.Flipboard -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Flipboard" data-sharer="flipboard" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Class" "fab fa-flipboard fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 019: 微博 */ -}}
|
||||
{{- if $share.Weibo -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} 微博" data-sharer="weibo" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}{{ with .Site.Params.Social.Weibo }} data-ralateuid="{{ . }}"{{ end }}>
|
||||
{{- dict "Class" "fab fa-weibo fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 020: 人人 */ -}}
|
||||
{{- if $share.Renren -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} 人人" data-sharer="renren" data-url="{{ .Permalink }}">
|
||||
{{- dict "Class" "fab fa-renren fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 021: Myspace */ -}}
|
||||
{{- if $share.Myspace -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Myspace" data-sharer="myspace" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- dict "Simpleicons" "myspace" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 022: Blogger */ -}}
|
||||
{{- if $share.Blogger -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Blogger" data-sharer="blogger" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- dict "Class" "fab fa-blogger fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 023: 百度 */ -}}
|
||||
{{- if $share.Baidu -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} 百度" data-sharer="baidu" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Simpleicons" "baidu" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 024: OK.RU */ -}}
|
||||
{{- if $share.Odnoklassniki -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} OK.RU" data-sharer="okru" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Class" "fab fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 025: Evernote */ -}}
|
||||
{{- if $share.Evernote -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Evernote" data-sharer="evernote" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Class" "fab fa-evernote fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 026: Skype */ -}}
|
||||
{{- if $share.Skype -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Skype" data-sharer="skype" data-url="{{ .Permalink }}" data-title="{{ .Title }}">
|
||||
{{- dict "Class" "fab fa-skype fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 027: Trello */ -}}
|
||||
{{- if $share.Trello -}}
|
||||
<a href="javascript:void(0);" title="{{ T `shareOn` }} Trello" data-sharer="trello" data-url="{{ .Permalink }}" data-title="{{ .Title }}" data-description="{{ .Description }}">
|
||||
{{- dict "Class" "fab fa-trello fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* 028: Mix */ -}}
|
||||
{{- if $share.Mix -}}
|
||||
<a href="//mix.com/add?url={{ .Permalink }}&description={{ .Title }}" target="_blank" title="{{ T `shareOn` }} Mix">
|
||||
{{- dict "Class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
11
themes/CodeIT/layouts/partials/plugin/social.html
Normal file
11
themes/CodeIT/layouts/partials/plugin/social.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
{{- $destination := "" -}}
|
||||
{{- with .Url -}}
|
||||
{{- $destination = . | relLangURL -}}
|
||||
{{- else -}}
|
||||
{{- $template := .Template | default "%v" -}}
|
||||
{{- with .Prefix -}}
|
||||
{{- $template = . | strings.TrimSuffix "/" | printf "%v/%%v" -}}
|
||||
{{- end -}}
|
||||
{{- $destination = printf (string $template) .Id -}}
|
||||
{{- end -}}
|
||||
{{- dict "Destination" $destination "Rel" "me" | merge . | partial "plugin/link.html" -}}
|
31
themes/CodeIT/layouts/partials/plugin/style.html
Normal file
31
themes/CodeIT/layouts/partials/plugin/style.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
{{- if strings.HasPrefix .Source "<link" -}}
|
||||
{{- safeHTML .Source -}}
|
||||
{{- else -}}
|
||||
{{- $href := .Source -}}
|
||||
{{- $integrity := .Integrity -}}
|
||||
{{- $resource := 0 -}}
|
||||
{{- if $href | and (not (urls.Parse $href).Host) -}}
|
||||
{{- $resource = resources.Get $href -}}
|
||||
{{- end -}}
|
||||
{{- with .Content -}}
|
||||
{{- $resource = resources.FromString $.Path . -}}
|
||||
{{- end -}}
|
||||
{{- if $resource -}}
|
||||
{{- with .Template -}}
|
||||
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
|
||||
{{- end -}}
|
||||
{{- with .ToCSS -}}
|
||||
{{- $options := . | merge (dict "outputStyle" "compressed") -}}
|
||||
{{- $resource = $resource | toCSS $options -}}
|
||||
{{- end -}}
|
||||
{{- if .Minify -}}
|
||||
{{- $resource = $resource | minify -}}
|
||||
{{- end -}}
|
||||
{{- with .Fingerprint -}}
|
||||
{{- $resource = $resource | fingerprint . -}}
|
||||
{{- $integrity = $resource.Data.Integrity -}}
|
||||
{{- end -}}
|
||||
{{- $href = $resource.RelPermalink -}}
|
||||
{{- end -}}
|
||||
<link rel="stylesheet" href="{{ $href }}"{{ if .Crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ with .Attr }} {{ . | safeHTMLAttr }}{{ end }}>
|
||||
{{- end -}}
|
36
themes/CodeIT/layouts/partials/rss/item.html
Normal file
36
themes/CodeIT/layouts/partials/rss/item.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Author.name) -}}
|
||||
<item>
|
||||
<title>
|
||||
{{- .Page.Title -}}
|
||||
</title>
|
||||
<link>
|
||||
{{- .Page.Permalink -}}
|
||||
</link>
|
||||
<pubDate>
|
||||
{{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
|
||||
</pubDate>
|
||||
<author>
|
||||
{{- .params.author | default (T "author") -}}
|
||||
</author>
|
||||
<guid>
|
||||
{{- .Page.Permalink -}}
|
||||
</guid>
|
||||
<description>
|
||||
{{- "<![CDATA[" | safeHTML -}}
|
||||
{{- with $params.featuredimage -}}
|
||||
<div class="featured-image">
|
||||
<img src="{{ . | relURL }}" referrerpolicy="no-referrer">
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- $content := .Page.Description -}}
|
||||
{{- if $params.rssFullText -}}
|
||||
{{- $content = dict "Content" .Page.Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
|
||||
{{- else -}}
|
||||
{{- with .Page.Summary -}}
|
||||
{{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}}
|
||||
{{- "]]>" | safeHTML -}}
|
||||
</description>
|
||||
</item>
|
4
themes/CodeIT/layouts/partials/scratch/script.html
Normal file
4
themes/CodeIT/layouts/partials/scratch/script.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{- $this := .Scratch.Get "this" -}}
|
||||
{{- $script := $this.script | default slice -}}
|
||||
{{- $script = $script | append (slice .Data) -}}
|
||||
{{- .Scratch.SetInMap "this" "script" $script -}}
|
4
themes/CodeIT/layouts/partials/scratch/style.html
Normal file
4
themes/CodeIT/layouts/partials/scratch/style.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{- $this := .Scratch.Get "this" -}}
|
||||
{{- $style := $this.style | default slice -}}
|
||||
{{- $style = $style | append (slice .Data) -}}
|
||||
{{- .Scratch.SetInMap "this" "style" $style -}}
|
72
themes/CodeIT/layouts/partials/single/footer.html
Normal file
72
themes/CodeIT/layouts/partials/single/footer.html
Normal file
|
@ -0,0 +1,72 @@
|
|||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
<div class="post-footer" id="post-footer">
|
||||
<div class="post-info">
|
||||
<div class="post-info-line">
|
||||
<div class="post-info-mod">
|
||||
<span>
|
||||
{{- with .Site.Params.dateformat | default "2006-01-02" | .Lastmod.Format -}}
|
||||
{{- dict "Date" . | T "updatedOnDate" -}}
|
||||
{{- if $.Site.Params.gitRepo -}}
|
||||
{{- with $.GitInfo -}}
|
||||
<a class="git-hash" href="{{ printf `%v/commit/%v` $.Site.Params.gitRepo .Hash }}" target="_blank" rel="noopener noreferrer" title="commit by {{ .AuthorName }}({{ .AuthorEmail }}) {{ .Hash }}: {{ .Subject }}">
|
||||
<i class="fas fa-hashtag fa-fw"></i>{{- .AbbreviatedHash -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="post-info-license">
|
||||
{{- with $params.license | string -}}
|
||||
<span>
|
||||
{{- . | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-info-line">
|
||||
<div class="post-info-md">
|
||||
{{- if $params.linktomarkdown -}}
|
||||
{{- with .OutputFormats.Get "markdown" -}}
|
||||
<span>
|
||||
<a class="link-to-markdown" href="{{ .RelPermalink }}" target="_blank" rel="noopener noreferrer">
|
||||
{{- T "readMarkdown" -}}
|
||||
</a>
|
||||
</span>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
<div class="post-info-share">
|
||||
<span>
|
||||
{{- partial "plugin/share.html" . -}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="post-info-more">
|
||||
<section class="post-tags">
|
||||
{{- with .Params.tags -}}
|
||||
<i class="fas fa-tags fa-fw"></i>
|
||||
{{- range $index, $value := . -}}
|
||||
{{- if gt $index 0 }}, {{ end -}}
|
||||
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
|
||||
<a href="{{ $tag.RelPermalink }}">{{ $tag.Title }}</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</section>
|
||||
<section>
|
||||
<span><a href="javascript:void(0);" onclick="window.history.back();">{{ T "back" }}</a></span> | <span><a href="{{ .Site.Home.RelPermalink }}">{{ T "home" }}</a></span>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="post-nav">
|
||||
{{- if .PrevInSection -}}
|
||||
<a href="{{ .PrevInSection.RelPermalink }}" class="prev" rel="prev" title="{{ .PrevInSection.Title }}"><i class="fas fa-angle-left fa-fw"></i>{{ .PrevInSection.Title }}</a>
|
||||
{{- end -}}
|
||||
{{ if .NextInSection }}
|
||||
<a href="{{ .NextInSection.RelPermalink }}" class="next" rel="next" title="{{ .NextInSection.Title }}">{{ .NextInSection.Title }}<i class="fas fa-angle-right fa-fw"></i></a>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
41
themes/CodeIT/layouts/posts/rss.xml
Normal file
41
themes/CodeIT/layouts/posts/rss.xml
Normal file
|
@ -0,0 +1,41 @@
|
|||
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
|
||||
<channel>
|
||||
<title>
|
||||
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}}
|
||||
</title>
|
||||
<link>
|
||||
{{- .Permalink -}}
|
||||
</link>
|
||||
<description>
|
||||
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} | {{ .Site.Title -}}
|
||||
</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
{{- with .Site.LanguageCode -}}
|
||||
<language>
|
||||
{{- . -}}
|
||||
</language>
|
||||
{{- end -}}
|
||||
{{- with .Site.Author.email -}}
|
||||
<managingEditor>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</managingEditor>
|
||||
<webMaster>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</webMaster>
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
<copyright>
|
||||
{{- . -}}
|
||||
</copyright>
|
||||
{{- end -}}
|
||||
{{- if not .Date.IsZero -}}
|
||||
<lastBuildDate>
|
||||
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
|
||||
</lastBuildDate>
|
||||
{{- end -}}
|
||||
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
|
||||
{{- range .Pages | first (.Site.Params.section.rss | default 10) -}}
|
||||
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
|
||||
{{- end -}}
|
||||
</channel>
|
||||
</rss>
|
101
themes/CodeIT/layouts/posts/single.html
Normal file
101
themes/CodeIT/layouts/posts/single.html
Normal file
|
@ -0,0 +1,101 @@
|
|||
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
|
||||
|
||||
{{- 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 -}}
|
||||
|
||||
<article class="page single">
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title animated flipInX">{{ .Title }}</h1>
|
||||
|
||||
{{- /* Subtitle */ -}}
|
||||
{{- with $params.subtitle -}}
|
||||
<h2 class="single-subtitle">{{ . }}</h2>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Meta */ -}}
|
||||
<div class="post-meta">
|
||||
<div class="post-meta-line">
|
||||
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
|
||||
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
|
||||
<span class="post-author">
|
||||
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
</span>
|
||||
|
||||
{{- $categories := slice -}}
|
||||
{{- range .Params.categories -}}
|
||||
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
||||
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
|
||||
{{- end -}}
|
||||
{{- with delimit $categories " " -}}
|
||||
<span class="post-category">
|
||||
{{- dict "Categories" . | T "includedInCategories" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
<div class="post-meta-line">
|
||||
{{- with .Site.Params.dateformat | default "2006-01-02" | .PublishDate.Format -}}
|
||||
<i class="far fa-calendar-alt fa-fw"></i> <time datetime="{{ . }}">{{ . }}</time>
|
||||
{{- end -}}
|
||||
<i class="fas fa-pencil-alt fa-fw"></i> {{ T "wordCount" .WordCount }}
|
||||
<i class="far fa-clock fa-fw"></i> {{ T "readingTime" .ReadingTime }}
|
||||
{{- $comment := .Scratch.Get "comment" | default dict -}}
|
||||
{{- if $comment.enable | and $comment.valine.enable | and $comment.valine.visitor -}}
|
||||
<span id="{{ .RelPermalink }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
|
||||
<i class="far fa-eye fa-fw"></i> <span class=leancloud-visitors-count></span> {{ T "views" }}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{- /* Featured image */ -}}
|
||||
{{- $image := $params.featuredimage -}}
|
||||
{{- with .Resources.GetMatch "featured-image" -}}
|
||||
{{- $image = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- with $image -}}
|
||||
<div class="featured-image">
|
||||
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
|
||||
</div>
|
||||
{{- 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 -}}
|
||||
</div>
|
||||
|
||||
{{- /* Footer */ -}}
|
||||
{{- partial "single/footer.html" . -}}
|
||||
|
||||
{{- /* Comment */ -}}
|
||||
{{- partial "comment.html" . -}}
|
||||
</article>
|
||||
{{- end -}}
|
64
themes/CodeIT/layouts/robots.txt
Normal file
64
themes/CodeIT/layouts/robots.txt
Normal file
|
@ -0,0 +1,64 @@
|
|||
User-agent: *
|
||||
|
||||
Disallow: /images/
|
||||
Disallow: /js/
|
||||
Disallow: /css/
|
||||
|
||||
User-agent: MJ12bot
|
||||
Disallow: /
|
||||
|
||||
User-agent: AhrefsBot
|
||||
Disallow: /
|
||||
|
||||
User-agent: BLEXBot
|
||||
Disallow: /
|
||||
|
||||
# Block SISTRIX
|
||||
User-agent: SISTRIX Crawler
|
||||
Disallow: /
|
||||
User-agent: sistrix
|
||||
Disallow: /
|
||||
User-agent: 007ac9
|
||||
Disallow: /
|
||||
User-agent: 007ac9 Crawler
|
||||
Disallow: /
|
||||
|
||||
# Block Uptime robot
|
||||
User-agent: UptimeRobot/2.0
|
||||
Disallow: /
|
||||
|
||||
# Block Ezooms Robot
|
||||
User-agent: Ezooms Robot
|
||||
Disallow: /
|
||||
|
||||
# Block Perl LWP
|
||||
User-agent: Perl LWP
|
||||
Disallow: /
|
||||
|
||||
# Block netEstate NE Crawler (+http://www.website-datenbank.de/)
|
||||
User-agent: netEstate NE Crawler (+http://www.website-datenbank.de/)
|
||||
Disallow: /
|
||||
|
||||
# Block WiseGuys Robot
|
||||
User-agent: WiseGuys Robot
|
||||
Disallow: /
|
||||
|
||||
# Block Turnitin Robot
|
||||
User-agent: Turnitin Robot
|
||||
Disallow: /
|
||||
|
||||
# Block Heritrix
|
||||
User-agent: Heritrix
|
||||
Disallow: /
|
||||
|
||||
# Block pricepi
|
||||
User-agent: pimonster
|
||||
Disallow: /
|
||||
|
||||
User-agent: SurdotlyBot
|
||||
Disallow: /
|
||||
|
||||
User-agent: ZoominfoBot
|
||||
Disallow: /
|
||||
|
||||
Sitemap: {{ "/sitemap.xml" | absLangURL }}
|
41
themes/CodeIT/layouts/shortcodes/admonition.html
Normal file
41
themes/CodeIT/layouts/shortcodes/admonition.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
{{- $inner := .Inner | .Page.RenderString -}}
|
||||
|
||||
{{- $iconMap := dict "note" "fas fa-pencil-alt fa-fw" -}}
|
||||
{{- $iconMap = dict "abstract" "fas fa-list-ul fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "info" "fas fa-info-circle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "tip" "fas fa-lightbulb fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "success" "fas fa-check-circle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "question" "fas fa-question-circle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "warning" "fas fa-exclamation-triangle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "failure" "fas fa-times-circle fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "danger" "fas fa-skull-crossbones fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "bug" "fas fa-bug fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "example" "fas fa-list-ol fa-fw" | merge $iconMap -}}
|
||||
{{- $iconMap = dict "quote" "fas fa-quote-right fa-fw" | merge $iconMap -}}
|
||||
{{- $iconDetails := "fas fa-angle-right fa-fw" -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $type := .Get "type" | default "note" -}}
|
||||
<div class="details admonition {{ $type }}{{ if .Get `open` | ne false }} open{{ end }}">
|
||||
<div class="details-summary admonition-title">
|
||||
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get "title" | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i>
|
||||
</div>
|
||||
<div class="details-content">
|
||||
<div class="admonition-content">
|
||||
{{- $inner -}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{- else -}}
|
||||
{{- $type := .Get 0 | default "note" -}}
|
||||
<div class="details admonition {{ $type }}{{ if .Get 2 | ne false }} open{{ end }}">
|
||||
<div class="details-summary admonition-title">
|
||||
<i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get 1 | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i>
|
||||
</div>
|
||||
<div class="details-content">
|
||||
<div class="admonition-content">
|
||||
{{- $inner -}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
7
themes/CodeIT/layouts/shortcodes/bilibili.html
Normal file
7
themes/CodeIT/layouts/shortcodes/bilibili.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<div class="bilibili">
|
||||
{{- if .IsNamedParams -}}
|
||||
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get `id` }}&page={{ .Get `p` | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
{{- else -}}
|
||||
<iframe src="//player.bilibili.com/player.html?bvid={{ .Get 0 }}&page={{ .Get 1 | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
|
||||
{{- end -}}
|
||||
</div>
|
6
themes/CodeIT/layouts/shortcodes/echarts.html
Normal file
6
themes/CodeIT/layouts/shortcodes/echarts.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{- $content := .Inner | transform.Unmarshal | jsonify -}}
|
||||
{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}}
|
||||
{{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}}
|
||||
<div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
|
||||
{{- .Page.Scratch.SetInMap "this" "echarts" true -}}
|
29
themes/CodeIT/layouts/shortcodes/image.html
Normal file
29
themes/CodeIT/layouts/shortcodes/image.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
{{- $options := cond .IsNamedParams (.Get "src") (.Get 0) | dict "Src" -}}
|
||||
{{- $options = cond .IsNamedParams (.Get "alt") (.Get 1) | .Page.RenderString | dict "Alt" | merge $options -}}
|
||||
{{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}}
|
||||
{{- $options = dict "Caption" $caption | merge $options -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $options = dict "Title" (.Get "title") | merge $options -}}
|
||||
{{- $options = dict "SrcSmall" (.Get "src_s") | merge $options -}}
|
||||
{{- $options = dict "SrcLarge" (.Get "src_l") | merge $options -}}
|
||||
{{- $options = dict "Height" (.Get "height") | merge $options -}}
|
||||
{{- $options = dict "Width" (.Get "width") | merge $options -}}
|
||||
{{- $options = .Get "linked" | ne false | dict "Linked" | merge $options -}}
|
||||
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
|
||||
{{- else -}}
|
||||
{{- $options = cond $caption true false | dict "Linked" | merge $options -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $options = dict "Resources" .Page.Resources | merge $options -}}
|
||||
|
||||
{{- with $caption -}}
|
||||
<figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}>
|
||||
{{- partial "plugin/image.html" $options -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- . | safeHTML -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
{{- partial "plugin/image.html" $options -}}
|
||||
{{- end -}}
|
15
themes/CodeIT/layouts/shortcodes/link.html
Normal file
15
themes/CodeIT/layouts/shortcodes/link.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
{{- $destination := cond .IsNamedParams (.Get "href") (.Get 0) -}}
|
||||
{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "Destination" $destination -}}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $options = dict "Content" (.Get "content") | merge $options -}}
|
||||
{{- $options = dict "Title" (.Get "title") | merge $options -}}
|
||||
{{- $options = dict "Class" (.Get "class") | merge $options -}}
|
||||
{{- $options = dict "Rel" (.Get "rel") | merge $options -}}
|
||||
{{- else -}}
|
||||
{{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}}
|
||||
{{- $options = dict "Title" (.Get 2) | merge $options -}}
|
||||
{{- end -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
33
themes/CodeIT/layouts/shortcodes/mapbox.html
Normal file
33
themes/CodeIT/layouts/shortcodes/mapbox.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
{{- $mapbox := (.Page.Scratch.Get "params").mapbox | default dict -}}
|
||||
|
||||
{{- $lng := cond .IsNamedParams (.Get "lng") (.Get 0) -}}
|
||||
{{- $lat := cond .IsNamedParams (.Get "lat") (.Get 1) -}}
|
||||
{{- $zoom := cond .IsNamedParams (.Get "zoom") (.Get 2) | default 10 -}}
|
||||
{{- $marked := cond .IsNamedParams (.Get "marked") (.Get 3) | ne false -}}
|
||||
{{- $lightStyle := $mapbox.lightStyle -}}
|
||||
{{- $darkStyle := $mapbox.darkStyle -}}
|
||||
{{- $navigation := $mapbox.navigation -}}
|
||||
{{- $geolocate := $mapbox.geolocate -}}
|
||||
{{- $scale := $mapbox.scale -}}
|
||||
{{- $fullscreen := $mapbox.fullscreen -}}
|
||||
{{- $width := "100%" -}}
|
||||
{{- $height := "20rem" -}}
|
||||
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $lightStyle = .Get "light-style" | default $lightStyle -}}
|
||||
{{- $darkStyle = .Get "dark-style" | default $darkStyle -}}
|
||||
{{- $navigation = .Get "navigation" | ne false | and $navigation -}}
|
||||
{{- $geolocate = .Get "geolocate" | ne false | and $geolocate -}}
|
||||
{{- $scale = .Get "scale" | ne false | and $scale -}}
|
||||
{{- $fullscreen = .Get "fullscreen" | ne false | and $fullscreen -}}
|
||||
{{- $width = .Get "width" | default $width -}}
|
||||
{{- $height = .Get "height" | default $height -}}
|
||||
{{- else -}}
|
||||
{{- $lightStyle = .Get 4 | default $lightStyle -}}
|
||||
{{- $darkStyle = .Get 5 | default $darkStyle -}}
|
||||
{{- end -}}
|
||||
{{- $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 -}}
|
||||
{{- $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 -}}
|
3
themes/CodeIT/layouts/shortcodes/mermaid.html
Normal file
3
themes/CodeIT/layouts/shortcodes/mermaid.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{- $id := dict "Content" (trim .Inner "\n") "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
<div class="mermaid" id="{{ $id }}"></div>
|
||||
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}}
|
50
themes/CodeIT/layouts/shortcodes/music.html
Normal file
50
themes/CodeIT/layouts/shortcodes/music.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{- $theme := "#448aff" -}}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- $theme = .Get "theme" | default $theme -}}
|
||||
{{- if .Get "url" -}}
|
||||
{{- $url := .Get "url" -}}
|
||||
{{- with dict "Path" $url "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $url = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $cover := .Get "cover" -}}
|
||||
{{- with dict "Path" $cover "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $cover = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
<meting-js url="{{ $url }}" name="{{ .Get `name` }}" artist="{{ .Get `artist` }}" cover="{{ $cover }}" theme="{{ $theme }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- else if .Get "auto" -}}
|
||||
<meting-js auto="{{ .Get `auto` }}" theme="{{ $theme }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "loop" }} loop="{{ . }}"{{ end -}}
|
||||
{{- with .Get "order" }} order="{{ . }}"{{ end -}}
|
||||
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- else -}}
|
||||
<meting-js server="{{ .Get `server` }}" type="{{ .Get `type` }}" id="{{ .Get `id` }}" theme="{{ $theme }}"
|
||||
{{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mini" }} mini="{{ . }}"{{ end -}}
|
||||
{{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}}
|
||||
{{- with .Get "loop" }} loop="{{ . }}"{{ end -}}
|
||||
{{- with .Get "order" }} order="{{ . }}"{{ end -}}
|
||||
{{- with .Get "volume" }} volume="{{ . }}"{{ end -}}
|
||||
{{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}}
|
||||
{{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}}
|
||||
></meting-js>
|
||||
{{- end -}}
|
||||
{{- else if (.Get 0 | urls.Parse).Host -}}
|
||||
<meting-js auto="{{ .Get 0 }}" theme="{{ $theme }}"></meting-js>
|
||||
{{- else -}}
|
||||
<meting-js server="{{ .Get 0 }}" type="{{ .Get 1 }}" id="{{ .Get 2 }}" theme="{{ $theme }}"></meting-js>
|
||||
{{- end -}}
|
||||
{{- .Page.Scratch.SetInMap "this" "music" true -}}
|
2
themes/CodeIT/layouts/shortcodes/script.html
Normal file
2
themes/CodeIT/layouts/shortcodes/script.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{- $scriptArr := (.Page.Scratch.Get "this").scriptArr | default slice -}}
|
||||
{{- $scriptArr | append (trim .Inner "\n") | .Page.Scratch.SetInMap "this" "scriptArr" -}}
|
8
themes/CodeIT/layouts/shortcodes/style.html
Normal file
8
themes/CodeIT/layouts/shortcodes/style.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{{- $content := .Inner | .Page.RenderString -}}
|
||||
{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $tag := .Get 1 | default "div" -}}
|
||||
{{- printf `<%v id="%v">%v</%v>` $tag $id $content $tag | safeHTML -}}
|
||||
|
||||
{{- $style := .Get 0 | printf "#%v{%v}" $id -}}
|
||||
{{- $styleArr := (.Page.Scratch.Get "this").styleArr | default slice -}}
|
||||
{{- $styleArr | append $style | .Page.Scratch.SetInMap "this" "styleArr" -}}
|
31
themes/CodeIT/layouts/shortcodes/typeit.html
Normal file
31
themes/CodeIT/layouts/shortcodes/typeit.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
{{- $content := trim .Inner "\n" -}}
|
||||
{{- $classList := .Get "class" | slice -}}
|
||||
{{- $tag := .Get "tag" | default "div" -}}
|
||||
|
||||
{{- with .Get "code" -}}
|
||||
{{- /* highlight code content without line number */ -}}
|
||||
{{- $content = highlight $content . "linenos=false" -}}
|
||||
{{- /* delete outer label */ -}}
|
||||
{{- $content = replaceRE `<div class="highlight"><pre class="chroma"><code[^<>]*>(?s)(.*)</code></pre></div>` "$1" $content -}}
|
||||
{{- /* parsing markdown links */ -}}
|
||||
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=$4>$3</a>$1$5$6" $content -}}
|
||||
{{- /* replace " " to " " and replace "\n" to "<br />" */ -}}
|
||||
{{- $content = replaceRE ` ` " " $content | replaceRE `(<\w+) ` "$1 " | replaceRE `\n` "<br />" -}}
|
||||
{{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}}
|
||||
{{- $content = replaceRE `<br /></span>` "</span><br />" $content -}}
|
||||
{{- $classList = $classList | append "highlight" -}}
|
||||
{{- else -}}
|
||||
{{- $content = $content | .Page.RenderString -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* trim the newline */ -}}
|
||||
{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $key := .Get "group" | string | default $id -}}
|
||||
{{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}}
|
||||
{{- $group := index $typeitMap $key -}}
|
||||
{{- $group = $group | default slice | append $id -}}
|
||||
{{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}}
|
||||
|
||||
<div class="typeit">
|
||||
{{- printf `<%v id="%v" class="%v"></%v>` $tag $id (delimit $classList " ") $tag | safeHTML -}}
|
||||
</div>
|
13
themes/CodeIT/layouts/shortcodes/version.html
Normal file
13
themes/CodeIT/layouts/shortcodes/version.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{- $version := .Get 0 -}}
|
||||
{{- $url := printf "https://github.com/sunt-programator/CodeIT/releases/tag/v%v" $version -}}
|
||||
{{- $type := .Get 1 | default "new" | lower -}}
|
||||
{{- $label := T $type -}}
|
||||
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
|
||||
{{- $pathTemplate := cond .Site.IsMultiLingual (printf "svg/version/%%v-%%v.%v.svg" .Page.Language.Lang) "svg/version/%v-%v.svg" -}}
|
||||
{{- $path := printf $pathTemplate $version $type -}}
|
||||
{{- $resource := resources.Get "svg/version.template.svg" -}}
|
||||
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
|
||||
{{- $alt := printf "CodeIT %v | %v" $label $version -}}
|
||||
<a href="{{ $url }}" rel="noopener noreferrer" target="_blank">
|
||||
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
|
||||
</a>
|
47
themes/CodeIT/layouts/sitemap.xml
Normal file
47
themes/CodeIT/layouts/sitemap.xml
Normal file
|
@ -0,0 +1,47 @@
|
|||
<urlset
|
||||
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
>
|
||||
{{- range (where .Data.Pages "Section" "!=" "gallery") -}}
|
||||
<url>
|
||||
<loc>
|
||||
{{- .Permalink -}}
|
||||
</loc>
|
||||
{{- if not .Lastmod.IsZero -}}
|
||||
<lastmod>
|
||||
{{- .Lastmod.Format "2006-01-02T15:04:05-07:00" -}}
|
||||
</lastmod>
|
||||
{{- end -}}
|
||||
{{- with .Sitemap.ChangeFreq -}}
|
||||
<changefreq>
|
||||
{{- . -}}
|
||||
</changefreq>
|
||||
{{- end -}}
|
||||
|
||||
{{- if ge .Sitemap.Priority 0.0 -}}
|
||||
{{- $weeks := div (sub now.Unix .Lastmod.Unix) 604800 -}}
|
||||
{{- $priority := sub 1 (div $weeks 10.0 ) -}}
|
||||
{{- if ge .Sitemap.Priority $priority -}}
|
||||
<priority>{{ .Sitemap.Priority }}</priority>
|
||||
{{- else -}}
|
||||
<priority>{{ $priority }}</priority>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .IsTranslated -}}
|
||||
{{- range .Translations -}}
|
||||
<xhtml:link
|
||||
rel="alternate"
|
||||
hreflang="{{ .Lang }}"
|
||||
href="{{ .Permalink }}"
|
||||
/>
|
||||
{{- end -}}
|
||||
<xhtml:link
|
||||
rel="alternate"
|
||||
hreflang="{{ .Lang }}"
|
||||
href="{{ .Permalink }}"
|
||||
/>
|
||||
{{- end -}}
|
||||
</url>
|
||||
{{- end -}}
|
||||
</urlset>
|
43
themes/CodeIT/layouts/taxonomy/list.html
Normal file
43
themes/CodeIT/layouts/taxonomy/list.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
{{- define "title" -}}
|
||||
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
<div class="page archive">
|
||||
{{- /* Title */ -}}
|
||||
<h2 class="single-title animated pulse faster">
|
||||
{{- $taxonomy := .Data.Singular -}}
|
||||
{{- if eq $taxonomy "category" -}}
|
||||
<i class="far fa-folder-open fa-fw"></i> {{ .Title }}
|
||||
{{- else if eq $taxonomy "tag" -}}
|
||||
<i class="fas fa-tag fa-fw"></i> {{ .Title }}
|
||||
{{- else -}}
|
||||
{{- printf "%v - %v" (T $taxonomy | default $taxonomy) .Title -}}
|
||||
{{- end -}}
|
||||
</h2>
|
||||
|
||||
{{- /* Paginate */ -}}
|
||||
{{- if .Pages -}}
|
||||
{{- $pages := .Pages.GroupByDate "2006" -}}
|
||||
{{- with .Site.Params.list.paginate | default .Site.Params.paginate -}}
|
||||
{{- $pages = $.Paginate $pages . -}}
|
||||
{{- else -}}
|
||||
{{- $pages = .Paginate $pages -}}
|
||||
{{- end -}}
|
||||
{{- range $pages.PageGroups -}}
|
||||
<h3 class="group-title">{{ .Key }}</h3>
|
||||
{{- range .Pages -}}
|
||||
<article class="archive-item">
|
||||
<a href="{{ .RelPermalink }}" class="archive-item-link">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
<span class="archive-item-date">
|
||||
{{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}}
|
||||
</span>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- partial "paginator.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
41
themes/CodeIT/layouts/taxonomy/rss.xml
Normal file
41
themes/CodeIT/layouts/taxonomy/rss.xml
Normal file
|
@ -0,0 +1,41 @@
|
|||
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
|
||||
<channel>
|
||||
<title>
|
||||
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
|
||||
</title>
|
||||
<link>
|
||||
{{- .Permalink -}}
|
||||
</link>
|
||||
<description>
|
||||
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
|
||||
</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
{{- with .Site.LanguageCode -}}
|
||||
<language>
|
||||
{{- . -}}
|
||||
</language>
|
||||
{{- end -}}
|
||||
{{- with .Site.Author.email -}}
|
||||
<managingEditor>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</managingEditor>
|
||||
<webMaster>
|
||||
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
|
||||
</webMaster>
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
<copyright>
|
||||
{{- . -}}
|
||||
</copyright>
|
||||
{{- end -}}
|
||||
{{- if not .Date.IsZero -}}
|
||||
<lastBuildDate>
|
||||
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
|
||||
</lastBuildDate>
|
||||
{{- end -}}
|
||||
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
|
||||
{{- range .Pages | first (.Site.Params.list.rss | default 10) -}}
|
||||
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
|
||||
{{- end -}}
|
||||
</channel>
|
||||
</rss>
|
57
themes/CodeIT/layouts/taxonomy/terms.html
Normal file
57
themes/CodeIT/layouts/taxonomy/terms.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
{{- define "title" -}}
|
||||
{{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "allSome" }} - {{ .Site.Title -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $taxonomies := .Data.Plural -}}
|
||||
{{- $terms := .Data.Terms.ByCount -}}
|
||||
{{- $type := .Type -}}
|
||||
|
||||
<div class="page archive">
|
||||
{{- /* Title */ -}}
|
||||
<h2 class="single-title animated pulse faster">
|
||||
{{- .Params.Title | default (T $taxonomies) | default $taxonomies | dict "Some" | T "allSome" -}}
|
||||
</h2>
|
||||
|
||||
{{- /* Categories Page */ -}}
|
||||
{{- if eq $taxonomies "categories" -}}
|
||||
<div class="categories-card">
|
||||
{{- range $terms -}}
|
||||
{{- $term := .Term -}}
|
||||
{{- $pages := .Pages -}}
|
||||
{{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $type $term) -}}
|
||||
<div class="card-item">
|
||||
<div class="card-item-wrapper">
|
||||
<h3 class="card-item-title">
|
||||
<a href="{{ .RelPermalink }}">
|
||||
<i class="far fa-folder fa-fw"></i> {{ .Page.Title }}
|
||||
</a>
|
||||
</h3>
|
||||
{{- range first 5 $pages -}}
|
||||
<article class="archive-item">
|
||||
<a href="{{ .RelPermalink }}" class="archive-item-link">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- if gt (len $pages) 5 -}}
|
||||
<span class="more-post">
|
||||
<a href="{{ .RelPermalink }}" class="more-single-link">{{ T "more" }} >></a>
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Tag Cloud Page */ -}}
|
||||
{{- else if eq $taxonomies "tags" -}}
|
||||
<div class="tag-cloud-tags">
|
||||
{{- range $.Site.Taxonomies.tags.ByCount -}}
|
||||
<a href="{{ .Page.RelPermalink }}">{{ .Page.Title }} <sup>{{ .Count }}</sup></a>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue