redesign 2023
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
{{- $id := dict "Content" (trim (partial "function/dos2unix.html" .Inner) "\n") "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
<div class="mermaid" id="{{ $id }}"></div>
|
||||
{{- .Page.Scratch.SetInMap "this" "mermaid" true -}}
|
@ -0,0 +1,3 @@
|
||||
{{- $id := dict "Content" .Attributes "Scratch" .Page.Scratch | partial "function/id.html" -}}
|
||||
{{- $codeBlock := transform.Highlight .Inner .Type .Options -}}
|
||||
{{- replace $codeBlock "<div class=\"highlight\">" (printf "<div class=\"highlight\" id=\"%v\">" $id) 1 | safeHTML -}}
|
11
themes/FixIt/layouts/_default/_markup/render-image.html
Normal file
11
themes/FixIt/layouts/_default/_markup/render-image.html
Normal file
@ -0,0 +1,11 @@
|
||||
{{- if .Title -}}
|
||||
<figure>
|
||||
{{- dict "Src" .Destination "Alt" .Text "Caption" .Text "Title" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
|
||||
<figcaption class="image-caption">
|
||||
{{- .Text | safeHTML -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
{{- $linked := (eq .Page.Site.Params.page.lightgallery "force") | or (eq .Page.Params.lightgallery "force") -}}
|
||||
{{- dict "Src" .Destination "Alt" .Text "Linked" $linked "Resources" .Page.Resources | partial "plugin/image.html" -}}
|
||||
{{- end -}}
|
6
themes/FixIt/layouts/_default/_markup/render-link.html
Normal file
6
themes/FixIt/layouts/_default/_markup/render-link.html
Normal file
@ -0,0 +1,6 @@
|
||||
{{- $destination := .Destination -}}
|
||||
{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "Destination" $destination "Title" .Title "Content" .Text "ExternalIcon" .Page.Site.Params.externalIcon -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
40
themes/FixIt/layouts/_default/baseof.html
Normal file
40
themes/FixIt/layouts/_default/baseof.html
Normal file
@ -0,0 +1,40 @@
|
||||
{{- partial "init/index.html" . -}}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.LanguageCode }}">
|
||||
<head>
|
||||
{{ if .IsHome | and (ne .Site.Params.disableThemeInject true) }}
|
||||
<meta name="theme" content='FixIt {{ .Scratch.Get "version" }}'>
|
||||
{{ end }}
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
|
||||
<meta name="robots" content="noodp" />
|
||||
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
|
||||
|
||||
{{- partial "head/meta.html" . -}}
|
||||
{{- partial "head/link.html" . -}}
|
||||
{{- partial "head/seo.html" . -}}
|
||||
</head>
|
||||
<body data-header-desktop="{{ .Site.Params.header.desktopMode }}" data-header-mobile="{{ .Site.Params.header.mobileMode }}">
|
||||
{{- /* Check theme isDark before body rendering */ -}}
|
||||
{{- $theme := .Site.Params.defaulttheme -}}
|
||||
<script>(window.localStorage?.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('data-theme', 'dark');</script>
|
||||
|
||||
{{- /* Body wrapper */ -}}
|
||||
<div class="wrapper" data-page-style="{{ (.Scratch.Get `params`).pageStyle | default `normal` }}">
|
||||
{{- partial "header.html" . -}}
|
||||
{{- partial "breadcrumb.html" . -}}
|
||||
{{- $toc := .Scratch.Get "toc" -}}
|
||||
<main class="container{{ if (eq $toc.enable true) | and (eq $toc.position `left`) }} container-reverse{{ end }}">
|
||||
{{- block "content" . }}{{ end -}}
|
||||
</main>
|
||||
{{- partial "footer.html" . -}}
|
||||
</div>
|
||||
|
||||
{{- /* Theme widgets */ -}}
|
||||
{{- partial "widgets.html" . -}}
|
||||
|
||||
{{- /* Load JavaScript scripts and CSS */ -}}
|
||||
{{- partial "assets.html" . -}}
|
||||
</body>
|
||||
</html>
|
53
themes/FixIt/layouts/_default/section.html
Normal file
53
themes/FixIt/layouts/_default/section.html
Normal file
@ -0,0 +1,53 @@
|
||||
{{- define "title" }}
|
||||
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }} - {{ .Site.Title -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
<div class="page archive">
|
||||
<div class="header">
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title animate__animated animate__pulse animate__faster">
|
||||
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "allSome" }}
|
||||
<sup>{{- len .Pages -}}</sup>
|
||||
</h1>
|
||||
{{- /* Total word count */ -}}
|
||||
{{- /* See https://github.com/hugo-fixit/FixIt/issues/124 */ -}}
|
||||
{{- $localData := newScratch -}}
|
||||
{{- range .Pages -}}
|
||||
{{- $localData.Add "totalWordCount" .WordCount -}}
|
||||
{{- end -}}
|
||||
{{- with ($localData.Get "totalWordCount") -}}
|
||||
{{- $humanizedNum := . -}}
|
||||
{{- if ge $humanizedNum 1000 -}}
|
||||
{{- $humanizedNum = printf "%.2fK" (div $humanizedNum 1000.0) -}}
|
||||
{{- end -}}
|
||||
<p class="single-subtitle total-word-count" title='{{- T "taxonomy.totalwordCount" 1 }}'>
|
||||
{{- dict "Class" "fa-regular fa-keyboard fa-fw" | partial "plugin/icon.html" }} {{ T "taxonomy.totalwordCount" (dict "Count" $humanizedNum) -}}
|
||||
</p>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Paginate */ -}}
|
||||
{{- if .Pages -}}
|
||||
{{- $pages := .Pages.GroupByDate "2006" -}}
|
||||
{{- with .Site.Params.section.paginate | default .Site.Params.paginate -}}
|
||||
{{- $pages = $.Paginate $pages . -}}
|
||||
{{- else -}}
|
||||
{{- $pages = .Paginate $pages -}}
|
||||
{{- end -}}
|
||||
{{- partial "recently-updated.html" . -}}
|
||||
{{- range $pages.PageGroups -}}
|
||||
<h2 class="group-title">{{ .Key }}</h2>
|
||||
{{- range .Pages -}}
|
||||
<article class="archive-item">
|
||||
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
|
||||
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
|
||||
{{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}}
|
||||
</span>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- partial "paginator.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
42
themes/FixIt/layouts/_default/single.html
Normal file
42
themes/FixIt/layouts/_default/single.html
Normal file
@ -0,0 +1,42 @@
|
||||
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
<article class="page single special">
|
||||
<div class="header">
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title animate__animated animate__pulse animate__faster">{{- .Title -}}</h1>
|
||||
|
||||
{{- /* Subtitle */ -}}
|
||||
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . }}</p>{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Content */ -}}
|
||||
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
{{- if $params.password -}}
|
||||
{{- $saltLen := strings.RuneCount (trim $params.password "") -}}
|
||||
{{- $saltLen = cond (eq (mod $saltLen 2) 0) (add $saltLen 1) $saltLen -}}
|
||||
{{- $base64EncodeContent := $content | base64Encode -}}
|
||||
{{- $content = printf "%v%v%v"
|
||||
(substr $base64EncodeContent 0 $saltLen)
|
||||
(substr (sha256 $params.password) $saltLen)
|
||||
(substr $base64EncodeContent $saltLen)
|
||||
-}}
|
||||
{{- end -}}
|
||||
<div
|
||||
class="content"
|
||||
id="content"
|
||||
{{ with $params.password }}data-password="{{ md5 $params.password }}"{{ end }}
|
||||
{{ with $params.password }}data-content="{{ $content }}"{{ end }}
|
||||
>
|
||||
{{- if not $params.password -}}
|
||||
{{- $content -}}
|
||||
{{- else -}}
|
||||
{{- partial "single/fixit-decryptor.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Comment */ -}}
|
||||
{{- partial "single/comment.html" . -}}
|
||||
</article>
|
||||
{{- end -}}
|
15
themes/FixIt/layouts/_default/single.md
Normal file
15
themes/FixIt/layouts/_default/single.md
Normal file
@ -0,0 +1,15 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $author := .Scratch.Get "author" -}}
|
||||
# {{ .Title }}
|
||||
|
||||
{{ if $params.password -}}
|
||||
***{{ T "single.encryptedAbstract" }}***
|
||||
{{- else -}}
|
||||
{{ .RawContent | replaceRE "\n?{{% fixit-encryptor .+ %}}((\n|.)*){{% /fixit-encryptor %}}\n?" "" }}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
|
||||
> {{ T "single.author"}}: {{ with $author.link }}[{{ $author.name }}]({{ . }}){{ else }}{{ $author.name }}{{ end }}
|
||||
> URL: {{ .Permalink }}
|
||||
{{ if $params.repost.enable | and (hasPrefix $params.repost.url "http") }}> {{ T "single.repost" }} URL: {{ $params.repost.url }}{{ end }}
|
79
themes/FixIt/layouts/_default/summary.html
Normal file
79
themes/FixIt/layouts/_default/summary.html
Normal file
@ -0,0 +1,79 @@
|
||||
{{- $params := .Params | merge .Site.Params.page -}}
|
||||
|
||||
<article class="single summary" itemscope itemtype="http://schema.org/Article">
|
||||
{{- /* Featured image */ -}}
|
||||
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}}
|
||||
{{- with .Resources.GetMatch "featured-image" -}}
|
||||
{{- $image = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- with .Resources.GetMatch "featured-image-preview" -}}
|
||||
{{- $image = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- with $image -}}
|
||||
<div class="featured-image-preview">
|
||||
<a href="{{ $.RelPermalink }}" aria-label="{{ $.Title }}">
|
||||
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title" itemprop="name headline">
|
||||
{{ $repost := $params.repost | default dict }}
|
||||
{{- with $repost -}}
|
||||
{{- if eq .Enable true -}}
|
||||
{{- $icon := dict "Class" "fa-solid fa-share fa-fw" -}}
|
||||
{{- $title := cond (hasPrefix .Url "http") (printf "%v -> %v" (T "single.repost") .Url ) (T "single.repost") -}}
|
||||
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</h1>
|
||||
|
||||
{{- /* Meta */ -}}
|
||||
<div class="post-meta">
|
||||
{{- partial "single/post-author.html" . -}}
|
||||
|
||||
{{- with .Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format -}}
|
||||
<span class="post-publish" title='{{ "2006-01-02 15:04:05" | $.PublishDate.Format }}'>
|
||||
{{- printf `<time datetime="%v">%v</time>` . . | dict "Date" | T "single.publishedOnDate" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- $categories := slice -}}
|
||||
{{- range .Params.categories -}}
|
||||
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
||||
{{- $categories = $categories | append (printf `<a href="%v">%v %v</a>` (partial "function/escapeurl.html" $category.RelPermalink) (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}}
|
||||
{{- end -}}
|
||||
{{- with delimit $categories " " -}}
|
||||
<span class="post-category">
|
||||
{{- dict "Categories" . | T "single.includedInCategories" | safeHTML -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Summary content */ -}}
|
||||
<div class="content">
|
||||
{{- with .Summary -}}
|
||||
{{- dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- .Description | safeHTML -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{- /* Footer */ -}}
|
||||
<div class="post-footer">
|
||||
<a href="{{ .RelPermalink }}">{{ T "single.readMore" }}</a>
|
||||
{{- with .Params.tags -}}
|
||||
<div class="post-tags">
|
||||
{{- dict "Class" "fa-solid fa-tags fa-fw me-1" | partial "plugin/icon.html" -}}
|
||||
{{- range $value := . -}}
|
||||
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
|
||||
{{- with $tag -}}
|
||||
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .Title }}</a>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</article>
|
44
themes/FixIt/layouts/_default/taxonomy.html
Normal file
44
themes/FixIt/layouts/_default/taxonomy.html
Normal file
@ -0,0 +1,44 @@
|
||||
{{- define "title" -}}
|
||||
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
<div class="page archive">
|
||||
{{- /* Title */ -}}
|
||||
<h2 class="single-title animate__animated animate__pulse animate__faster">
|
||||
{{- $taxonomy := .Data.Singular -}}
|
||||
{{- $pageCount := len .Pages -}}
|
||||
{{- if eq $taxonomy "category" -}}
|
||||
{{ dict "Class" "fa-regular fa-folder-open fa-fw" | partial "plugin/icon.html" }}
|
||||
{{ .Title }} <sup>{{- $pageCount -}}</sup>
|
||||
{{- else if eq $taxonomy "tag" -}}
|
||||
{{ dict "Class" "fa-solid fa-tag fa-fw" | partial "plugin/icon.html" }}
|
||||
{{ .Title }} <sup>{{- $pageCount -}}</sup>
|
||||
{{- else -}}
|
||||
{{- printf "%v - %v" (T $taxonomy | default $taxonomy) .Title -}}
|
||||
{{- end -}}
|
||||
</h2>
|
||||
|
||||
{{- /* Paginate */ -}}
|
||||
{{- if .Pages -}}
|
||||
{{- $pages := .Pages.GroupByDate "2006" -}}
|
||||
{{- with .Site.Params.list.paginate | default .Site.Params.paginate -}}
|
||||
{{- $pages = $.Paginate $pages . -}}
|
||||
{{- else -}}
|
||||
{{- $pages = .Paginate $pages -}}
|
||||
{{- end -}}
|
||||
{{- range $pages.PageGroups -}}
|
||||
<h3 class="group-title">{{ .Key }}</h3>
|
||||
{{- range .Pages -}}
|
||||
<article class="archive-item">
|
||||
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
|
||||
<span class="archive-item-date" title={{ "2006-01-02 15:04:05" | .Date.Format }}>
|
||||
{{- $.Site.Params.list.dateFormat | default "01-02" | .Date.Format -}}
|
||||
</span>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- partial "paginator.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
Reference in New Issue
Block a user