diff options
author | Thibaud Lepretre <thibaud.lepretre@gmail.com> | 2021-09-08 12:47:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 12:47:00 +0300 |
commit | 210bf5bda7c65e67c9622ff2203b94ab15620061 (patch) | |
tree | a1b1640c4e9c1edf48f1a7c7ce107b5d553eb87d /layouts | |
parent | 7dcf3a0f38438581f84407e45cbf087d7dbde1d5 (diff) | |
parent | 250d19d22044f86efea98fa15af5dd0094b7f69f (diff) |
Merge branch 'develop' into bugfix/properly-handle-relative-urls
Diffstat (limited to 'layouts')
32 files changed, 361 insertions, 265 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 1aa07d9..987ad8d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -9,7 +9,8 @@ {{ if eq .Params.covermeta "out" }}hasCoverMetaOut{{ else }}hasCoverMetaIn{{ end }} {{ with .Params.coverCaption }}hasCoverCaption{{ end }}"> <section class="postShorten-group main-content-wrap"> - {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{/* Iterate only over pages of the same type as this section. */}} + {{ $paginator := .Paginate (where .Data.Pages "Type" .Type) }} {{ range $paginator.Pages }} {{ .Render "summary" }} {{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index a9a90d0..350f98a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,16 +8,16 @@ class="{{ with .Params.coverimage }}hasCover{{ end }} {{ if eq .Params.covermeta "out" }}hasCoverMetaOut{{ else }}hasCoverMetaIn{{ end }} {{ with .Params.coverCaption }}hasCoverCaption{{ end }}"> - <article class="post" itemscope itemType="http://schema.org/BlogPosting"> + <article class="post" id="top"> {{ with .Params.covercaption }} <span class="post-header-cover-caption caption">{{ . | markdownify }}</span> {{ end }} {{ if or (not .Params.coverimage) (eq .Params.covermeta "out") }} {{ partial "post/header.html" . }} {{ end }} - <div class="post-content markdown" itemprop="articleBody"> + <div class="post-content markdown"> <div class="main-content-wrap"> - {{ (replaceRE "<!--\\s*[t|T][o|O][c|C]\\s*-->" (printf "<h1 id=\"table-of-contents\">%s</h1>%s" (i18n "post.toc") .TableOfContents) .Content) | safeHTML }} + {{ .Content }} {{ partial "post/gallery.html" . }} </div> </div> @@ -34,11 +34,7 @@ {{ end }} {{ end }} {{ partial "post/actions.html" . }} - {{ if not (eq .Params.comments false) }} - {{ if .Site.DisqusShortname }} - {{ partial "post/disqus.html" . }} - {{ end }} - {{ end }} + {{ partial "post/comment.html" . }} </div> </article> {{ partial "footer.html" . }} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 01cf7a4..679f507 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -26,31 +26,43 @@ {{ else }} {{ .Scratch.Set "thumbnailImagePosition" "bottom" }} {{ end }} -<article class="postShorten postShorten--thumbnailimg-{{ .Scratch.Get "thumbnailImagePosition" }}" itemscope itemType="http://schema.org/BlogPosting"> +<article class="postShorten postShorten--thumbnailimg-{{ .Scratch.Get "thumbnailImagePosition" }}"> <div class="postShorten-wrap"> {{ if and (.Scratch.Get "thumbnailImage") (eq (.Scratch.Get "thumbnailImagePosition") "top")}} - <a href="{{ .Permalink }}"> + {{ with .Params.link }} + <a href="{{ . | absURL }}" aria-label="{{ if i18n "global.open_post" }}{{ i18n "global.open_post" }}: {{ .Title }}{{ end }}" target="_blank"> + {{ else }} + <a href="{{ .Permalink }}" aria-label="{{ if i18n "global.open_post" }}{{ i18n "global.open_post" }}: {{ .Title }}{{ end }}"> + {{ end }} <div class="postShorten-thumbnailimg"> - <img alt="" itemprop="image" src="{{ .Scratch.Get "thumbnailImage" }}"/> + <img alt="" src="{{ .Scratch.Get "thumbnailImage" }}"/> </div> </a> {{ end }} <div class="postShorten-header"> - <h1 class="postShorten-title" itemprop="headline"> - <a class="link-unstyled" href="{{ .Permalink }}"> + <h1 class="postShorten-title"> + {{ with .Params.link }} + <a class="link-unstyled" href="{{ . | absURL }}" aria-label="{{ if i18n "global.open_post" }}{{ i18n "global.open_post" }}: {{ .Title }}{{ end }}" target="_blank"> + {{ else }} + <a class="link-unstyled" href="{{ .Permalink }}" aria-label="{{ if i18n "global.open_post" }}{{ i18n "global.open_post" }}: {{ .Title }}{{ end }}"> + {{ end }} {{ .Title }} </a> </h1> {{ partial "post/meta" . }} </div> - <div class="postShorten-excerpt" itemprop="articleBody"> + <div class="postShorten-excerpt"> {{ if .Params.Summary }} {{ .Params.Summary | markdownify }} {{ else }} {{ .Summary }} {{ end }} <p> - <a href="{{ .Permalink }}" class="postShorten-excerpt_link link">{{ i18n "post.read_more" }}</a> + {{ with .Params.link }} + <a href="{{ . | absURL }}" class="postShorten-excerpt_link link" aria-label="{{ if i18n "global.open_post" }}{{ i18n "global.open_post" }}: {{ .Title }}{{ end }}"> target="_blank">{{ i18n "post.read_more" }}</a> + {{ else }} + <a href="{{ .Permalink }}" class="postShorten-excerpt_link link" aria-label="{{ if i18n "global.open_post" }}{{ i18n "global.open_post" }}: {{ .Title }}{{ end }}">{{ i18n "post.read_more" }}</a> + {{ end }} {{ with .Params.readingtime }} <span class="postShorten-readingtime"> {{ printf " - %s min read" . }} @@ -60,9 +72,9 @@ </div> </div> {{ if and (.Scratch.Get "thumbnailImage") (ne (.Scratch.Get "thumbnailImagePosition") "top")}} - <a href="{{ .Permalink }}"> + <a href="{{ .Permalink }}" aria-label="{{ if i18n "global.open_post" }}{{ i18n "global.open_post" }}: {{ .Title }}{{ end }}"> <div class="postShorten-thumbnailimg"> - <img alt="" itemprop="image" src="{{ .Scratch.Get "thumbnailImage" }}"/> + <img alt="" src="{{ .Scratch.Get "thumbnailImage" }}"/> </div> </a> {{ end }} diff --git a/layouts/index.html b/layouts/index.html index f8887d0..6fa34dc 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -9,7 +9,7 @@ {{ if eq .Params.covermeta "out" }}hasCoverMetaOut{{ else }}hasCoverMetaIn{{ end }} {{ with .Params.coverCaption }}hasCoverCaption{{ end }}"> <section class="postShorten-group main-content-wrap"> - {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" site.Params.mainSections ) }} {{ range $paginator.Pages }} {{ .Render "summary" }} {{ end }} @@ -18,4 +18,4 @@ {{ partial "footer.html" . }} </div> </div> -{{ partial "foot.html" . }}
\ No newline at end of file +{{ partial "foot.html" . }} diff --git a/layouts/partials/about.html b/layouts/partials/about.html index 406fb17..411781e 100644 --- a/layouts/partials/about.html +++ b/layouts/partials/about.html @@ -1,7 +1,7 @@ <div id="about"> <div id="about-card"> <div id="about-btn-close"> - <i class="fa fa-remove"></i> + <i class="fa fa-times"></i> </div> {{ with ($.Scratch.Get "authorPicture") }} <img id="about-card-picture" src="{{ . }}{{ if in . "//www.gravatar.com/avatar/" }}?s=110{{ end }}" alt="{{ i18n "global.author_picture" }}" /> @@ -19,7 +19,7 @@ {{ end }} {{ with .Site.Author.location }} <div id="about-card-location"> - <i class="fa fa-map-marker"></i> + <i class="fa fa-map-marker-alt"></i> <br/> {{ . }} </div> diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html index b150a2b..24d16d7 100644 --- a/layouts/partials/cover.html +++ b/layouts/partials/cover.html @@ -1,9 +1,12 @@ {{ with .Site.Params.coverImage }} {{ if (in . "://") }} - {{ $cover := . }} - <div id="cover" style="background-image:url('{{ $cover | absURL }}');"></div> + <div id="cover" style="background-image:url('{{ . | absURL }}');"></div> {{ else }} - {{ $cover := (printf "/images/%s" .) }} - <div id="cover" style="background-image:url('{{ $cover | absURL }}');"></div> + {{ if (fileExists (printf "static/images/%s" .)) }} + {{ $cover := (printf "/images/%s" .) }} + <div id="cover" style="background-image:url('{{ $cover | absURL }}');"></div> + {{ else }} + <div id="cover" style="background-image:url('{{ . | absURL }}');"></div> + {{ end }} {{ end }} {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index ec7d151..5751cd2 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,10 +1,10 @@ -{{- $.Scratch.Set "isPost" false -}} +{{- $.Scratch.Set "isTypeInMainSections" false -}} {{- if .IsPage -}} - {{- if eq .Type "post" -}} - {{- $.Scratch.Set "isPost" true -}} + {{- if in site.Params.mainSections .Type -}} + {{- $.Scratch.Set "isTypeInMainSections" true -}} {{- end -}} {{- end -}} -{{- if and (and ($.Scratch.Get "isPost") (lt .Site.Params.sidebarBehavior 3)) (or (and .Site.Params.clearReading (not .Params.clearReading)) .Params.clearReading) -}} +{{- if and (and ($.Scratch.Get "isTypeInMainSections") (lt .Site.Params.sidebarBehavior 3)) (or (and .Site.Params.clearReading (not .Params.clearReading)) .Params.clearReading) -}} {{- .Scratch.Set "sidebarBehavior" (add .Site.Params.sidebarBehavior 3) -}} {{- else -}} {{- .Scratch.Set "sidebarBehavior" .Site.Params.sidebarBehavior -}} @@ -25,12 +25,13 @@ <html lang="{{ .Site.LanguageCode }}"> <head> {{ partial "head_start.html" . }} + {{ partial "schema.html" . }} {{ partial "meta.html" . }} <title>{{ with .Title }}{{ . }}{{ else }}{{ .Site.Title }}{{ end }}</title> - <link rel="icon" href="{{ with .Site.Params.favicon }}{{ . }}{{ else }}/favicon.png{{ end }}"> - {{ with .RSSLink }} - <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ . }}"> + <link rel="icon" href="{{ with .Site.Params.favicon }}{{ . | absURL }}{{ else }}/favicon.png{{ end }}"> + {{ with .OutputFormats.Get "RSS" }} + <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ .RelPermalink }}"> {{ end }} {{ with .Site.Author.googleplus }} @@ -40,12 +41,14 @@ <link rel="canonical" href="{{ .Permalink }}"> <!--EXTERNAL STYLES--> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" /> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.min.css" integrity="sha256-vuXZ9LGmmwtjqFX1F+EKin1ThZMub58gKULUyf0qECk=" crossorigin="anonymous" /> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/helpers/jquery.fancybox-thumbs.min.css" integrity="sha256-SEa4XYAHihTcEP1f5gARTB2K26Uk8PsndQYHQC1f4jU=" crossorigin="anonymous" /> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer" /> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" integrity="sha512-H9jrZiiopUdsLpg94A333EfumgUBpO9MdbxStdeITo+KEIMaNfHNvwyjjDJb+ERPaRS6DpyRlKbvPUasNItRyw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> + {{ if .Site.Params.comment.gitalk.enable }} + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.7.2/gitalk.css" integrity="sha512-MLcK/YRapzET1qTBXrOiZE6bGBgtATMo2bIyalVJ8EKDEGNoeA3SPQkvWAR0zNS650YG13ocXBMeioDuZcSRuQ==" crossorigin="anonymous" referrerpolicy="no-referrer" /> + {{ end }} <!--EXTERNAL STYLES END--> <!--STYLES--> - <link rel="stylesheet" href="/css/style-nnm2spxvve8onlujjlegkkytaehyadd4ksxc1hyzzq9a2wvtrgbljqyulomn.min.css" /> + <link rel="stylesheet" href="{{ "css/style-2w2urpokyukbsouppglitcyxngrsa0pcm58rrm5mqo3ieqo6bkvr3cz9nvf.min.css" | absURL }}" /> <!--STYLES END--> {{ range .Site.Params.customCSS }} {{ if isset . "href" }} @@ -55,7 +58,7 @@ {{ end }} {{ end }} - {{ if .Params.ga.async }} + {{ if or .Params.googleAnalytics.async .Params.ga.async }} {{ template "_internal/google_analytics_async.html" . }} {{ else }} {{ template "_internal/google_analytics.html" . }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 86c363e..8c9f987 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,15 +1,15 @@ <header id="header" data-behavior="{{ .Scratch.Get "sidebarBehavior" }}"> <i id="btn-open-sidebar" class="fa fa-lg fa-bars"></i> <div class="header-title"> - <a class="header-title-link" href="{{ "/" | relLangURL }}">{{ .Site.Title }}</a> + <a class="header-title-link" href="{{ "/" | relLangURL }}" aria-label="{{ if i18n "global.go_to_homepage" }}{{ i18n "global.go_to_homepage" }}{{ end }}">{{ .Site.Title }}</a> </div> {{ with .Site.Params.header.rightLink }} {{ if and (in .url ":") (not (in .url (printf "%s" $.Site.BaseURL))) }} <a class="{{ if .icon }}header-right-icon {{ else }}header-right-picture {{ end }}{{ with .class }}{{ . }}{{ end }}" - href="{{ .url | safeURL }}" target="_blank" rel="noopener"> + href="{{ .url | safeURL }}" target="_blank" rel="noopener" aria-label="{{ if i18n "global.open_link" }}{{ i18n "global.open_link" }}: {{ .url | safeURL }}{{ end }}"> {{ else if .url }} <a class="{{ if .icon }}header-right-icon {{ else }}header-right-picture {{ end }}{{ with .class }}{{ . }}{{ end }}" - href="{{ .url | safeURL }}"> + href="{{ .url | safeURL }}" aria-label="{{ if i18n "global.open_link" }}{{ i18n "global.open_link" }}: {{ .url | safeURL }}{{ end }}"> {{ end }} {{ if .icon }} <i class="fa fa-lg fa-{{ .icon }}"></i> diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index aa6284b..36fca1f 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -1,9 +1,9 @@ {{ range .menu }} <li class="sidebar-button"> - {{ if and (or (in .URL "://") (in .URL "mailto:")) (not (and $.root.Site.BaseURL (in .URL (printf "%s" $.root.Site.BaseURL)))) }} - <a class="sidebar-button-link {{ if eq .Identifier "search" }}open-algolia-search{{ end }}" href="{{ .URL | safeURL }}" target="_blank" rel="noopener"> + {{ if and (or (in .URL "://") (in .URL "mailto:") (in .URL "tel:") (in .URL "callto:") (in .URL "skype:")) (not (and $.root.Site.BaseURL (in .URL (printf "%s" $.root.Site.BaseURL)))) }} + <a class="sidebar-button-link {{ if eq .Identifier "search" }}open-algolia-search{{ end }}" href="{{ .URL | safeURL }}" target="_blank" rel="noopener" title="{{ .Name }}"> {{ else }} - <a class="sidebar-button-link {{ if eq .Identifier "search" }}open-algolia-search{{ end }}" href="{{ .URL | relLangURL }}"> + <a class="sidebar-button-link {{ if eq .Identifier "search" }}open-algolia-search{{ end }}" href="{{ .URL | relLangURL }}" title="{{ .Name }}"> {{ end }} {{ .Pre }} {{ $name := (i18n (printf "global.%s" .Identifier)) }} diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html index f790584..1fc40ce 100644 --- a/layouts/partials/meta.html +++ b/layouts/partials/meta.html @@ -1,7 +1,7 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> -<meta name="generator" content="Hugo {{ .Hugo.Version }} with theme Tranquilpeak 0.4.3-SNAPSHOT"> +<meta name="generator" content="Hugo {{ hugo.Version }} with theme Tranquilpeak 0.5.1-BETA"> <meta name="author" content="{{ .Site.Author.name }}"> <meta name="keywords" content="{{ with .Keywords }}{{ delimit . ", " }}{{ end }}{{ if .Site.Params.keywords }}, {{ delimit .Site.Params.keywords ", " }}{{ end }}"> <meta name="description" content="{{ if .Description }}{{ .Description }}{{ else if .IsPage }}{{ .Summary }}{{ else }}{{ .Site.Params.description }}{{ end }}"> @@ -58,25 +58,25 @@ {{ end }} {{ end }} -{{ with .Params.thumbnailImage }} - <meta property="og:image" content="{{ . | absURL }}"> - <meta property="twitter:image" content="{{ . | absURL }}"> -{{ end }} -{{ with .Params.coverImage }} - <meta property="og:image" content="{{ . | absURL }}"> - <meta property="twitter:image" content="{{ . | absURL }}"> +{{ if .Scratch.Get "gravatarEmail" }} + <meta property="og:image" content="https://www.gravatar.com/avatar/{{ (md5 (.Scratch.Get "gravatarEmail")) | urlize }}?s=640"> + <meta property="twitter:image" content="https://www.gravatar.com/avatar/{{ (md5 (.Scratch.Get "gravatarEmail")) | urlize }}?s=640"> +{{ else if .Site.Author.picture }} + <meta property="og:image" content="{{ .Site.Author.picture | absURL }}"> + <meta property="twitter:image" content="{{ .Site.Author.picture | absURL }}"> {{ end }} + {{ with .Params.gallery }} {{ range . }} <meta property="og:image" content="{{ range first 1 (split . " ") }}{{ . | absURL }}{{ end }}"> <meta property="twitter:image" content="{{ range first 1 (split . " ") }}{{ . | absURL }}{{ end }}"> {{ end }} {{ end }} - -{{ if .Scratch.Get "gravatarEmail" }} - <meta property="og:image" content="https://www.gravatar.com/avatar/{{ (md5 (.Scratch.Get "gravatarEmail")) | urlize }}?s=640"> - <meta property="twitter:image" content="https://www.gravatar.com/avatar/{{ (md5 (.Scratch.Get "gravatarEmail")) | urlize }}?s=640"> -{{ else if .Site.Author.picture }} - <meta property="og:image" content="{{ .Site.Author.picture | absURL }}"> - <meta property="twitter:image" content="{{ .Site.Author.picture | absURL }}"> +{{ with .Params.coverImage }} + <meta property="og:image" content="{{ . | absURL }}"> + <meta property="twitter:image" content="{{ . | absURL }}"> +{{ end }} +{{ with .Params.thumbnailImage }} + <meta property="og:image" content="{{ . | absURL }}"> + <meta property="twitter:image" content="{{ . | absURL }}"> {{ end }} diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html index 8677695..36a7950 100644 --- a/layouts/partials/pagination.html +++ b/layouts/partials/pagination.html @@ -4,7 +4,7 @@ {{ if .Site.Params.swapPaginator }} {{ if .Paginator.HasPrev }} <li class="pagination-prev"> - <a class="btn btn--default btn--small" href="{{ .Paginator.Prev.URL }}"> + <a class="btn btn--default btn--small" href="{{ .Paginator.Prev.URL }}" aria-label="{{ i18n "pagination.older_posts" }}"> <i class="fa fa-angle-left text-base icon-mr"></i> <span>{{ i18n "pagination.older_posts" }}</span> </a> @@ -12,7 +12,7 @@ {{ end }} {{ if .Paginator.HasNext }} <li class="pagination-next"> - <a class="btn btn--default btn--small" href="{{ .Paginator.Next.URL }}"> + <a class="btn btn--default btn--small" href="{{ .Paginator.Next.URL }}" aria-label="{{ i18n "pagination.newer_posts" }}"> <span>{{ i18n "pagination.newer_posts" }}</span> <i class="fa fa-angle-right text-base icon-ml"></i> </a> @@ -21,7 +21,7 @@ {{ else }} {{ if .Paginator.HasPrev }} <li class="pagination-prev"> - <a class="btn btn--default btn--small" href="{{ .Paginator.Prev.URL }}"> + <a class="btn btn--default btn--small" href="{{ .Paginator.Prev.URL }}" aria-label="{{ i18n "pagination.newer_posts" }}"> <i class="fa fa-angle-left text-base icon-mr"></i> <span>{{ i18n "pagination.newer_posts" }}</span> </a> @@ -29,7 +29,7 @@ {{ end }} {{ if .Paginator.HasNext }} <li class="pagination-next"> - <a class="btn btn--default btn--small" href="{{ .Paginator.Next.URL }}"> + <a class="btn btn--default btn--small" href="{{ .Paginator.Next.URL }}" aria-label="{{ i18n "pagination.older_posts" }}"> <span>{{ i18n "pagination.older_posts" }}</span> <i class="fa fa-angle-right text-base icon-ml"></i> </a> diff --git a/layouts/partials/post/actions.html b/layouts/partials/post/actions.html index 3a62ffa..75accc7 100644 --- a/layouts/partials/post/actions.html +++ b/layouts/partials/post/actions.html @@ -1,83 +1,90 @@ +{{ if not (eq .Params.showActions false) }} <div class="post-actions-wrap"> - {{ if not (eq .Params.showActions false) }} - <nav {{ if eq .Params.showPagination false }}style="visibility: hidden"{{ end }}> - <ul class="post-actions post-action-nav"> - {{ if .Site.Params.swapPaginator }} - <li class="post-action"> - {{ with .PrevInSection }} - <a class="post-action-btn btn btn--default tooltip--top" href="{{ .RelPermalink }}" data-tooltip="{{ .Title }}"> - {{ else }} - <a class="post-action-btn btn btn--disabled"> - {{ end }} - <i class="fa fa-angle-left"></i> - <span class="hide-xs hide-sm text-small icon-ml">{{ i18n "pagination.previous" }}</span> - </a> - </li> - <li class="post-action"> - {{ with .NextInSection }} - <a class="post-action-btn btn btn--default tooltip--top" href="{{ .RelPermalink }}" data-tooltip="{{ .Title }}"> - {{ else }} - <a class="post-action-btn btn btn--disabled"> - {{ end }} - <span class="hide-xs hide-sm text-small icon-mr">{{ i18n "pagination.next" }}</span> - <i class="fa fa-angle-right"></i> - </a> - </li> + <nav {{ if eq .Params.showPagination false }}style="visibility: hidden"{{ end }}> + <ul class="post-actions post-action-nav"> + {{ if .Site.Params.swapPaginator }} + <li class="post-action"> + {{ with .PrevInSection }} + <a class="post-action-btn btn btn--default tooltip--top" href="{{ .RelPermalink }}" data-tooltip="{{ .Title }}" aria-label="{{ i18n "pagination.previous" }}: {{ .Title }}"> {{ else }} - <li class="post-action"> - {{ with .NextInSection }} - <a class="post-action-btn btn btn--default tooltip--top" href="{{ .RelPermalink }}" data-tooltip="{{ .Title }}"> - {{ else }} - <a class="post-action-btn btn btn--disabled"> - {{ end }} - <i class="fa fa-angle-left"></i> - <span class="hide-xs hide-sm text-small icon-ml">{{ i18n "pagination.next" }}</span> - </a> - </li> - <li class="post-action"> - {{ with .PrevInSection }} - <a class="post-action-btn btn btn--default tooltip--top" href="{{ .RelPermalink }}" data-tooltip="{{ .Title }}"> - {{ else }} - <a class="post-action-btn btn btn--disabled"> - {{ end }} - <span class="hide-xs hide-sm text-small icon-mr">{{ i18n "pagination.previous" }}</span> - <i class="fa fa-angle-right"></i> - </a> - </li> + <a class="post-action-btn btn btn--disabled"> {{ end }} - </ul> - </nav> - <ul class="post-actions post-action-share" > - {{ if (not (eq .Params.showSocial false)) }} - <li class="post-action hide-lg hide-md hide-sm"> - <a class="post-action-btn btn btn--default btn-open-shareoptions" href="#btn-open-shareoptions"> - <i class="fa fa-share-alt"></i> - </a> + <i class="fa fa-angle-left"></i> + <span class="hide-xs hide-sm text-small icon-ml">{{ i18n "pagination.previous" }}</span> + </a> </li> - {{ range .Site.Params.sharingOptions }} - <li class="post-action hide-xs"> - <a class="post-action-btn btn btn--default" target="new" href="{{ printf .url $.Permalink }}"> - <i class="fa {{ .icon }}"></i> + <li class="post-action"> + {{ with .NextInSection }} + <a class="post-action-btn btn btn--default tooltip--top" href="{{ .RelPermalink }}" data-tooltip="{{ .Title }}" aria-label="{{ i18n "pagination.next" }}: {{ .Title }}"> + {{ else }} + <a class="post-action-btn btn btn--disabled"> + {{ end }} + <span class="hide-xs hide-sm text-small icon-mr">{{ i18n "pagination.next" }}</span> + <i class="fa fa-angle-right"></i> </a> - </li> - {{ end }} - {{ end }} - {{ if and (not (eq .Params.comments false)) .Site.DisqusShortname }} + </li> + {{ else }} + <li class="post-action"> + {{ with .NextInSection }} + <a class="post-action-btn btn btn--default tooltip--top" href="{{ .RelPermalink }}" data-tooltip="{{ .Title }}" aria-label="{{ i18n "pagination.next" }}: {{ .Title }}"> + {{ else }} + <a class="post-action-btn btn btn--disabled"> + {{ end }} + <i class="fa fa-angle-left"></i> + <span class="hide-xs hide-sm text-small icon-ml">{{ i18n "pagination.next" }}</span> + </a> + </li> <li class="post-action"> - <a class="post-action-btn btn btn--default" href="#disqus_thread"> - <i class="fa fa-comment-o"></i> - </a> + {{ with .PrevInSection }} + <a class="post-action-btn btn btn--default tooltip--top" href="{{ .RelPermalink }}" data-tooltip="{{ .Title }}" aria-label="{{ i18n "pagination.previous" }}: {{ .Title }}"> + {{ else }} + <a class="post-action-btn btn btn--disabled"> + {{ end }} + <span class="hide-xs hide-sm text-small icon-mr">{{ i18n "pagination.previous" }}</span> + <i class="fa fa-angle-right"></i> + </a> </li> {{ end }} - <li class="post-action"> - {{ if findRE "<!--\\s*[t|T][o|O][c|C]\\s*-->" .Content }} - <a class="post-action-btn btn btn--default" href="#table-of-contents"> - {{ else }} - <a class="post-action-btn btn btn--default" href="#"> - {{ end }} - <i class="fa fa-list"></i> + </ul> + </nav> +<ul class="post-actions post-action-share" > + {{ if (not (eq .Params.showSocial false)) }} + <li class="post-action hide-lg hide-md hide-sm"> + <a class="post-action-btn btn btn--default btn-open-shareoptions" href="#btn-open-shareoptions" aria-label="{{ i18n "post.share" }}"> + <i class="fa fa-share-alt" aria-hidden="true"></i> + </a> + </li> + {{ range .Site.Params.sharingOptions }} + <li class="post-action hide-xs"> + <a class="post-action-btn btn btn--default" target="new" href="{{ printf .url $.Permalink }}" title="{{ replace (i18n "global.share_on") "%s" .name }}" aria-label="{{ replace (i18n "global.share_on") "%s" .name }}"> + <i class="{{ .icon }}" aria-hidden="true"></i> </a> </li> - </ul> + {{ end }} + {{ end }} + {{ if and (and (.Site.Params.comment.disqus.enable) (not (.Site.Config.Privacy.Disqus.Disable))) .Site.DisqusShortname }} + <li class="post-action"> + <a class="post-action-btn btn btn--default" href="#disqus_thread" aria-label="{{ i18n "post.comment" }}"> + <i class="far fa-comment"></i> + </a> + </li> + {{ else if .Site.Params.comment.gitalk.enable }} + <li class="post-action"> + <a class="post-action-btn btn btn--default" href="#gitalk" aria-label="{{ i18n "post.comment" }}"> + <i class="fa fa-comment"></i> + </a> + </li> {{ end }} + <li class="post-action"> + {{ if findRE "<!--\\s*[t|T][o|O][c|C]\\s*-->" .Content }} + <a class="post-action-btn btn btn--default" href="#table-of-contents" aria-label="{{ i18n "post.toc" }}"> + <i class="fa fa-list" aria-hidden="true"></i> + {{ else }} + <a class="post-action-btn btn btn--default" href="#top" aria-label="{{ i18n "post.back_to_top" }}"> + <i class="fa fa-arrow-up" aria-hidden="true"></i> + {{ end }} + </a> + </li> +</ul> </div> +{{ end }} diff --git a/layouts/partials/post/comment.html b/layouts/partials/post/comment.html new file mode 100644 index 0000000..5a67988 --- /dev/null +++ b/layouts/partials/post/comment.html @@ -0,0 +1,51 @@ +{{ if .IsPage }} + {{ if and (.Site.Params.comment.disqus.enable) (not (.Site.Config.Privacy.Disqus.Disable)) }} + <div id="disqus_thread"> + <noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript> + </div> + <script type="text/javascript"> + var disqus_config = function() { + this.page.url = '{{ .Permalink }}'; + {{ if .Params.disqusIdentifier }} + this.page.identifier = '{{ .Params.disqusIdentifier }}'; + {{ else }} + this.page.identifier = '{{ .RelPermalink }}' + {{ end }} + }; + (function() { + // Don't ever inject Disqus on localhost--it creates unwanted + // discussions from 'localhost:1313' on your Disqus account... + if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) { + document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.'; + return; + } + var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; + var disqus_shortname = '{{ .Site.DisqusShortname }}'; + dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); + })(); + </script> + {{ else if .Site.Params.comment.gitalk.enable }} + <div id="gitalk"> + <noscript>Please enable JavaScript to view the comments powered by Gitalk.</noscript> + </div> + <script src="https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.7.2/gitalk.min.js" integrity="sha512-EcTCcXV46teiNwe0VcnM5A038tcY+BaQYO4nW6Gh2i7v4/HjBVg7xx3+JBLl9WofDds//INJAiEGAtdgr8PWyA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> + <script type="text/javascript"> + (function() { + if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) { + document.getElementById('gitalk').innerHTML = 'Gitalk comments not available by default when the website is previewed locally.'; + return; + } + new Gitalk({ + clientID: '{{ .Site.Params.comment.gitalk.clientId }}', + clientSecret: '{{ .Site.Params.comment.gitalk.clientSecret }}', + repo: '{{ .Site.Params.comment.gitalk.repo }}', + owner: '{{ .Site.Params.comment.gitalk.owner }}', + admin: ['{{ .Site.Params.comment.gitalk.owner }}'], + id: '{{ md5 .RelPermalink }}', + ...{{ .Site.Params.comment.gitalk.options | jsonify | safeJS }} + }).render('gitalk') + })() + </script> + {{ end }} +{{ end }} diff --git a/layouts/partials/post/disqus.html b/layouts/partials/post/disqus.html deleted file mode 100644 index 4cf9229..0000000 --- a/layouts/partials/post/disqus.html +++ /dev/null @@ -1,3 +0,0 @@ -<div id="disqus_thread"> - <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> -</div>
\ No newline at end of file diff --git a/layouts/partials/post/gallery.html b/layouts/partials/post/gallery.html index 5447d46..d8e63fe 100644 --- a/layouts/partials/post/gallery.html +++ b/layouts/partials/post/gallery.html @@ -1,23 +1,30 @@ +{{ $GALLERY_IMAGES_DISPLAYED_LIMIT := 3 }} {{ if and .Site.Params.imageGallery .Params.gallery }} {{ $galleryLength := len .Params.gallery }} {{ $imageGalleryClass := "" }} {{ if gt $galleryLength 0 }} <div class="image-gallery"> <div class="image-gallery-metabar"> - <span>Gallery {{ $galleryLength }} images</span> + <span>{{ i18n "post.gallery"}} {{ if gt $galleryLength 1 }}{{ replace (i18n "post.image.other") "{n}" $galleryLength }}{{ else }}{{ i18n "post.image.one" }}{{ end }}</span> </div> <div class="image-gallery-photos {{ if gt $galleryLength 2 }}image-gallery-photos--thumbnail{{ end }}"> {{ range $index, $element := .Params.gallery }} - {{ $image := (split $element " ") }} + {{ $image := findRE "[^\\s\"']+|\"([^\"]*)\"|'([^']*)'" $element }} {{ $imageLength := len $image }} <div class="photo-box"> - <a class="photo-box-inner fancybox" data-fancybox-group="gallery-{{ $.UniqueID }}" - title="{{ if gt $imageLength 2 }}{{ index $image 2 }}{{ else }}{{ index $image 1 }}{{ end }}" href="{{ index $image 0 }}"> - <img class="photo" src="{{ if gt $imageLength 2 }}{{ index $image 1 }}{{ else }}{{ index $image 0 }}{{ end }}" itemprop="image"> + <a class="photo-box-inner fancybox" + data-fancybox="gallery-{{ $.File.UniqueID }}" + data-caption="{{ if gt $imageLength 2 }}{{ replace (index $image 2) "\"" "" }}{{ else }}{{ replace (index $image 1) "\"" "" }}{{ end }}" + title="{{ if gt $imageLength 2 }}{{ replace (index $image 2) "\"" "" }}{{ else }}{{ replace (index $image 1) "\"" "" }}{{ end }}" + href="{{ index $image 0 }}" + aria-label="{{ i18n "global.zoom_in_on_picture" }}"> + {{ if lt $index $GALLERY_IMAGES_DISPLAYED_LIMIT }} + <img class="photo" src="{{ if gt $imageLength 2 }}{{ index $image 1 }}{{ else }}{{ index $image 0 }}{{ end }}"> + {{ end }} </a> </div> {{ end }} </div> </div> {{ end }} -{{ end }}
\ No newline at end of file +{{ end }} diff --git a/layouts/partials/post/header-cover.html b/layouts/partials/post/header-cover.html index 51a5d04..f7342d4 100644 --- a/layouts/partials/post/header-cover.html +++ b/layouts/partials/post/header-cover.html @@ -2,7 +2,7 @@ <div class="post-header-cover {{ if .Params.metaalignment }}text-{{ .Params.metaalignment }}{{ else }}text-left{{ end }} {{ with .Params.coversize }}post-header-cover--{{ . }}{{ end }}" - style="background-image:url('{{ .Params.coverimage }}')" + style="background-image:url('{{ .Params.coverimage | relURL }}')" data-behavior="{{ $.Scratch.Get "sidebarBehavior" }}"> {{ if or (eq .Params.covermeta "in") (not .Params.covermeta) }} {{ partial "post/header.html" . }} diff --git a/layouts/partials/post/header.html b/layouts/partials/post/header.html index a6226c8..30937d3 100644 --- a/layouts/partials/post/header.html +++ b/layouts/partials/post/header.html @@ -1,12 +1,12 @@ <div class="post-header main-content-wrap {{ if $.Params.metaalignment }}text-{{ $.Params.metaalignment }}{{ else }}text-left{{ end }}"> {{ with $.Params.link }} <h1 itemprop="headline"> - <a class="link" href="{{ . | absURL }}" target="_blank" itemprop="url"> + <a class="link" href="{{ . | absURL }}" target="_blank" rel="noopener" aria-label="{{ i18n "global.open_link"}}: {{ . | absURL }}"> {{ $.Title }} </a> </h1> {{ else }} - <h1 class="post-title" itemprop="headline"> + <h1 class="post-title"> {{ $.Title }} </h1> {{ end }} diff --git a/layouts/partials/post/meta.html b/layouts/partials/post/meta.html index d143721..01408b1 100644 --- a/layouts/partials/post/meta.html +++ b/layouts/partials/post/meta.html @@ -1,7 +1,7 @@ {{ if not (eq .Params.showMeta false) }} <div class="postShorten-meta post-meta"> {{ if not (eq .Params.showDate false) }} - <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> + <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> {{ partial "internal/date.html" . }} </time> {{ end }} diff --git a/layouts/partials/post/share-options.html b/layouts/partials/post/share-options.html index 871f3c2..ddb4097 100644 --- a/layouts/partials/post/share-options.html +++ b/layouts/partials/post/share-options.html @@ -1,13 +1,15 @@ +{{ if .Site.Params.sharingOptions }} <div id="share-options-bar" class="share-options-bar" data-behavior="{{ .Scratch.Get "sidebarBehavior" }}"> - <i id="btn-close-shareoptions" class="fa fa-close"></i> + <i id="btn-close-shareoptions" class="fa fa-times"></i> <ul class="share-options"> {{ range .Site.Params.sharingOptions }} <li class="share-option"> - <a class="share-option-btn" target="new" href="{{ printf .url (substr (querify "x" $.Permalink) 2) }}"> - <i class="fa {{ .icon }}"></i><span>{{ printf (i18n "global.share_on") .name }}</span> + <a class="share-option-btn" target="new" href="{{ printf .url (substr (querify "x" $.Permalink) 2) }}" aria-label="{{ replace (i18n "global.share_on") "%s" .name }}"> + <i class="{{ .icon }}" aria-hidden="true"></i><span>{{ replace (i18n "global.share_on") "%s" .name }}</span> </a> </li> {{ end }} </ul> </div> -<div id="share-options-mask" class="share-options-mask"></div>
\ No newline at end of file +<div id="share-options-mask" class="share-options-mask"></div> +{{ end }} diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html new file mode 100644 index 0000000..d169fb0 --- /dev/null +++ b/layouts/partials/schema.html @@ -0,0 +1,56 @@ +<script type="application/ld+json"> +{{ if eq .Section "posts" }} +{ + "@context": "https://schema.org", + "@type": "BlogPosting", + "headline": {{ .Title }}, + {{ if .Params.coverimage }} + "image": {{ .Params.coverImage | absURL }}, + {{ else if .Params.thumbnailImage }} + "image": {{ .Params.thumbnailImage | absURL }}, + {{ end }} + "datePublished": {{ .PublishDate }}, + "dateModified": {{ .Lastmod }}, + "author": { + "@type": "Person", + "name": {{ .Site.Author.name }}, + {{ with ($.Scratch.Get "authorPicture") }} + "image": {{ . }} + {{ end }} + }, + "mainEntityOfPage": { + "@type": "WebPage", + "@id": "{{ .Permalink }}" + }, + "publisher": { + "@type": "Organization", + "name": {{ .Site.Title }}, + {{ with ($.Scratch.Get "authorPicture") }} + "logo": { + "@type": "ImageObject", + "url": {{ . }} + } + {{ end }} + }, + "description": {{ .Summary | plainify | safeHTML }}, + "keywords": [{{ with .Keywords }}{{ delimit . ", " }}{{ end }}{{ if .Site.Params.keywords }}, {{ delimit .Site.Params.keywords ", " }}{{ end }}] +} +{{ else }} +{ + "@context":"http://schema.org", + "@type":"Website", + "@id":"{{ .Site.BaseURL }}", + "author": { + "@type": "Person", + "name": {{ .Site.Author.name }}, + {{ with ($.Scratch.Get "authorPicture") }} + "image": {{ . }} + {{ end }} + }, + "name":"{{ .Site.Title }}", + "description":"{{ if .Description }}{{ .Description }}{{ else if .IsPage }}{{ .Summary }}{{ else }}{{ .Site.Params.description }}{{ end }}", + "url":"{{ .Permalink }}", + "keywords":"[{{ with .Keywords }}{{ delimit . ", " }}{{ end }}{{ if .Site.Params.keywords }}, {{ delimit .Site.Params.keywords ", " }}{{ end }}]" +} +{{ end }} +</script>
\ No newline at end of file diff --git a/layouts/partials/script.html b/layouts/partials/script.html index 99ffe07..e890b12 100644 --- a/layouts/partials/script.html +++ b/layouts/partials/script.html @@ -1,14 +1,14 @@ <!--EXTERNAL SCRIPTS--> -<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> {{ if eq .Site.Params.syntaxHighlighter "highlight.js" }} - <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js" integrity="sha256-/BfiIkHlHoVihZdc6TFuj7MmJ0TWcWsMXkeDFwhi0zw=" crossorigin="anonymous"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.1.0/highlight.min.js" integrity="sha512-z+/WWfyD5tccCukM4VvONpEtLmbAm5LDu7eKiyMQJ9m7OfPEDL7gENyDRL3Yfe8XAuGsS2fS4xSMnl6d30kqGQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> {{ else if eq .Site.Params.syntaxHighlighter "prism.js" }} - <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.8.3/prism.min.js" integrity="sha256-haEv2ilTk2sXcJaGbkTtErRCHy/qGt3g+bGbgPf5OTY=" crossorigin="anonymous"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/prism.min.js" integrity="sha512-axJX7DJduStuBB8ePC8ryGzacZPr3rdLaIDZitiEgWWk2gsXxEFlm4UW0iNzj2h3wp5mOylgHAzBzM4nRSvTZA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> {{ end }} -<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.7/js/jquery.fancybox.min.js" integrity="sha256-GEAnjcTqVP+vBp3SSc8bEDQqvWAZMiHyUSIorrWwH50=" crossorigin="anonymous"></script> +<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js" integrity="sha512-uURl+ZXMBrF4AwGaWmEetzrd+J5/8NRkWAvJx5sbPSSuOb0bZLqf+tOzniObO00BjHa/dD7gub9oCGMLPQHtQA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <!--EXTERNAL SCRIPTS END--> <!--SCRIPTS--> -<script src="/js/script-qi9wbxp2ya2j6p7wx1i6tgavftewndznf4v0hy2gvivk1rxgc3lm7njqb6bz.min.js"></script> +<script src="{{ "/js/script-8lglxdix2nqhalxxm2bujhkcc8cctdrd5o5axonwhfzx2zqrer5facyn8.min.js" | absURL }}"></script> <!--SCRIPTS END--> {{ range .Site.Params.customJS }} {{ if isset . "src" }} @@ -17,20 +17,6 @@ <script src="{{ . | absURL }}"></script> {{ end }} {{ end }} -<script lang="javascript"> -window.onload = updateMinWidth; -window.onresize = updateMinWidth; -document.getElementById("sidebar").addEventListener("transitionend", updateMinWidth); -function updateMinWidth() { - var sidebar = document.getElementById("sidebar"); - var main = document.getElementById("main"); - main.style.minWidth = ""; - var w1 = getComputedStyle(main).getPropertyValue("min-width"); - var w2 = getComputedStyle(sidebar).getPropertyValue("width"); - var w3 = getComputedStyle(sidebar).getPropertyValue("left"); - main.style.minWidth = `calc(${w1} - ${w2} - ${w3})`; -} -</script> {{ if eq .Site.Params.syntaxHighlighter "highlight.js" }} <script> $(document).ready(function() { @@ -44,35 +30,6 @@ $(document).ready(function() { }); </script> {{ end }} -{{ if .IsPage }} - {{ if not (eq .Params.comments false) }} - {{ if .Site.DisqusShortname }} - <script> - var disqus_config = function () { - this.page.url = '{{ .Permalink }}'; - {{ if .Params.disqusIdentifier }} - this.page.identifier = '{{ .Params.disqusIdentifier }}'; - {{ else }} - this.page.identifier = '{{ .URL | relURL }}' - {{ end }} - }; - (function() { - // Don't ever inject Disqus on localhost--it creates unwanted - // discussions from 'localhost:1313' on your Disqus account... - if (window.location.hostname == "localhost") { - return; - } - var d = document, s = d.createElement('script'); - var disqus_shortname = '{{ .Site.DisqusShortname }}'; - s.src = '//' + disqus_shortname + '.disqus.com/embed.js'; - - s.setAttribute('data-timestamp', +new Date()); - (d.head || d.body).appendChild(s); - })(); - </script> - {{ end }} - {{ end }} -{{ end }} {{ if or .Params.math .Site.Params.math }} <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_CHTML-full" integrity="sha256-GhM+5JHb6QUzOQPXSJLEWP7R73CbkisjzK5Eyij4U9w=" crossorigin="anonymous"></script> <script type="text/x-mathjax-config"> diff --git a/layouts/partials/search.html b/layouts/partials/search.html index d83b92c..5fd8d33 100644 --- a/layouts/partials/search.html +++ b/layouts/partials/search.html @@ -1,54 +1,56 @@ -<div id="algolia-search-modal" class="modal-container"> - <div class="modal"> - <div class="modal-header"> - <span class="close-button"><i class="fa fa-close"></i></span> - <a href="https://algolia.com" target="_blank" rel="noopener" class="searchby-algolia text-color-light link-unstyled"> - <span class="searchby-algolia-text text-color-light text-small">by</span> - <img class="searchby-algolia-logo" src="https://www.algolia.com/static_assets/images/press/downloads/algolia-light.svg"> - </a> - <i class="search-icon fa fa-search"></i> - <form id="algolia-search-form"> - <input type="text" id="algolia-search-input" name="search" - class="form-control input--large search-input" placeholder="{{ i18n "global.search" }}" /> - </form> - </div> - <div class="modal-body"> - <div class="no-result text-color-light text-center">{{ i18n "global.posts_found.zero" }}</div> - <div class="results"> - {{ $posts := (where .Site.RegularPages "Section" "post") }} - {{ range first 10 $posts }} - <div class="media"> - {{ if .Params.thumbnailImageUrl }} - <div class="media-left"> +{{ with .Site.Params.algolia }} + <div id="algolia-search-modal" class="modal-container"> + <div class="modal"> + <div class="modal-header"> + <span class="close-button"><i class="fa fa-times"></i></span> + <a href="https://algolia.com" target="_blank" rel="noopener" class="searchby-algolia text-color-light link-unstyled"> + <span class="searchby-algolia-text text-color-light text-small">by</span> + <img class="searchby-algolia-logo" src="https://www.algolia.com/static_assets/images/press/downloads/algolia-light.svg"> + </a> + <i class="search-icon fa fa-search"></i> + <form id="algolia-search-form"> + <input type="text" id="algolia-search-input" name="search" + class="form-control input--large search-input" placeholder="{{ i18n "global.search" }}" /> + </form> + </div> + <div class="modal-body"> + <div class="no-result text-color-light text-center">{{ i18n "global.posts_found.zero" }}</div> + <div class="results"> + {{ $posts := (where .Site.RegularPages "Section" "in" site.Params.mainSections) }} + {{ range first 10 $posts }} + <div class="media"> + {{ if .Params.thumbnailImageUrl }} + <div class="media-left"> + <a class="link-unstyled" href="{{ .Permalink }}"> + <img class="media-image" src="{{ .Params.thumbnailImageUrl }}" width="90" height="90"/> + </a> + </div> + {{ end }} + <div class="media-body"> <a class="link-unstyled" href="{{ .Permalink }}"> - <img class="media-image" src="{{ .Params.thumbnailImageUrl }}" width="90" height="90"/> + <h3 class="media-heading">{{ .Title }}</h3> </a> - </div> - {{ end }} - <div class="media-body"> - <a class="link-unstyled" href="{{ .Permalink }}"> - <h3 class="media-heading">{{ .Title }}</h3> - </a> - <span class="media-meta"> - <span class="media-date text-small"> - {{ .Date.Format "Jan 1, 2006" }} + <span class="media-meta"> + <span class="media-date text-small"> + {{ .Date.Format "Jan 1, 2006" }} + </span> </span> - </span> - <div class="media-content hide-xs font-merryweather">{{ .Summary }}</div> + <div class="media-content hide-xs font-merryweather">{{ .Summary }}</div> + </div> + <div style="clear:both;"></div> + <hr> </div> - <div style="clear:both;"></div> - <hr> - </div> - {{ end }} + {{ end }} + </div> + </div> + <div class="modal-footer"> + <p class="results-count text-medium" + data-message-zero="{{ i18n "global.posts_found.zero" }}" + data-message-one="{{ i18n "global.posts_found.one" }}" + data-message-other="{{ i18n "global.posts_found.other" }}"> + {{ len $posts }} posts found + </p> </div> - </div> - <div class="modal-footer"> - <p class="results-count text-medium" - data-message-zero="{{ i18n "global.posts_found.zero" }}" - data-message-one="{{ i18n "global.posts_found.one" }}" - data-message-other="{{ i18n "global.posts_found.other" }}"> - {{ len $posts }} posts found - </p> </div> </div> -</div>
\ No newline at end of file +{{ end }} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index ef0f6f9..dac5dcc 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -2,7 +2,7 @@ <div class="sidebar-container"> {{ with ($.Scratch.Get "authorPicture") }} <div class="sidebar-profile"> - <a href="{{ if $.Site.Params.sidebar.profile.url }}{{ $.Site.Params.sidebar.profile.url }}{{ else }}{{ "/#about" }}{{ end }}"> + <a href="{{ if $.Site.Params.sidebar.profile.url }}{{ $.Site.Params.sidebar.profile.url }}{{ else }}{{ "/#about" }}{{ end }}" aria-label="{{ i18n "global.read_more_about_author"}}"> <img class="sidebar-profile-picture" src="{{ . }}{{ if in . "//www.gravatar.com/avatar/" }}?s=110{{ end }}" alt="{{ i18n "global.author_picture" }}" /> </a> <h4 class="sidebar-profile-name">{{ $.Site.Author.name }}</h4> diff --git a/layouts/shortcodes/codeblock.html b/layouts/shortcodes/codeblock.html index 9e210d2..098c933 100644 --- a/layouts/shortcodes/codeblock.html +++ b/layouts/shortcodes/codeblock.html @@ -18,9 +18,9 @@ {{ end }} {{ end }} {{ $trimmedContent := trim .Inner "\n" }} -<figure class="highlight {{ $.Scratch.Get "c-language" }} language-{{ with ($.Scratch.Get "c-language") }}{{ . }}{{ end }}"> +<figure class="highlight {{ $.Scratch.Get "c-language" }} language-{{ $.Scratch.Get "c-language" }}"> <figcaption> - {{ if and (($.Scratch.Get "c-url") ($.Scratch.Get "c-title")) }} + {{ if and ($.Scratch.Get "c-url") ($.Scratch.Get "c-title") }} <span>{{ $.Scratch.Get "c-title" }}</span><a href="{{ ($.Scratch.Get "c-url") | safeURL }}" target="_blank" rel="external">{{ $.Scratch.Get "c-link-text" | default ($.Scratch.Get "c-title") }}</a> {{ else if $.Scratch.Get "c-title" }} <span>{{ $.Scratch.Get "c-title" }}</span> @@ -33,9 +33,9 @@ <pre>{{ range $index,$value := (split $trimmedContent "\n") }}<span class="line">{{ add $index 1 }}</span><br>{{ end }}</pre> </td> <td class="code"> - <pre class="code-highlight language-{{ $.Scratch.Get "c-language" }}"><code class="{{ $.Scratch.Get "c-language" }}">{{ $trimmedContent }}</code></pre> + <pre class="code-highlight language-{{ $.Scratch.Get "c-language" }} {{ $.Scratch.Get "c-language" }}"><code class="{{ $.Scratch.Get "c-language" }}">{{ $trimmedContent }}</code></pre> </td> </tr> </tbody> </table> -</figure>
\ No newline at end of file +</figure> diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html index d02e51b..2e92509 100644 --- a/layouts/shortcodes/image.html +++ b/layouts/shortcodes/image.html @@ -21,7 +21,7 @@ {{ end }} <div class="figure {{ delimit ($.Scratch.Get "i-classes") " " }}" {{ with (.Get "thumbnailWidth") }}style="width:{{ . }};"{{ end }}> {{ if eq ($.Scratch.Get "i-fancybox") 1 }} - <a class="fancybox" href="{{ .Get "src" }}"{{ with (.Get "title") }} title="{{ . }}"{{ end }} data-fancybox-group="{{ with (.Get "group") }}{{ . }}{{ end }}"> + <a class="fancybox" href="{{ .Get "src" }}"{{ with (.Get "title") }} title="{{ . }}"{{ end }} data-fancybox="{{ with (.Get "group") }}{{ . }}{{ end }}"> {{ end }} <img class="fig-img" src="{{ with (.Get "thumbnail") }}{{ . }}{{ else }}{{ .Get "src" }}{{ end }}" {{ if or (.Get "thumbnail-width") (.Get "thumbnail-height") }}style="{{ with (.Get "thumbnail-width") }}width: {{ . }};{{ end }}{{ with (.Get "thumbnail-height") }}height: {{ . }};{{ end }}"{{ end }}{{ with (.Get "title") }} alt="{{ . }}"{{ end }}> {{ if eq ($.Scratch.Get "i-fancybox") 1 }} diff --git a/layouts/shortcodes/tabbed-codeblock.html b/layouts/shortcodes/tabbed-codeblock.html index 8cacb7d..e59bf63 100644 --- a/layouts/shortcodes/tabbed-codeblock.html +++ b/layouts/shortcodes/tabbed-codeblock.html @@ -19,7 +19,7 @@ {{ end }} <figure class="codeblock codeblock--tabbed"> <figcaption> - {{ if and (($.Scratch.Get "tc-url") ($.Scratch.Get "tc-title")) }} + {{ if and ($.Scratch.Get "tc-url") ($.Scratch.Get "tc-title") }} <span><a href="{{ ($.Scratch.Get "tc-url") | safeURL }}">{{ $.Scratch.Get "tc-title" }}</a></span> {{ else if $.Scratch.Get "tc-title" }} <span>{{ $.Scratch.Get "tc-title" }}</span> @@ -29,11 +29,11 @@ <li class="tab {{ if eq $index 0 }}active{{ end }}">{{ . }}</li> {{ end }} </ul> - </figcaption> + </figcaption> <div class="tabs-content"> {{ range $index, $value := $.Scratch.Get "tc-content" }} {{ $trimmedContent := trim $value "\n" }} - <figure class="highlight language-{{ index ($.Scratch.Get "tc-languages") $index }}" style="display: {{ if eq $index 0 }}block{{ else }}none{{ end }};"> + <figure class="highlight language-{{ index ($.Scratch.Get "tc-languages") $index }} {{ index ($.Scratch.Get "tc-languages") $index }}" style="display: {{ if eq $index 0 }}block{{ else }}none{{ end }};"> <table> <tbody> <tr> @@ -41,7 +41,7 @@ <pre>{{ range $index,$value := (split $trimmedContent "\n") }}<span>{{ add $index 1 }}</span><br>{{ end }}</pre> </td> <td class="code"> - <pre class="code-highlight language-{{ index ($.Scratch.Get "tc-languages") $index }}"><code class="{{ index ($.Scratch.Get "tc-languages") $index }}">{{ $trimmedContent }}</code></pre> + <pre class="code-highlight language-{{ index ($.Scratch.Get "tc-languages") $index }} {{ index ($.Scratch.Get "tc-languages") $index }}"><code class="{{ index ($.Scratch.Get "tc-languages") $index }}">{{ $trimmedContent }}</code></pre> </td> </tr> </tbody> @@ -49,4 +49,4 @@ </figure> {{ end }} </div> -</figure>
\ No newline at end of file +</figure> diff --git a/layouts/shortcodes/toc.html b/layouts/shortcodes/toc.html new file mode 100644 index 0000000..669f274 --- /dev/null +++ b/layouts/shortcodes/toc.html @@ -0,0 +1,2 @@ +<h1 id="table-of-contents">{{ i18n "post.toc" }}</h1> +{{ .Page.TableOfContents }} diff --git a/layouts/shortcodes/wide-image.html b/layouts/shortcodes/wide-image.html index b5ff1f7..0c5574b 100644 --- a/layouts/shortcodes/wide-image.html +++ b/layouts/shortcodes/wide-image.html @@ -2,4 +2,4 @@ <div class="figure figure--fullWidth"> <img class="figure-img" src="{{ .Get "src" }}" {{ with (.Get "title") }}alt="{{ . }}"{{ end }} />{{ with (.Get "title") }}<span class="caption">{{ . }}</span>{{ end }} </div> -<div class="main-content-wrap">
\ No newline at end of file +<div class="main-content-wrap"> diff --git a/layouts/taxonomy/archive.terms.html b/layouts/taxonomy/archive.terms.html index 083fdc2..032d4ff 100644 --- a/layouts/taxonomy/archive.terms.html +++ b/layouts/taxonomy/archive.terms.html @@ -11,7 +11,7 @@ <form id="filter-form" action="#"> <input name="date" type="text" class="form-control input--xlarge" placeholder="{{ i18n "global.search_date" }}" autofocus="autofocus"> </form> - {{ partial "archive-post.html" (where .Site.RegularPages "Type" "post") }} + {{ partial "archive-post.html" (where .Site.RegularPages "Type" "in" site.Params.mainSections) }} </div> </div> </div> diff --git a/layouts/taxonomy/category.html b/layouts/taxonomy/category.html index 96381d3..2aeeacb 100644 --- a/layouts/taxonomy/category.html +++ b/layouts/taxonomy/category.html @@ -12,7 +12,7 @@ {{ with .Params.coverCaption }}hasCoverCaption{{ end }}"> {{ if or (not (isset .Site.Params "categoryPagination")) (.Site.Params.categoryPagination) }} <section class="postShorten-group main-content-wrap"> - {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{ $paginator := .Paginate (where .Data.Pages "Type" "in" site.Params.mainSections) }} {{ range $paginator.Pages }} {{ .Render "summary" }} {{ end }} @@ -23,7 +23,7 @@ <form id="filter-form" action="#"> <input name="date" type="text" class="form-control input--xlarge" placeholder="{{ i18n "global.search_date" }}" autofocus="autofocus"> </form> - {{ partial "archive-post.html" (where .Data.Pages "Type" "post") }} + {{ partial "archive-post.html" (where .Data.Pages "Type" "in" site.Params.mainSections) }} </div> {{ end }} {{ partial "footer.html" . }} diff --git a/layouts/taxonomy/category.terms.html b/layouts/taxonomy/category.terms.html index 8614713..c39e796 100644 --- a/layouts/taxonomy/category.terms.html +++ b/layouts/taxonomy/category.terms.html @@ -1,6 +1,6 @@ {{ if $.Site.Params.hierarchicalCategories }} {{ $.Scratch.Set "max-level" 0 }} - {{ range where $.Site.RegularPages "Type" "post" }} + {{ range where $.Site.RegularPages "Type" "in" site.Params.mainSections }} {{ $page := . }} {{ if .Params.categories }} {{ $categories := (apply .Params.categories "urlize" ".") }} @@ -23,7 +23,7 @@ {{ $.Scratch.Set $name $node }} {{ $.Scratch.SetInMap $level $path $node }} {{ end }} - {{ $.Scratch.SetInMap (printf "%s" (delimit (first (add $index 1) $categories) "/")) $page.UniqueID $page }} + {{ $.Scratch.SetInMap (printf "%s" (delimit (first (add $index 1) $categories) "/")) $page.File.UniqueID $page }} {{ $.Scratch.Set "parent" $path }} {{ end }} {{ $.Scratch.Set "parent" nil }} diff --git a/layouts/taxonomy/tag.html b/layouts/taxonomy/tag.html index 9d9d9f3..0e6cd7d 100644 --- a/layouts/taxonomy/tag.html +++ b/layouts/taxonomy/tag.html @@ -12,7 +12,7 @@ {{ with .Params.coverCaption }}hasCoverCaption{{ end }}"> {{ if or (not (isset .Site.Params "tagPagination")) (.Site.Params.tagPagination) }} <section class="postShorten-group main-content-wrap"> - {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{ $paginator := .Paginate (where .Data.Pages "Type" "in" site.Params.mainSections) }} {{ range $paginator.Pages }} {{ .Render "summary" }} {{ end }} @@ -23,7 +23,7 @@ <form id="filter-form" action="#"> <input name="date" type="text" class="form-control input--xlarge" placeholder="{{ i18n "global.search_date" }}" autofocus="autofocus"> </form> - {{ partial "archive-post.html" (where .Data.Pages "Type" "post") }} + {{ partial "archive-post.html" (where .Data.Pages "Type" "in" site.Params.mainSections) }} </div> {{ end }} {{ partial "footer.html" . }} |