diff options
Diffstat (limited to 'layouts')
30 files changed, 548 insertions, 363 deletions
diff --git a/layouts/404.html b/layouts/404.html index 25d445d..7829b6f 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -7,7 +7,7 @@ <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> + <a href="javascript:void(0);" title="{{ T `back` }}" onclick="window.history.back();">{{ T `back` }}</a> </p> </div> <script> diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index e6ffb9d..1eb5d91 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -5,13 +5,24 @@ {{ $caption = " " }} {{- end -}} +{{ $imageOriginal := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) }} +{{ if $imageOriginal }} +{{ if lt 1600 $imageOriginal.Width }} +{{ $imageOriginal = ($imageOriginal.Resize "1600x q100").Permalink }} +{{ end }} +{{ else }} +{{ $imageOriginal = .Destination }} +{{ end }} + +<div class="render-image"> {{- if $figcap -}} <figure> - {{- dict "Src" .Destination "Title" $figcap "Alt" $alt "Caption" $caption "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}} + {{- dict "Src" $imageOriginal "Title" $figcap "Alt" $alt "Caption" $caption "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}} <figcaption class="image-caption"> {{- $figcap | safeHTML -}} </figcaption> </figure> {{- else -}} -{{- dict "Src" .Destination "Title" (path.Base .Destination) "Alt" $alt "Resources" .Page.Resources | partial "plugin/image.html" -}} +{{- dict "Src" $imageOriginal "Title" (path.Base .Destination) "Alt" $alt "Resources" .Page.Resources | partial "plugin/image.html" -}} {{- end -}} +</div> diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 98c1d76..a8b4886 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -5,14 +5,22 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="robots" content="noodp" /> + {{- block "robots" . }}<meta name="robots" content="noodp" />{{ end -}} <title> {{- block "title" . }}{{ .Site.Title }}{{ end -}} </title> {{- partial "head/meta.html" . -}} {{- partial "head/link.html" . -}} + {{- partial "head/seo.html" . -}} + {{- block "dnsPrefetch" . }} + {{- with $.Site.Params.Seo.dnsPrefetch -}} + {{- range $index, $value := . -}} + <link rel="dns-prefetch" href="{{ $value }}"> + {{- end -}} + {{- end -}} + {{ end -}} </head> <body data-header-desktop="{{ .Site.Params.header.desktopMode }}" data-header-mobile="{{ .Site.Params.header.mobileMode }}"> {{- /* Check theme isDark before body rendering */ -}} @@ -37,12 +45,12 @@ <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> + <i class="svg-icon icon-arrow-up"></i> </a> {{- /* comment button */ -}} <a href="#" id="view-comments" class="fixed-button" title="{{ T `viewComments` }}"> - <i class="fas fa-comment fa-fw"></i> + <i class="svg-icon icon-comments-fixed"></i> </a> </div> diff --git a/layouts/_default/section.html b/layouts/_default/section.html index 882c1ae..b476ebf 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -2,10 +2,14 @@ {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}} {{- end -}} +{{- define "robots" -}} +<meta name="robots" content="noindex, follow" /> +{{- end -}} + {{- define "content" -}} <div class="page archive"> {{- /* Title */ -}} - <h2 class="single-title animated pulse faster"> + <h2 class="single-title pulse faster"> {{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" -}} </h2> diff --git a/layouts/_default/single.html b/layouts/_default/single.html index a34e22b..7f18728 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,7 +4,7 @@ {{- $params := .Scratch.Get "params" -}} <div class="page single special"> {{- /* Title */ -}} - <h1 class="single-title animated pulse faster"> + <h1 class="single-title pulse faster"> {{- .Title -}} </h1> @@ -15,7 +15,7 @@ {{- /* Content */ -}} <div class="content" id="content"> - {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction | partial "function/content.html" | safeHTML -}} </div> {{- /* Comment */ -}} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 8627793..fee5664 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -2,15 +2,15 @@ {{- $tagsStyle := $params.summaryStyle.tags -}} {{- $tagsTheme := $params.summaryStyle.tags.theme | default "image" -}} -<article onclick="location.href='{{ $.RelPermalink }}'" class="summary summary-animation" itemscope itemtype="http://schema.org/Article" style="margin-bottom:0"> +<article onclick="window.open('{{ $.RelPermalink }}')" class="summary summary-animation" itemscope itemtype="http://schema.org/Article" style="margin-bottom:0"> {{- /* Featured image */ -}} {{- if not $params.summaryStyle.hiddenImage -}} {{- $image := $params.featuredimagepreview | default $params.featuredimage -}} {{- with .Resources.GetMatch "featured-image" -}} - {{- $image = .RelPermalink -}} + {{- $image = (.Fill "796x238 Center q90").RelPermalink -}} {{- end -}} {{- with .Resources.GetMatch "featured-image-preview" -}} - {{- $image = .RelPermalink -}} + {{- $image = (.Fill "796x238 Center q90").RelPermalink -}} {{- end -}} {{- with $image -}} <div class="featured-image-preview"> @@ -24,7 +24,7 @@ </div> {{- end -}} {{- end -}} - {{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}} + {{- dict "Src" . "Title" $.Description "Resources" $.Resources "Height" 798 "Width" 238 | partial "plugin/image.html" -}} </div> {{- end -}} {{- end -}} @@ -37,19 +37,19 @@ {{- if not $params.summaryStyle.hiddenMeta -}} {{- /* Meta */ -}} <div class="post-meta summary-post-meta"> - {{- $authorName := $params.author | default .Site.Author.name | default " " -}} + {{- $authorName := $params.name | default .Site.Author.name | default " " -}} {{- if not (eq $authorName " ") -}} {{ $author := index .Site.Data.authors $authorName }} {{- $authorLink := $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.nickname -}} + {{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "svg-icon icon-user") "Content" $author.nickname -}} {{- partial "plugin/link.html" $options -}} </span> {{- end -}} {{- with .Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format -}} {{- $timeAgoDate:= $.Site.Params.TimeAgo.DateFormat | default "2006-01-02" | $.PublishDate.Format -}} - <span class="post-publish"><i class="far fa-clock fa-fw"></i> + <span class="post-publish"><i class="svg-icon icon-clock"></i> {{- printf `<time class="timeago" datetime="%v">%v</time>` $timeAgoDate . | safeHTML -}} </span> {{- end -}} @@ -57,20 +57,25 @@ {{- $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) -}} + {{- $categories = $categories | append (printf `<a href="%v"><i class="svg-icon icon-folder"></i>%v</a>` $category.RelPermalink $category.Title) -}} {{- end -}} {{- with delimit $categories " " -}} - <span class="post-category"> + <span class="post-category"> {{ . }} </span> {{- end -}} + {{- with .Params.Views -}} + <span class="post-meta-views"> + <i class="svg-icon icon-eye"></i>{{ . }} + </span> + {{- end -}} + {{- $comment := .Site.Params.Comment -}} {{- $remark42 := $comment.remark42 | default dict -}} {{- if $remark42.enable -}} - <i class="far fa-comment fa-fw"></i> - <span class="remark42__counter" data-url="{{ .Permalink }}"> - + <span class="post-meta-comments"> + <i class="svg-icon icon-comments"></i><span class="remark42__counter" data-url="{{ .Permalink }}"></span> </span> {{- end -}} </div> @@ -80,7 +85,7 @@ {{- if not $params.summaryStyle.hiddenDescription -}} <div class="content summary-content"> {{- with .Summary -}} - {{- dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + {{- dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction | partial "function/content.html" | safeHTML -}} {{- else -}} {{- .Description | safeHTML -}} {{- end -}} diff --git a/layouts/index.html b/layouts/index.html index 39939bf..1c41cc7 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -13,7 +13,7 @@ {{- 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 -}} + {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction | partial "function/content.html" | safeHTML -}} </div> </div> {{- end -}} @@ -27,11 +27,31 @@ {{- else -}} {{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}} {{- end -}} + + {{ $pinnedPostRelPermalinks := split .Site.Params.pinnedPost "," }} + {{ $pinnedPosts := where $pages "RelPermalink" "in" $pinnedPostRelPermalinks }} + {{ $pages := where $pages "RelPermalink" "not in" $pinnedPostRelPermalinks }} + {{- with $posts.paginate | default .Site.Params.paginate -}} {{- $pages = $.Paginate $pages . -}} {{- else -}} {{- $pages = .Paginate $pages -}} {{- end -}} + + {{ if .Site.Params.pinnedPost }} + {{ if (and .Site.Params.pinOnlyToFirstPage (ne $pages.PageNumber 1)) }} + {{/* Do nothing if the pinOnlyToFirstPage flag is set and we're not on page 1. */}} + {{else}} + + {{ range $pinnedPosts }} + <div class="post-pinned"> + {{- .Render "summary" -}} + </div> + + {{end}} + {{end}} + {{end}} + {{- range $pages.Pages -}} {{- .Render "summary" -}} {{- end -}} diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html index 10db3d6..53729a1 100644 --- a/layouts/partials/assets.html +++ b/layouts/partials/assets.html @@ -34,10 +34,6 @@ {{- 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" -}} @@ -45,19 +41,6 @@ {{- $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 -}} @@ -74,14 +57,6 @@ {{- 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 -}} @@ -192,12 +167,6 @@ {{- dict "Source" "js/theme.min.js" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}} -{{- /* Jquery script */ -}} -{{- dict "Source" "js/jquery-3.5.1.min.js" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} -{{- $_ := (resources.Get "js/jquery-3.5.1.min.map").RelPermalink -}} - -{{- partial "plugin/timeago.html" . -}} - {{- with (.Scratch.Get "this").scriptArr -}} {{- delimit . "\n" | dict "Content" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 299bd5b..ad257ad 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -12,7 +12,7 @@ {{- if ne .Site.Params.footer.hugo false -}} <div class="footer-line"> {{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo %v">Hugo</a>` hugo.Version -}} - {{- $theme := .Scratch.Get "version" | printf `<a href="https://ublogger.netlify.app/?utm_source=%v&utm_medium=footer&utm_campaign=config&utm_term=%v" target="_blank" title="uBlogger %v"><i class="fas fa-pencil-alt fa-fw"></i> uBlogger</a>` $.Site.BaseURL (.Scratch.Get "version") -}} + {{- $theme := .Scratch.Get "version" | printf `<a href="https://ublogger.netlify.app/?utm_source=%v&utm_medium=footer&utm_campaign=config&utm_term=%v" target="_blank" title="uBlogger %v">uBlogger</a>` $.Site.BaseURL (.Scratch.Get "version") -}} {{- dict "Hugo" $hugo "Theme" $theme | T "poweredBySome" | safeHTML }} </div> {{- end -}} @@ -20,7 +20,7 @@ <div class="footer-line"> {{- /* Copyright year */ -}} {{- if ne .Site.Params.footer.copyright false -}} - <i class="far fa-copyright fa-fw"></i> + <i class="svg-icon icon-copyright"></i> {{- with .Site.Params.footer.since -}} <span> {{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}} @@ -35,7 +35,7 @@ {{- if ne $authorName " " -}} {{ $author := index .Site.Data.authors $authorName }} {{- $authorLink := $author.link | default .Site.Home.RelPermalink -}} - <span class="author" itemprop="copyrightHolder"> <a href="{{ $authorLink }}" target="_blank">{{ $author.nickname }}</a></span> + <span class="author"> <a href="{{ $authorLink }}" target="_blank">{{ $author.nickname }}</a></span> {{- end -}} {{- /* License */ -}} diff --git a/layouts/partials/function/content.html b/layouts/partials/function/content.html index fbc7731..5468c7a 100644 --- a/layouts/partials/function/content.html +++ b/layouts/partials/function/content.html @@ -9,10 +9,6 @@ {{- $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 -}} diff --git a/layouts/partials/function/fontawesome.html b/layouts/partials/function/fontawesome.html deleted file mode 100644 index 9d64c3d..0000000 --- a/layouts/partials/function/fontawesome.html +++ /dev/null @@ -1,14 +0,0 @@ -{{- /* 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 -}} diff --git a/layouts/partials/head/link.html b/layouts/partials/head/link.html index 79eb8b7..31c7f81 100644 --- a/layouts/partials/head/link.html +++ b/layouts/partials/head/link.html @@ -8,6 +8,8 @@ <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"> + <link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png"> + <link rel="icon" type="image/png" sizes="512x512" href="/android-chrome-512x512.png"> {{- end -}} <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> {{- with .Site.Params.app.iconColor -}} @@ -17,12 +19,6 @@ {{- 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 }}"> @@ -31,7 +27,7 @@ {{- /* Advertising */ -}} {{- if .Site.Params.Advertising.Enable -}} -{{- with .Site.Params.Advertising.Google -}} +{{- with .Site.Params.Advertising.Google.Client -}} <script data-ad-client="{{ . }}" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> {{- end -}} {{- end -}} @@ -47,11 +43,6 @@ {{- $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 -}} diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index 2067721..894436d 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -16,6 +16,8 @@ <meta name="baidu-site-verification" content="{{ . }}" /> {{- end -}} + + {{- /* Home SEO */ -}} {{- if .IsHome -}} <script type="application/ld+json"> @@ -35,18 +37,20 @@ {{- with .Site.Params.description -}} "description": {{ . | safeHTML }}, {{- end -}} - {{- $image := .Site.Params.seo.image -}} - {{- with dict "Path" $image "Resources" .Resources | partial "function/resource.html" -}} + {{- $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 -}} "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" -}} @@ -122,29 +126,26 @@ {{- 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 -}} + {{- $publisherName := default .Site.Author.name | default " " -}} + {{ $publisher := index .Site.Data.authors $publisherName }} "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 -}} + "@type": "Person", + "name": {{ $publisher.full_name | safeHTML }} + {{- with $publisher.avatar -}} + , "image": [ + { + "@type": "ImageObject", + "url": "{{ . }}" + } + ] {{- end -}} }, - {{- with .Params.author | default .Site.Author.name | default (T "author") -}} + {{- $authorName := $params.author | default .Site.Author.name | default " " -}} + {{ $author := index .Site.Data.authors $authorName }} + {{- with $author -}} "author": { "@type": "Person", - "name": {{ . | safeHTML }} + "name": {{ .full_name | safeHTML }} }, {{- end -}} "description": {{ .Description | safeHTML }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index f321493..4087190 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -2,21 +2,23 @@ <header class="desktop" id="header-desktop"> <div class="header-wrapper"> <div class="header-title"> - <a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}" class="header-logo"> + <a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}" class="header-logo logo-svg"> {{- with .Site.Params.header.title -}} {{- with .logo -}} {{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}} {{- end -}} + {{- with .logoSvg }} + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 36" width="96" height="36" style="vertical-align: middle"> + <style>tspan{white-space:pre}</style> + <path class="logo-svg" d="{{ . }}"/> + </svg> + {{- 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 -}} + + {{- .name -}} + {{- with .post -}} <span class="header-title-post">{{ . | safeHTML }}</span> {{- end -}} @@ -42,7 +44,6 @@ {{- 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 -}} @@ -65,18 +66,18 @@ <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> + <span class="svg-icon icon-search"></span> </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> + <span class="svg-icon icon-cancel"></span> </a> <span class="search-button search-loading" id="search-loading-desktop"> - <i class="fas fa-spinner fa-fw fa-spin"></i> + <span class="svg-icon icon-loading"></span> </span> </span> {{- end -}} <a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}"> - <i class="fas fa-adjust fa-fw"></i> + <span class="svg-icon icon-moon"></span> </a> </div> </div> @@ -93,16 +94,18 @@ {{- with .logo -}} {{- dict "Src" . "Class" "logo" | partial "plugin/image.html" -}} {{- end -}} + {{- with .logoSvg }} + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 36" width="96" height="36" style="vertical-align: middle"> + <style>tspan{white-space:pre}</style> + <path class="logo-svg" d="{{ . }}"/> + </svg> + {{- 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 -}} + + {{- .name -}} + {{- with .post -}} <span class="header-title-post">{{ . | safeHTML }}</span> {{- end -}} @@ -121,13 +124,13 @@ <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> + <span class="svg-icon icon-search"></span> </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> + <span class="svg-icon icon-cancel"></span> </a> <span class="search-button search-loading" id="search-loading-mobile"> - <i class="fas fa-spinner fa-fw fa-spin"></i> + <span class="svg-icon icon-loading"></span> </span> </div> <a href="javascript:void(0);" class="search-cancel" id="search-cancel-mobile"> @@ -146,12 +149,11 @@ </a> {{- end -}} <a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}"> - <i class="fas fa-adjust fa-fw"></i> + <span class="svg-icon icon-moon"></span> </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 -}} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 8b1c49e..de234bc 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -31,13 +31,7 @@ {{- with $profile.subtitle -}} <div 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 -}} - {{- . | safeHTML -}} - {{- end -}} + {{- . | safeHTML -}} </div> {{- end -}} diff --git a/layouts/partials/plugin/image.html b/layouts/partials/plugin/image.html index 5a7f9d8..3a98b21 100644 --- a/layouts/partials/plugin/image.html +++ b/layouts/partials/plugin/image.html @@ -1,40 +1,22 @@ -{{- /* 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 -}} -<div style="text-align: center"> + {{- if .Linked -}} - <a target="_blank" 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 }} 1.6x" + <a target="_blank" href="{{ .Src | safeURL }}" title="{{ .Title | default $alt }}" {{ with .Rel }} rel="{{ . }}"{{ end }}> + <img loading="lazy" decoding="async" data-sizes="auto" - alt="{{ $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} /> + src="{{ .Src | safeURL }}" + 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 }} 1.6x" - data-sizes="auto" - alt="{{ $alt }}" - title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} /> + <img loading="lazy" decoding="async" + src="{{ .Src | safeURL }}" + alt="{{ $alt }}" + title="{{ .Title | default $alt }}"{{ with .Height }} height="{{ . }}"{{ end }}{{ with .Width }} width="{{ . }}"{{ end }} + /> {{- end -}} -</div>
\ No newline at end of file diff --git a/layouts/partials/plugin/share.html b/layouts/partials/plugin/share.html index 73c32b0..b32ff0f 100644 --- a/layouts/partials/plugin/share.html +++ b/layouts/partials/plugin/share.html @@ -1,200 +1,262 @@ {{- $share := (.Scratch.Get "params").share | default dict -}} {{- if $share.enable -}} - {{- /* 000: Telegram */ -}} {{- if $share.Telegram -}} - <a class="share-icon share-telegram" href="javascript:void(0);" title="{{ T `shareOn` }} Telegram" data-sharer="telegram" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Telegram }} data-via="{{ . }}"{{ end }}{{ with .Params.tags }} data-hashtags="{{ delimit . `,` }}"{{ end }}> - {{- dict "Class" "fab fa-telegram fa-fw" | partial "plugin/icon.html" -}} - </a> + <div class="share-link"> + <a class="share-icon share-telegram" href="javascript:void(0);" title="{{ T `shareOn` }} Telegram" data-sharer="telegram" data-url="{{ .Permalink }}" data-title="{{ .Title }}"{{ with .Site.Params.Social.Telegram }} data-via="{{ . }}"{{ end }}{{ with .Params.tags }} data-hashtags="{{ delimit . `,` }}"{{ end }}> + {{- dict "Class" "svg-social-icon icon-telegram" | partial "plugin/icon.html" -}} + </a> + </div> {{- end -}} {{- /* 001: Twitter */ -}} {{- if $share.Twitter -}} +<div class="share-link"> <a class="share-icon share-twitter" 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" -}} + {{- dict "Class" "svg-social-icon icon-twitter" | partial "plugin/icon.html" -}} </a> +</div> {{- end -}} {{- /* 002: Facebook */ -}} {{- if $share.Facebook -}} + <div class="share-link"> <a class="share-icon share-facebook" 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" -}} + {{- dict "Class" "svg-social-icon icon-facebook" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 003: Linkedin */ -}} {{- if $share.Linkedin -}} + <div class="share-link"> <a class="share-icon share-linkedin" 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" -}} + {{- dict "Class" "svg-social-icon icon-linkedin" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 004: WhatsApp */ -}} {{- if $share.Whatsapp -}} + <div class="share-link"> <a class="share-icon share-whatsapp" 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" -}} + {{- dict "Class" "svg-social-icon icon-whatsapp" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 005: Viber */ -}} {{- if $share.Viber -}} + <div class="share-link"> <a class="share-icon share-viber" 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" -}} + {{- dict "Class" "svg-social-icon icon-viber" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 006: Pinterest */ -}} {{- if $share.Pinterest -}} + <div class="share-link"> <a class="share-icon share-pinterest" 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" -}} + {{- dict "Class" "svg-social-icon icon-pinterest" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 007: Tumblr */ -}} {{- if $share.Tumblr -}} + <div class="share-link"> <a class="share-icon share-tumblr" 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" -}} + {{- dict "Class" "svg-social-icon icon-tumblr" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 009: Reddit */ -}} {{- if $share.Reddit -}} + <div class="share-link"> <a class="share-icon share-reddit" 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" -}} + {{- dict "Class" "svg-social-icon icon-reddit" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 010: VK */ -}} {{- if $share.VK -}} + <div class="share-link"> <a class="share-icon share-vk" 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" -}} + {{- dict "Class" "svg-social-icon icon-vk" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 011: Buffer */ -}} {{- if $share.Buffer -}} + <div class="share-link"> <a class="share-icon share-buffer" 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" -}} + {{- dict "Class" "svg-social-icon icon-buffer" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 012: Xing */ -}} {{- if $share.Xing -}} + <div class="share-link"> <a class="share-icon share-xing" 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" -}} + {{- dict "Class" "svg-social-icon icon-xing" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 013: Line */ -}} {{- if $share.Line -}} +<div class="share-link"> <a class="share-icon share-line" 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> +</div> {{- end -}} {{- /* 014: Instapaper */ -}} {{- if $share.Instapaper -}} +<div class="share-link"> <a class="share-icon share-instapaper" 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> +</div> {{- end -}} {{- /* 015: Pocket */ -}} {{- if $share.Pocket -}} + <div class="share-link"> <a class="share-icon share-pocket" 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" -}} + {{- dict "Class" "svg-social-icon icon-pocket" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 016: Digg */ -}} {{- if $share.Digg -}} + <div class="share-link"> <a class="share-icon share-digg" 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" -}} + {{- dict "Class" "svg-social-icon icon-digg" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 017: StumbleUpon */ -}} {{- if $share.Stumbleupon -}} + <div class="share-link"> <a class="share-icon share-stumbleupon" 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" -}} + {{- dict "Class" "svg-social-icon icon-stumbleupon" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 018: Flipboard */ -}} {{- if $share.Flipboard -}} + <div class="share-link"> <a class="share-icon share-flipboard" 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" -}} + {{- dict "Class" "svg-social-icon icon-flipboard" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 019: 微博 */ -}} {{- if $share.Weibo -}} + <div class="share-link"> <a class="share-icon share-weibo" 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" -}} + {{- dict "Class" "svg-social-icon icon-weibo" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 020: 人人 */ -}} {{- if $share.Renren -}} + <div class="share-link"> <a class="share-icon share-renren" href="javascript:void(0);" title="{{ T `shareOn` }} 人人" data-sharer="renren" data-url="{{ .Permalink }}"> - {{- dict "Class" "fab fa-renren fa-fw" | partial "plugin/icon.html" -}} + {{- dict "Class" "svg-social-icon icon-renren" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 021: Myspace */ -}} {{- if $share.Myspace -}} + <div class="share-link"> <a class="share-icon share-myspace" 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> + </div> {{- end -}} {{- /* 022: Blogger */ -}} {{- if $share.Blogger -}} + <div class="share-link"> <a class="share-icon share-blogger" 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" -}} + {{- dict "Class" "svg-social-icon icon-blogger" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 023: 百度 */ -}} {{- if $share.Baidu -}} + <div class="share-link"> <a class="share-icon share-baidu" 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> + </div> {{- end -}} {{- /* 024: OK.RU */ -}} {{- if $share.Odnoklassniki -}} + <div class="share-link"> <a class="share-icon share-ok" 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" -}} + {{- dict "Class" "svg-social-icon icon-odnoklassniki" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 025: Evernote */ -}} {{- if $share.Evernote -}} + <div class="share-link"> <a class="share-icon share-evernote" 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" -}} + {{- dict "Class" "svg-social-icon icon-evernote" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 026: Skype */ -}} {{- if $share.Skype -}} + <div class="share-link"> <a class="share-icon share-skype" 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" -}} + {{- dict "Class" "svg-social-icon icon-skype" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 027: Trello */ -}} {{- if $share.Trello -}} + <div class="share-link"> <a class="share-icon share-trello" 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" -}} + {{- dict "Class" "svg-social-icon icon-trello" | partial "plugin/icon.html" -}} </a> + </div> {{- end -}} {{- /* 028: Mix */ -}} {{- if $share.Mix -}} + <div class="share-link"> <a class="share-icon share-mix" 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" -}} + {{- dict "Class" "svg-social-icon icon-mix" | partial "plugin/icon.html" -}} </a> + </div> + {{- end -}} + + {{- /* 029: Hacker News */ -}} + {{- if $share.Hackernews -}} + <a class="share-icon share-hackernews" href="javascript:void(0);" title="{{ T `shareOn` }} Hacker News" data-sharer="hackernews" data-url="{{ .Permalink }}" data-title="{{ .Title }}"> + {{- dict "Class" "svg-social-icon icon-hacker-news" | partial "plugin/icon.html" -}} + </a> {{- end -}} {{- end -}} diff --git a/layouts/partials/plugin/timeago.html b/layouts/partials/plugin/timeago.html deleted file mode 100644 index c8e6399..0000000 --- a/layouts/partials/plugin/timeago.html +++ /dev/null @@ -1,19 +0,0 @@ -{{- $fingerprint := .Scratch.Get "fingerprint" -}} -{{- $timeAgoLang := .Site.Params.TimeAgo.Lang -}} -{{- $timeAgoEnable := .Site.Params.TimeAgo.Enable -}} - -{{- if $timeAgoEnable }} -{{- /* Timeago script */ -}} -{{- dict "Source" "js/timeago.min.js" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} -{{- $_ := (resources.Get "js/timeago.min.js.map").RelPermalink -}} - -{{- if $timeAgoLang }} -{{- /* Timeago language script */ -}} -{{- dict "Source" (printf "js/timeago/timeago.%v.min.js" $timeAgoLang) "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} -{{- $_ := (resources.Get (printf "js/timeago/timeago.%v.min.js.map" $timeAgoLang)).RelPermalink -}} -{{- end -}} - -{{- /* Timeago starter script */ -}} -{{- dict "Source" "js/timeago_starter.min.js" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} -{{- $_ := (resources.Get "js/timeago_starter.min.js.map").RelPermalink -}} -{{- end -}}
\ No newline at end of file diff --git a/layouts/partials/rss/item-turbo.html b/layouts/partials/rss/item-turbo.html index ec31841..03e2d56 100644 --- a/layouts/partials/rss/item-turbo.html +++ b/layouts/partials/rss/item-turbo.html @@ -24,10 +24,10 @@ {{- 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" -}} + {{- $content = dict "Content" .Page.Content "Ruby" $params.ruby "Fraction" $params.fraction | partial "function/content.html" -}} {{- else -}} {{- with .Page.Summary -}} - {{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}} + {{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction | partial "function/content.html" -}} {{- end -}} {{- end -}} {{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}} diff --git a/layouts/partials/rss/item.html b/layouts/partials/rss/item.html index ea08a6e..3081ee9 100644 --- a/layouts/partials/rss/item.html +++ b/layouts/partials/rss/item.html @@ -24,10 +24,10 @@ {{- 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" -}} + {{- $content = dict "Content" .Page.Content "Ruby" $params.ruby "Fraction" $params.fraction | partial "function/content.html" -}} {{- else -}} {{- with .Page.Summary -}} - {{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}} + {{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction | partial "function/content.html" -}} {{- end -}} {{- end -}} {{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}} diff --git a/layouts/partials/single/footer.html b/layouts/partials/single/footer.html index d37d5eb..9cc7f11 100644 --- a/layouts/partials/single/footer.html +++ b/layouts/partials/single/footer.html @@ -1,30 +1,15 @@ {{- $params := .Scratch.Get "params" -}} +{{- $pageTheme := $params.Theme | default .Site.Params.Page.theme | default "classic" -}} +{{ $button := $params.button}} +{{ if eq $button.enable true }} <div class="post-info-share"> - <span> - {{- partial "plugin/share.html" . -}} - </span> + <a href="{{ $button.link }}" class="button button-big button-red">{{ $button.text }}</a> </div> - -{{- $authorName := $params.author | default .Site.Author.name | default " " -}} -{{- if not (eq $authorName " ") -}} -{{ $author := index .Site.Data.authors $authorName }} -<div class="footer-post-author" {{- if not $author.ps -}} style="border-radius: 10px;border-bottom: solid 2px #ececec" {{- end -}}> - <div class="author-avatar"><a href="{{ with $author.link }} {{- . | safeHTML -}}{{ end }}" target="_blank"><img alt="" src="{{ with $author.avatar }} {{- . | safeHTML -}}{{ end }}" border="0"></a></div> - <div class="author-info"> - <div class="name"><a href="{{ with $author.link }} {{- . | safeHTML -}}{{ end }}" target="_blank">{{ $author.name }}</a></div> - <div class="number-posts">{{ $author.about }}</span></div> - </div> -</div> -{{- if $author.ps -}} -<div class="footer-donate"> - <div>{{- $author.ps | safeHTML -}}</div> -</div> -{{- end -}} -{{- end -}} +{{ end }} <div class="post-footer" id="post-footer"> - {{- if or .PrevInSection .NextInSection -}} + {{- if and (or .PrevInSection .NextInSection) $params.showPostNav -}} <div class="post-navigation"> {{- if .PrevInSection -}} <div class="post-nav-box nav-box-prev"> @@ -39,3 +24,12 @@ </div> {{- end -}} </div> + +{{- with .Params.tags -}} +<div class="post-tags"> + {{- range $index, $value := . -}} + {{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}} + <a href="{{ $tag.RelPermalink }}" class="tag">{{ $tag.Title }}</a> + {{- end -}} +</div> +{{- end -}} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 7459891..a29688e 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -1,9 +1,25 @@ {{- define "title" }}{{ .Title }} | {{ .Site.Params.Title }}{{ end -}} +{{- define "dnsPrefetch" -}} +{{- $params := .Scratch.Get "params" -}} +{{- with $params.Seo.dnsPrefetch -}} +{{- range $index, $value := . -}} +<link rel="dns-prefetch" href="{{ $value }}"> +{{- end -}} +{{- end -}} +{{- with $.Site.Params.Seo.dnsPrefetch -}} +{{- range $index, $value := . -}} +<link rel="dns-prefetch" href="{{ $value }}"> +{{- end -}} +{{- end -}} +{{- end -}} + {{- define "no-content" -}} {{- $params := .Scratch.Get "params" -}} +{{ $viewCounter := .Site.Params.ViewCounter }} + {{- $toc := $params.toc -}} {{- if eq $toc true -}} {{- $toc = .Site.Params.page.toc | default dict -}} @@ -12,7 +28,7 @@ {{- end -}} {{- $pageTheme := $params.Theme | default .Site.Params.Page.theme | default "classic" -}} - +{{ $params.UniqueId }} <div class="container content-article {{ if eq $toc.keepStatic false }}page-toc{{ end }} theme-{{ $pageTheme }}"> {{- /* Auto TOC */ -}} @@ -28,67 +44,143 @@ {{- $image := $params.featuredimage -}} {{- $pageImageHidden := $params.hiddenFeaturedImage -}} {{- with .Resources.GetMatch "featured-image" -}} - {{- $image = .RelPermalink -}} + {{- $image = .Permalink -}} {{- end -}} + {{- $authorName := $params.author | default .Site.Author.name | default " " -}} + {{ $author := index .Site.Data.authors $authorName }} <div class="header-post"> - {{ if or (eq $pageTheme "full") (eq $pageTheme "mega-full") }} - {{- with $image -}} - <div class="featured-image" style="background-image: url('{{ $image }}');"> + + {{ if eq $pageTheme "hero" }} + + {{- $heroImage := "" -}} + {{- with .Resources.GetMatch "featured-image" -}} + {{- if lt 1600 .Width -}} + {{- $heroImage = (.Resize "1600x q100").Permalink -}} + {{- else -}} + {{- $heroImage = .Permalink -}} {{- end -}} {{- end -}} - <div class="post-title"> - - <div class="post-all-meta"> - {{ partial "breadcrumbs.html" . | safeHTML }} - <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"> - {{- $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"> - {{ . }} - </span> - {{- end -}} - {{- with $.Site.Params.dateformat | default "2006-01-02" | $.PublishDate.Format -}} - {{- $timeAgoDate:= $.Site.Params.TimeAgo.DateFormat | default "2006-01-02" | $.PublishDate.Format -}} - <i class="far fa-calendar-alt fa-fw"></i> <time class="timeago" datetime="{{ $timeAgoDate }}">{{ . }}</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 class="post-hero-grid"> + <div class="post-hero-info"> + <div class="hero-text-container"> + + <h1>{{ $.Title }}</h1> + <p class="hero-text-description">{{ $params.subtitle }}</p> </div> + + <div class="hero-author"> + + <a href="{{ with $author.site }} {{- . | safeHTML -}}{{ end }}" class="hero-author-profile"> + <img class="hero-author-avatar" src="{{ with $author.avatar }} {{- . | safeHTML -}}{{ end }}" alt="Bruno Krebs"> + <div class="profile-text-wrapper"> + <span class="hero-author-profile-name">{{ $author.full_name }}</span> + <span class="hero-author-profile-title">{{ $params.customAuthor.short_about | default $author.short_about }}</span> + </div> + </a> + + </div> + </div> + + <div class="post-hero-logo"> + + <figure class="hero-img"> + {{- dict "Src" $heroImage "Title" .Title "Resources" .Resources | partial "plugin/image.html" -}} + </figure> + + </div> + </div> + <div class="hero-tags"> + {{ if ne $viewCounter nil}} + <span class="rendered tag-none-display" id="views_container"><i class="svg-icon icon-eye-big"></i><span id="views_value" style="margin-right: 0">{{ if ne $params.Views nil}} {{ $params.Views }} {{ else }} Нет просмотров {{ end }}</span></span> + {{- end -}} - </div> + {{- with $.Site.Params.dateformat | default "2006-01-02" | $.PublishDate.Format -}} + {{- $timeAgoDate:= $.Site.Params.TimeAgo.DateFormat | default "2006-01-02" | $.PublishDate.Format -}} + <span id="post-date" class="rendered"><i class="svg-icon icon-clock-big"></i><time class="timeago" datetime="{{ $timeAgoDate }}">{{ . }}</time></span> + {{- end -}} - </div> + <span class="rendered"><i class="svg-icon icon-pencil-big"></i>{{ T "wordCount" $.WordCount }}</span> + <span class="rendered"><i class="svg-icon icon-stopwatch-big"></i>{{ T "readingTime" $.ReadingTime }}</span> + </div> + {{ end }} + {{ if not (eq $pageTheme "hero") }} {{ if or (eq $pageTheme "full") (eq $pageTheme "mega-full") }} {{- with $image -}} - </div> + + {{- $fullImage := $image -}} + {{- if eq $pageTheme "full" -}} + {{- with $.Resources.GetMatch "featured-image" -}} + {{- if lt 1600 .Width -}} + {{- $fullImage = (.Resize "1600x q100").Permalink -}} + {{- else -}} + {{- $fullImage = .Permalink -}} + {{- end -}} + {{- end -}} + {{- end -}} + + <div class="featured-image" style="background-image: url('{{ $fullImage }}');"> {{- end -}} {{- end -}} + <div class="post-title"> + <div class="post-all-meta"> + {{ partial "breadcrumbs.html" . | safeHTML }} + <h1 class="single-title flipInX">{{ $.Title }}</h1> + {{- /* Subtitle */ -}} + {{- with $params.subtitle -}} + <h2 class="single-subtitle">{{ . }}</h2> + {{- end -}} + {{- /* Meta */ -}} + <div class="post-meta"> + <div class="post-meta-line"> + {{- $categories := slice -}} + {{- range $.Params.categories -}} + {{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}} + {{- $categories = $categories | append (printf `<a href="%v"><i class="svg-icon icon-folder"></i>%v</a>` $category.RelPermalink $category.Title) -}} + {{- end -}} + {{- with delimit $categories " " -}} + <span class="post-category"> + {{ . }} + </span> + {{- end -}} + {{ if ne $viewCounter nil}} + <span class="post-meta-views tag-none-display" id="views_container"> + <i class="svg-icon icon-eye"></i><span id="views_value" style="margin-right: 0">Нет</span> просмотров</span> + </span> + {{- end -}} + {{- with $.Site.Params.dateformat | default "2006-01-02" | $.PublishDate.Format -}} + {{- $timeAgoDate:= $.Site.Params.TimeAgo.DateFormat | default "2006-01-02" | $.PublishDate.Format -}} + <span class="post-meta-date"> + <i class="svg-icon icon-clock"></i><time class="timeago" datetime="{{ $timeAgoDate }}">{{ . }}</time> + </span> + {{- end -}} + <span class="post-meta-words"> + <i class="svg-icon icon-pencil"></i>{{ T "wordCount" $.WordCount }} + </span> + <span class="post-meta-reading"> + <i class="svg-icon icon-stopwatch"></i>{{ T "readingTime" $.ReadingTime }} + </span> + </div> + </div> + </div> + </div> + + {{ if or (eq $pageTheme "full") (eq $pageTheme "mega-full") }} + {{- with $image -}} + </div> + {{- end -}} + {{- end -}} + {{- end -}} + + </div> <article class="single toc-start"> @@ -104,15 +196,28 @@ {{- end -}} {{- end -}} + {{ if eq ($params.authorHidden | default false) false }} + {{- $authorName := $params.author | default .Site.Author.name | default " " -}} + {{- if and (not (eq $authorName " ")) (not (eq $pageTheme "hero")) -}} + {{ $author := index .Site.Data.authors $authorName }} + <div class="footer-post-author"> + <div class="author-avatar"><a href="{{ with $author.link }} {{- . | safeHTML -}}{{ end }}" target="_blank"><img alt="" src="{{ with $author.avatar }} {{- . | safeHTML -}}{{ end }}" border="0"></a></div> + <div class="author-info"> + <div class="name"><a href="{{ with $author.link }} {{- . | safeHTML -}}{{ end }}" target="_blank">{{ $author.full_name }}</a></div> + <div class="number-posts">{{ $author.about }}</span></div> + </div> + </div> + {{- end -}} + {{- end -}} + {{- /* Static TOC */ -}} {{- if ne $toc.enable false -}} <div class="details toc" id="toc-static" data-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 -}} + {{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction | partial "function/content.html" | safeHTML -}} </div> </div> {{- end -}} @@ -134,11 +239,11 @@ {{- end -}} {{- end -}} - {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction | partial "function/content.html" | safeHTML -}} </div> - <div class="post"> + <div class="post" style="padding-top: 0"> {{- /* Footer Post */ -}} {{- partial "single/footer.html" . -}} </div> @@ -146,26 +251,21 @@ <div id="toc-final"></div> </article> -{{- with .Params.tags -}} - <div class="{{ if $toc.keepStatic }} post-tags {{ else }} post-tags post-tags-toc {{ end }}"> - {{- range $index, $value := . -}} - {{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}} - <a href="{{ $tag.RelPermalink }}" class="tag">{{ $tag.Title }}</a> - {{- end -}} + + <div class="{{ if $toc.keepStatic }} post-share {{ else }} post-share post-share-toc {{ end }}"> + {{- partial "plugin/share.html" . -}} </div> -{{- end -}} - {{- $comment := .Site.Params.Comment -}} - {{- if $comment.enable -}} + + {{- $comment := .Site.Params.Comment -}} + {{- if ($params.comment.enable | default $comment.enable) -}} <div class="page single comments content-block-position"> {{- $authorComment := $params.authorComment -}} - {{- $authorName := $params.author | default .Site.Author.name | default " " -}} {{- if not (eq $authorName " ") -}} - {{ $author := index .Site.Data.authors $authorName }} {{- if $authorComment -}} <div class="author-comment"> <div class="author-avatar" style="float: left"><a href="{{ with $author.site }} {{- . | safeHTML -}}{{ end }}" target="_blank"><img alt="" src="{{ with $author.avatar }} {{- . | safeHTML -}}{{ end }}" border="0"></a></div> - <div class="name">{{ $author.name }}</div> + <div class="name">{{ $author.full_name }}</div> <div class="author-comment-text">{{ $authorComment }}</span></div> </div> {{- end -}} @@ -175,4 +275,33 @@ </div> {{- end -}} </div> + +{{ if ne $viewCounter nil}} +<script> + document.addEventListener('DOMContentLoaded', function () { + const host = '{{ $viewCounter.url }}'; + const pathName = window.location.pathname.replaceAll('/', '_') + const url = host + '/hit/{{ $viewCounter.key }}/' + pathName.substring(1).slice(0, -1); + const request = new XMLHttpRequest(); + request.open('GET', url, true); + request.onload = function () { + if (this.status >= 200 && this.status < 400) { + const response = JSON.parse(this.response); + const views = response.value; + if (views >= 1 && document.querySelector("#views_value") != null) { + document.querySelector("#views_value").textContent = response.value.toLocaleString(undefined, {minimumFractionDigits: 0}); + document.querySelector("#views_container").style.display = ''; + } + } else { + console.log("Call to " + url + " failed with status code " + this.status + "."); + } + }; + request.onerror = function () { + console.log("Call to " + url + " failed with a connection error of some sort."); + }; + request.send(); + }); +</script> {{- end -}} + +{{- end -}}
\ No newline at end of file diff --git a/layouts/robots.txt b/layouts/robots.txt index 8adde28..0252a9a 100644 --- a/layouts/robots.txt +++ b/layouts/robots.txt @@ -2,9 +2,12 @@ User-agent: * Allow: /index.xml -Disallow: /images/ -Disallow: /js/ -Disallow: /css/ +Disallow: *.js +Disallow: *.css + +User-agent: Googlebot +Allow: *.js +Allow: *.css User-agent: MJ12bot Disallow: / @@ -18,13 +21,61 @@ Disallow: / # Block SISTRIX User-agent: SISTRIX Crawler Disallow: / + User-agent: sistrix Disallow: / + User-agent: 007ac9 Disallow: / + User-agent: 007ac9 Crawler Disallow: / +User-agent: Nutch +Disallow: / + +User-agent: ia_archiver +Disallow: / + +User-agent: WebCopier +Disallow: / + +User-agent: WebStripper +Disallow: / + +User-agent: Teleport +Disallow: / + +User-agent: Offline Explorer +Disallow: / + +User-agent: SiteSnagger +Disallow: / + +User-agent: psbot +Disallow: / + +User-agent: TeleportPro +Disallow: / + +User-agent: EmailSiphon +Disallow: / + +User-agent: EmailCollector +Disallow: / + +User-agent: larbin +Disallow: / + +User-agent: SemrushBot +Disallow: / + +User-agent: MSIECrawler +Disallow: / + +User-agent: moget +Disallow: / + # Block Uptime robot User-agent: UptimeRobot/2.0 Disallow: / @@ -63,4 +114,4 @@ Disallow: / User-agent: ZoominfoBot Disallow: / -Sitemap: {{ "/sitemap.xml" | absLangURL }} +Sitemap: {{ "/sitemap.xml" | absLangURL }}
\ No newline at end of file diff --git a/layouts/shortcodes/admonition.html b/layouts/shortcodes/admonition.html index 7cef754..0fafb19 100644 --- a/layouts/shortcodes/admonition.html +++ b/layouts/shortcodes/admonition.html @@ -1,29 +1,27 @@ {{- $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" -}} +{{- $iconMap := dict "note" "admonition-icon icon-note" -}} +{{- $iconMap = dict "abstract" "admonition-icon icon-abstract" | merge $iconMap -}} +{{- $iconMap = dict "info" "admonition-icon icon-info" | merge $iconMap -}} +{{- $iconMap = dict "tip" "admonition-icon icon-tip" | merge $iconMap -}} +{{- $iconMap = dict "success" "admonition-icon icon-success" | merge $iconMap -}} +{{- $iconMap = dict "question" "admonition-icon icon-question" | merge $iconMap -}} +{{- $iconMap = dict "warning" "admonition-icon icon-warning" | merge $iconMap -}} +{{- $iconMap = dict "failure" "admonition-icon icon-failure" | merge $iconMap -}} +{{- $iconMap = dict "danger" "admonition-icon icon-danger" | merge $iconMap -}} +{{- $iconMap = dict "bug" "admonition-icon icon-bug" | merge $iconMap -}} +{{- $iconMap = dict "example" "admonition-icon icon-example" | merge $iconMap -}} +{{- $iconMap = dict "quote" "admonition-icon icon-quote" | merge $iconMap -}} +{{- $iconDetails := "admonition-icon admonition-icon-arrow-right" -}} {{- 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" {{- if not (.Get "title") -}}style="display:none"{{- end -}}> + <div class="details-summary admonition-title {{ if not (.Get `title`) }}admonition-title-none{{ end }}"> {{- with (.Get "title") -}} <i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ . | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i> {{- end -}} </div> - <div class="details-content"> <div class="admonition-content"> {{- $inner -}} diff --git a/layouts/shortcodes/ads.html b/layouts/shortcodes/ads.html new file mode 100644 index 0000000..713ff02 --- /dev/null +++ b/layouts/shortcodes/ads.html @@ -0,0 +1,16 @@ +{{ with cond $.IsNamedParams ($.Get "slot") "" | default $.Site.Params.Advertising.Google.Slot }} +<div class="{{ if $.Get `circuit` | ne false }}cat-cit{{ end }}"> + <div class="no-adb"> + <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> + <ins class="adsbygoogle" + style="display:block; text-align:center;" + data-ad-layout="in-article" + data-ad-format="fluid" + data-ad-client="{{- with $.Site.Params.Advertising.Google.Client -}}{{ . }}{{ end }}" + data-ad-slot="{{ . }}"></ins> + <script> + (adsbygoogle = window.adsbygoogle || []).push({}); + </script> + </div> +</div> +{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/block-media-left.html b/layouts/shortcodes/block-media-left.html new file mode 100644 index 0000000..89c307d --- /dev/null +++ b/layouts/shortcodes/block-media-left.html @@ -0,0 +1,3 @@ +<div class="block-media block-media_left"> + {{ .Inner | $.Page.RenderString }} +</div>
\ No newline at end of file diff --git a/layouts/shortcodes/series.html b/layouts/shortcodes/series.html new file mode 100644 index 0000000..dea5141 --- /dev/null +++ b/layouts/shortcodes/series.html @@ -0,0 +1,11 @@ +{{ $series_name := .Get 0 | urlize }} + +{{ range $key, $taxonomy := .Site.Taxonomies.series }} +{{ if eq $key $series_name }} +<ul> + {{ range $taxonomy.Pages.ByDate }} + <li hugo-nav="{{ .RelPermalink }}"><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> + {{ end }} +</ul> +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/typeit.html b/layouts/shortcodes/typeit.html deleted file mode 100644 index 1d2ea01..0000000 --- a/layouts/shortcodes/typeit.html +++ /dev/null @@ -1,31 +0,0 @@ -{{- $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> diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html index 4b8342b..708952d 100644 --- a/layouts/taxonomy/list.html +++ b/layouts/taxonomy/list.html @@ -2,18 +2,16 @@ {{- .Title }} | {{ .Site.Title -}} {{- end -}} +{{- define "robots" -}} +<meta name="robots" content="noindex, follow" /> +{{- end -}} + {{- define "content" -}} <div class="page archive"> {{- /* Title */ -}} - <h2 class="single-title animated pulse faster"> + <h2 class="single-title 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 -}} + {{- printf "%v - %v" (T $taxonomy | default $taxonomy) .Title -}} </h2> {{- /* Paginate */ -}} diff --git a/layouts/taxonomy/terms.html b/layouts/taxonomy/terms.html index 077f8bf..a24ab95 100644 --- a/layouts/taxonomy/terms.html +++ b/layouts/taxonomy/terms.html @@ -2,6 +2,10 @@ {{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "allSome" }} - {{ .Site.Title -}} {{- end -}} +{{- define "robots" -}} +<meta name="robots" content="noindex, follow" /> +{{- end -}} + {{- define "content" -}} {{- $taxonomies := .Data.Plural -}} {{- $terms := .Data.Terms.ByCount -}} @@ -9,8 +13,8 @@ <div class="page archive"> {{- /* Title */ -}} - <h2 class="single-title animated pulse faster"> - {{- .Params.Title | default (T $taxonomies) | default $taxonomies | dict "Some" | T "allSome" -}} + <h2 class="single-title pulse faster"> + {{- .Params.Title | default (T $taxonomies) | dict "Some" | T $taxonomies -}} </h2> {{- /* Categories Page */ -}} @@ -24,7 +28,7 @@ <div class="card-item-wrapper"> <h3 class="card-item-title"> <a href="{{ .RelPermalink }}"> - <i class="far fa-folder fa-fw"></i> {{ .Page.Title }} + <i class="svg-icon icon-folder"></i> {{ .Page.Title }} </a> </h3> {{- range first 5 $pages -}} |