refactor(params)!: flatten [params.page] to [params], snake_case keys, more page-level params support (#805)

* refactor(params)!: snake_case config + eliminate params.page + use .Param

BREAKING CHANGE: All params keys renamed from camelCase to snake_case,
[params.page] section eliminated (moved to [params] level), and users
must update their hugo.toml and front matter accordingly.

Key changes:
- All camelCase config keys → snake_case (e.g., defaultTheme → default_theme)
- [params.page] flat keys and sub-sections moved to [params] level
- Removed function/params.html (manual merge), replaced with Hugo .Param
- New function/param.html partial for page-level section params with
  shorthand boolean support and site defaults merging
- New function/camel-case.html for string conversion
- snake2camel.html renamed to camel-case-keys.html
- New function/get-cover.html for cover image resolution
- Deprecation warnings in detection-deprecated.html for old config keys
- Front matter only params (subtitle, featured_image, password, repost,
  weight, message) use .Params.xxx instead of .Param
- Page-level sections use param.html partial
- Simplified patch.html (siteTime only) and init/index.html

Refs: camel-case-keys.html#29 (planned v1.0 breaking change)

* refactor(params)!: move params.link to page-level, simplify link guard

- Move [params.link] and [params.link.guard] to page-level section
- link.html: .Page optional, use param.html when available for
  page-level override, fall back to site config without .Page
- Remove $guardConfig variable, use $config.guard directly
- Remove unnecessary .Page from callers that don't need page override
- friends.html: use param.html for link guard instead of link_guard

* refactor(params)!: move image/codeblock/json_viewer/filetree to page-level

- Move [params.image], [params.codeblock], [params.json_viewer],
  [params.filetree] to page-level sub-sections
- Templates use param.html for merged config (page override + site defaults)
- image.html: .Page optional, falls back to site config without .Page
- Add v1- prefix to all deprecation warnidf IDs
- Fix camelCase key access in image.html (blackList, cacheRemote)
- Fix Hugo-lowered camelCase keys in code-block-wrapper.html
- Add deprecation warnings for codeblock camelCase Markdown attributes
- Add deprecation warnings for file-tree camelCase Markdown attributes
- Update render-codeblock-toggle.html for snake_case attribute names

* style: standardize @param comment style across all HTML templates

- PascalCase types: {string} → {String}, {boolean} → {Boolean},
  {int} → {Int}, {map} → {Map}, {array} → {Array}
- Add missing ` - ` separator between param name and description
- Remove extra alignment spaces between type and param name

* refactor(params)!: move params.mermaid to page-level, extract gen/ templates

- Move [params.mermaid] to page-level sub-sections
- Mermaid config injected into window.config (per-page override support)
- mermaid.ts reads config from window.config.mermaid instead of parameter
- Create _partials/gen/ directory for JS content generators
- Move mermaid-bootstrap.html from plugin/ to gen/
- Extract window.config JS generation into gen/config.html
- mermaid.html uses param.html for wrapper config

* refactor(params)!: consolidate link_to_* into params.post_link section

- Move link_to_markdown/source/edit/report/vscode into [params.post_link]
- Rename keys: markdown, source, edit, report (bool), editor (string)
- editor defaults to "vscode", supports "trae" etc. via protocol template
- footer.html uses .Param "post_link" for all link toggles
- Remove link_to_* from deprecated keys list

* fix: add fallback for deprecated camelCase attributes and expand deprecation warnings

- render-codeblock-file-tree.html: folderSlash attribute fallback
- render-codeblock-toggle.html: lineNosToggler/lineWrapToggler fallback + warnings
- code-block-wrapper.html: maxShownLines/wrapperClass fallback
- detection-deprecated.html: add nested key warnings for 13 sections
  (header, breadcrumb, navigation, watermark, busuanzi, image, mermaid,
  codeblock, filetree, math.katex, math.mathjax.options, post_summary, footer)
- detection-deprecated.html: add link_guard front matter deprecation warning

* fix(mermaid): fix rendering in hidden tab panels and neutral layer scheduling

- isRenderContextActive: check tab-panel visibility via getBoundingClientRect
  instead of panel.hidden (tab-container uses slot-based hiding, not hidden attr)
- bindTabContainerChanged: render neutral layers when switching tabs so
  print/fallback scenarios work correctly
This commit is contained in:
Cell
2026-07-01 22:27:08 +08:00
committed by GitHub
parent bfef6c5359
commit 658f03d1e5
104 changed files with 1760 additions and 1625 deletions
+10 -10
View File
@@ -49,7 +49,7 @@ This article tests the **File Tree** shortcode functionality in the FixIt theme.
#### YAML format
{{< file-tree folderSlash=true >}}
{{< file-tree folder_slash=true >}}
- name: project-root
type: dir
children:
@@ -99,7 +99,7 @@ type = "file"
TOML with folder slash and level 3:
{{< file-tree file="data/example.toml" level=3 folderSlash=true />}}
{{< file-tree file="data/example.toml" level=3 folder_slash=true />}}
#### JSON format
@@ -107,7 +107,7 @@ TOML with folder slash and level 3:
JSON with folder slash and level 2:
{{< file-tree file="filetree/example.json" level=2 folderSlash=true />}}
{{< file-tree file="filetree/example.json" level=2 folder_slash=true />}}
#### YAML format
@@ -131,15 +131,15 @@ Trying the file not found case (should fallback to next mode):
#### With folder slash
{{< file-tree data="example" folderSlash=true />}}
{{< file-tree data="example" folder_slash=true />}}
#### With level and folder slash
{{< file-tree data="example" level=2 folderSlash=true />}}
{{< file-tree data="example" level=2 folder_slash=true />}}
#### Collapsed with ignore
{{< file-tree data="example" level=0 ignoreList="README.md" />}}
{{< file-tree data="example" level=0 ignore_list="README.md" />}}
## Filesystem Mode
@@ -165,13 +165,13 @@ Trying the file not found case (should fallback to next mode):
{{< file-tree "assets" 0 />}}
{{< file-tree path="assets" level=2 folderSlash=true />}}
{{< file-tree path="assets" level=2 folder_slash=true />}}
{{< file-tree "assets" -1 />}}
### With ignore lists
{{< file-tree ignoreList=".hugo_build.lock, public, resources, node_modules" level=2 folderSlash=true />}}
{{< file-tree ignore_list=".hugo_build.lock, public, resources, node_modules" level=2 folder_slash=true />}}
### root not exist
@@ -220,7 +220,7 @@ type = "file"
### With parameters
```file-tree {level=2 folderSlash=true ignoreList="config.local.js"}
```file-tree {level=2 folder_slash=true ignore_list="config.local.js"}
- name: project
type: dir
children:
@@ -242,7 +242,7 @@ type = "file"
### Fully expanded
```file-tree {level=-1 folderSlash=true}
```file-tree {level=-1 folder_slash=true}
- name: backend
type: dir
children:
+6 -5
View File
@@ -7,11 +7,12 @@ categories:
- Markdown
tags:
- Link
link_guard:
enable: true
# mode: redirect
allow_domains:
- demo.fixit.lruihao.cn
link:
guard:
enable: true
# mode: redirect
allow_domains:
- demo.fixit.lruihao.cn
---
This post validates link rendering paths in FixIt, including Markdown render hook and link shortcode modes.
@@ -9,6 +9,8 @@ categories:
tags:
- Mermaid
- Diagrams
mermaid:
zenuml: https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.min.mjs
---
The FixIt theme supports two ways to use Mermaid: code block syntax and shortcode syntax.
+3 -8
View File
@@ -43,10 +43,12 @@ _merge = "shallow"
[params]
version = "1.0.X"
collection_list = true
collection_navigation = true
[params.home.profile]
enable = true
avatarURL = "/images/fixit-test.png"
avatar_url = "/images/fixit-test.png"
[params.social]
@@ -60,15 +62,8 @@ weight = 1
# for twitter cards
# site = "hugo-fixit"
[params.page]
collectionList = true
collectionNavigation = true
[params.author]
name = "Lruihao"
email = ""
link = "https://lruihao.cn"
avatar = "https://lruihao.cn/images/avatar.jpg"
[params.mermaid]
zenuml = "https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.min.mjs"
+5 -13
View File
@@ -4,23 +4,15 @@ subtitle:
date: {{ .Date }}
slug: {{ substr .File.UniqueID 0 7 }}
draft: true
author:
name:
link:
email:
avatar:
description:
keywords:
comment: false
weight: 0
tags:
- draft
categories:
- draft
hiddenFromHomePage: false
hiddenFromSearch: false
hiddenFromRelated: false
hiddenFromFeed: false
collections:
- draft
tags:
- draft
summary:
resources:
- name: featured-image
@@ -33,7 +25,7 @@ repost:
enable: false
url:
# See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter
# See: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter
---
<!--more-->
+7 -15
View File
@@ -4,33 +4,25 @@ subtitle:
date: {{ .Date }}
slug: {{ substr .File.UniqueID 0 7 }}
draft: true
author:
name:
link:
email:
avatar:
description:
keywords:
comment: false
weight: 0
tags:
- draft
categories:
- draft
hiddenFromHomePage: false
hiddenFromSearch: false
hiddenFromRelated: false
hiddenFromFeed: false
collections:
- draft
tags:
- draft
summary:
featuredImagePreview:
featuredImage:
featured_image:
featured_image_preview:
password:
message:
repost:
enable: false
url:
# See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter
# See: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter
---
<!--more-->
+21 -16
View File
@@ -43,13 +43,6 @@ interface RenderOptions {
darkMode: boolean
}
interface MermaidBootstrapOptions {
mermaidSource: string
zenumlSource?: string
layoutLoaderSources?: string[]
config: MermaidConfig
}
let mermaid: MermaidRuntimeModule | null = null
let config: MermaidConfig = {}
let hasBoundGlobalEvents = false
@@ -179,8 +172,12 @@ function isRenderContextActive(el: Element): boolean {
return false
const panel = el.closest('.tab-panel')
if (panel instanceof HTMLElement && panel.hidden)
return false
if (panel) {
// tab-container uses slot-based hiding; check actual layout visibility
const panelRect = panel.getBoundingClientRect()
if (panelRect.width === 0 && panelRect.height === 0)
return false
}
return true
}
@@ -231,11 +228,11 @@ function ensureMermaidInitialized(theme: string, darkMode: boolean): void {
startOnLoad: false,
darkMode,
theme,
securityLevel: config.securitylevel,
securityLevel: config.securityLevel,
look: config.look,
layout: config.layout,
fontFamily: config.fontfamily,
altFontFamily: config.fontfamily,
fontFamily: config.fontFamily,
altFontFamily: config.fontFamily,
})
}
@@ -271,7 +268,7 @@ async function renderMermaidElement(el: Element | null, options: RenderOptions):
try {
const result = await mermaid.render(id, source, el)
const svg = result?.svg ?? ''
el.innerHTML = svg
svg && (el.innerHTML = svg)
if (typeof result?.bindFunctions === 'function') {
try {
result.bindFunctions(el)
@@ -681,6 +678,12 @@ function bindTabContainerChanged(): void {
if (!panel)
return
observeMermaidContainers(panel, true)
// Also schedule neutral layer render for the newly visible panel
const neutralNodes = panel.querySelectorAll<Element>('.mermaid-neutral')
neutralNodes.forEach((el) => {
if (!el.hasAttribute('data-processed'))
void renderMermaidElement(el, { theme: 'neutral', darkMode: false })
})
}, false)
}
@@ -856,10 +859,12 @@ function unwrapModule<T>(mod: { default?: T } | T): T {
/**
* Bootstrap entry used by template-injected script.
* Loads Mermaid and optional extensions via dynamic import and hands runtime to initMermaidRuntime.
* @param options Bootstrap options provided by template-injected script.
*/
export async function bootstrapMermaid(options: MermaidBootstrapOptions): Promise<void> {
const { mermaidSource, zenumlSource = '', layoutLoaderSources = [], config } = options
export async function bootstrapMermaid(): Promise<void> {
config = window.config?.mermaid ?? {}
const mermaidSource = config.cdn || 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs'
const zenumlSource = config.zenuml || ''
const layoutLoaderSources = config.layoutLoaders || []
try {
// Mermaid core module is required; optional modules degrade gracefully.
+3 -3
View File
@@ -3,10 +3,10 @@ export interface MermaidConfig {
cdn?: string
zenuml?: string
themes?: string[]
securitylevel?: string
securityLevel?: string
look?: string
fontfamily?: string
layoutloaders?: string[]
fontFamily?: string
layoutLoaders?: string[]
layout?: string
}
+1 -1
View File
@@ -1,4 +1,4 @@
// FixIt Responsive breakpoints system design
// FixIt responsive breakpoints system design
// ┌──────┬───────────┬───────────┬──────────────┐
// │ Name │ min-width │ max-width │ Direction │
// ├──────┼───────────┼───────────┼──────────────┤
+1
View File
@@ -4,6 +4,7 @@ export default antfu({
typescript: true,
ignores: [
'node_modules/**',
'archetypes/**',
'assets/css/unocss.css',
'assets/lib/**',
'public/**',
+793 -781
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
{{- define "title" -}}
{{- T "pageNotFound" | printf "404 %v" -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
+24 -14
View File
@@ -1,20 +1,20 @@
{{- /*
Render hook for file-tree code blocks
Alternative to file-tree shortcode's inner content rendering.
Supported attributes:
- level: The expand level of the tree (expand all: -1, collapse all: 0, default: 1)
- folderSlash: Whether to append a trailing "/" to folder names (default: false)
- ignoreList: List of file or folder names to ignore, separated by commas
- highlightList: List of file or folder names to highlight, separated by commas
- folder_slash: Whether to append a trailing "/" to folder names (default: false)
- ignore_list: List of file or folder names to ignore, separated by commas
- highlight_list: List of file or folder names to highlight, separated by commas
Content format: YAML/JSON/TOML with the following item structure:
name: string - The name of the file or folder
type: string - Type of item, either "dir" (directory) or "file"
children?: array - (Optional) Array of child items, only valid for directories
Example usage:
```file-tree {level=2 folderSlash=true}
```file-tree {level=2 folder_slash=true}
- name: my-project
type: dir
children:
@@ -25,12 +25,22 @@
```
*/ -}}
{{- $pageConfig := dict | merge .Page.Params.filetree | merge .Page.Site.Params.filetree -}}
{{- $pageConfig := dict "Page" .Page "Key" "filetree" | partial "function/param.html" -}}
{{- $config := .Attributes | merge $pageConfig -}}
{{- $level := cond (isset $config "level") ($config.level | int) 1 -}}
{{- $folderSlash := $config.folderslash | default false -}}
{{- $ignoreList := union (apply (split (.Attributes.ignorelist | default "") ",") "trim" "." " ") $pageConfig.ignorelist -}}
{{- $highlightList := apply (split (.Attributes.highlightlist | default "") ",") "trim" "." " " -}}
{{- $folderSlash := $config.folder_slash | default .Attributes.folderslash | default false -}}
{{- $ignoreList := union (apply (split (.Attributes.ignore_list | default .Attributes.ignorelist | default "") ",") "trim" "." " ") $pageConfig.ignore_list -}}
{{- $highlightList := union (apply (split (.Attributes.highlight_list | default .Attributes.highlightlist | default "") ",") "trim" "." " ") $pageConfig.highlight_list -}}
{{- /* Deprecated camelCase attribute support */ -}}
{{- if isset .Attributes "folderslash" -}}
{{- warnidf "v1-deprecated-file-tree-attr" "The attribute `folderSlash` is deprecated since v1.0.0, use `folder_slash` instead. See %s" .Position -}}
{{- end -}}
{{- if isset .Attributes "ignorelist" | and (not (isset .Attributes "ignore_list")) -}}
{{- warnidf "v1-deprecated-file-tree-attr" "The attribute `ignoreList` is deprecated since v1.0.0, use `ignore_list` instead. See %s" .Position -}}
{{- end -}}
{{- if isset .Attributes "highlightlist" | and (not (isset .Attributes "highlight_list")) -}}
{{- warnidf "v1-deprecated-file-tree-attr" "The attribute `highlightList` is deprecated since v1.0.0, use `highlight_list` instead. See %s" .Position -}}
{{- end -}}
{{- $content := strings.TrimSpace .Inner | default "" -}}
{{- $treeData := slice -}}
@@ -44,8 +54,8 @@
{{- $options := dict
"items" $treeData
"level" $level
"folderSlash" $folderSlash
"ignoreList" $ignoreList
"highlightList" $highlightList
"folder_slash" $folderSlash
"ignore_list" $ignoreList
"highlight_list" $highlightList
-}}
{{- partial "plugin/file-tree.html" $options -}}
+7 -2
View File
@@ -1,6 +1,11 @@
{{- $jsonViewer := .Attributes | merge .Page.Params.jsonViewer | merge .Page.Site.Params.jsonViewer -}}
{{- $jsonViewer := .Attributes | merge (dict "Page" .Page "Key" "json_viewer" | partial "function/param.html") -}}
{{- if $jsonViewer.enable | and (ne hugo.Context.MarkupScope "home") -}}
{{- $attrs := printf `expand-depth="%v"` $jsonViewer.expanddepth -}}
{{- /* Deprecated camelCase attribute support: Hugo lowercases Markdown attributes, so expandDepthexpanddepth */ -}}
{{- if isset .Attributes "expanddepth" | and (not (isset .Attributes "expand_depth")) -}}
{{- warnidf "v1-deprecated-json-viewer-attr" "The attribute `expandDepth` is deprecated since v1.0.0, use `expand_depth` instead. See %s" .Position -}}
{{- $jsonViewer = dict "expand_depth" .Attributes.expanddepth | merge $jsonViewer -}}
{{- end -}}
{{- $attrs := printf `expand-depth="%v"` $jsonViewer.expand_depth -}}
{{- $copyable := false -}}
{{- with $jsonViewer.copyable -}}
{{- $copyable = dict "copyText" (T "assets.copyText") "copiedText" (T "assets.copiedText") -}}
+10 -4
View File
@@ -32,11 +32,17 @@
{{- if ne .Attributes.fullscreen nil -}}
{{- $commonAttrsStr = printf "%s, fullscreen=%v" $commonAttrsStr .Attributes.fullscreen -}}
{{- end -}}
{{- if ne .Attributes.linenostoggler nil -}}
{{- $commonAttrsStr = printf "%s, lineNosToggler=%v" $commonAttrsStr .Attributes.linenostoggler -}}
{{- if ne (.Attributes.line_nos_toggler | default .Attributes.linenostoggler) nil -}}
{{- $commonAttrsStr = printf "%s, line_nos_toggler=%v" $commonAttrsStr (.Attributes.line_nos_toggler | default .Attributes.linenostoggler) -}}
{{- if isset .Attributes "linenostoggler" | and (not (isset .Attributes "line_nos_toggler")) -}}
{{- warnidf "v1-deprecated-toggle-attr" "The attribute `lineNosToggler` is deprecated since v1.0.0, use `line_nos_toggler` instead. See %s" $.Position -}}
{{- end -}}
{{- end -}}
{{- if ne .Attributes.linewraptoggler nil -}}
{{- $commonAttrsStr = printf "%s, lineWrapToggler=%v" $commonAttrsStr .Attributes.linewraptoggler -}}
{{- if ne (.Attributes.line_wrap_toggler | default .Attributes.linewraptoggler) nil -}}
{{- $commonAttrsStr = printf "%s, line_wrap_toggler=%v" $commonAttrsStr (.Attributes.line_wrap_toggler | default .Attributes.linewraptoggler) -}}
{{- if isset .Attributes "linewraptoggler" | and (not (isset .Attributes "line_wrap_toggler")) -}}
{{- warnidf "v1-deprecated-toggle-attr" "The attribute `lineWrapToggler` is deprecated since v1.0.0, use `line_wrap_toggler` instead. See %s" $.Position -}}
{{- end -}}
{{- end -}}
{{- if ne .Attributes.editable nil -}}
{{- $commonAttrsStr = printf "%s, editable=%v" $commonAttrsStr .Attributes.editable -}}
+4 -9
View File
@@ -1,14 +1,9 @@
{{- /* Read the config and format */ -}}
{{- $params := .Page.Params | merge site.Params.page -}}
{{- /* Toc data patch */ -}}
{{- $toc := $params.toc -}}
{{- if not (reflect.IsMap $toc) -}}
{{- $toc = dict "enable" $toc | merge site.Params.page.toc -}}
{{- end -}}
{{- $headingConfig := $params.heading -}}
{{- $toc := dict "Page" .Page "Key" "toc" | partial "function/param.html" -}}
{{- $headingConfig := dict "Page" .Page "Key" "heading" | partial "function/param.html" -}}
{{- /* Only enable in main section pages */ -}}
{{- $intersect := (slice .Page.Section .Page.Type) | intersect site.MainSections -}}
{{- $onlyMainSection := cond $headingConfig.number.onlyMainSection ((gt (len $intersect) 0) | and (eq .Page.Kind "page")) true -}}
{{- $onlyMainSection := cond $headingConfig.number.only_main_section ((gt (len $intersect) 0) | and (eq .Page.Kind "page")) true -}}
{{- $ordered := $toc.ordered | and $headingConfig.number.enable | and $onlyMainSection -}}
{{- $h1Format := $headingConfig.number.format.h1 | default "{title}" -}}
{{- $h2Format := $headingConfig.number.format.h2 | default "{h2} {title}" -}}
@@ -17,7 +12,7 @@
{{- $h5Format := $headingConfig.number.format.h5 | default "{h2}.{h3}.{h4}.{h5} {title}" -}}
{{- $h6Format := $headingConfig.number.format.h6 | default "{h2}.{h3}.{h4}.{h5}.{h6} {title}" -}}
{{- $level := .Level -}}
{{- $maxMarkupLevel := cond $toc.decreaseH1 2 1 -}}
{{- $maxMarkupLevel := cond $toc.decrease_h1 2 1 -}}
{{- /* Disable ordered headings on home page */ -}}
{{- if eq hugo.Context.MarkupScope "home" -}}
+6 -6
View File
@@ -7,21 +7,21 @@ A Markdown image has three components: the image description, the image destinat
------------ ------------------ ---------
.Text .Destination .Title
*/ -}}
{{- $params := .Page.Params | merge site.Params.page -}}
{{- $optim := slice
{{- $optim := slice
(dict "Process" "resize 800x webp" "descriptor" "800w")
(dict "Process" "resize 1200x webp" "descriptor" "1200w")
(dict "Process" "resize 1600x webp" "descriptor" "1600w")
-}}
{{- $lightgallery := .Page.Param "lightgallery" -}}
{{- if .Title -}}
{{- $linked := ne $params.lightgallery false -}}
{{- $linked := ne $lightgallery false -}}
<figure>
{{- dict "Src" .Destination "Alt" .PlainText "Title" .Title "Caption" .Text "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- dict "Page" .Page "Src" .Destination "Alt" .PlainText "Title" .Title "Caption" .Text "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
<figcaption class="image-caption">
{{- .Title | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- $linked := (eq $params.lightgallery "force") | or ($params.lightgallery | and (ne .Title "")) -}}
{{- dict "Src" .Destination "Alt" .PlainText "Title" .Title "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- $linked := (eq $lightgallery "force") | or ($lightgallery | and (ne .Title "")) -}}
{{- dict "Page" .Page "Src" .Destination "Alt" .PlainText "Title" .Title "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- end -}}
+2 -14
View File
@@ -1,10 +1,4 @@
{{- $params := .Page.Params | merge site.Params.page -}}
{{- $math := $params.math -}}
{{- if eq $math true -}}
{{- $math = dict "enable" true | merge site.Params.page.math -}}
{{- else if eq $math false -}}
{{- $math = dict "enable" false -}}
{{- end -}}
{{- $math := dict "Page" .Page "Key" "math" "ToCamel" true | partial "function/param.html" -}}
{{- /*
Mathematical formulas rendering:
@@ -15,13 +9,7 @@
*/ -}}
{{- if $math.enable | and (ne hugo.Context.MarkupScope "home") -}}
{{- if eq $math.type "katex" -}}
{{- $katex := $math.katex -}}
{{- $opts := dict "output" "htmlAndMathml" "displayMode" (eq $.Type "block") }}
{{- $opts = dict "throwOnError" $katex.throwOnError "errorColor" $katex.errorColor | merge $opts }}
{{- $macros := $katex.macros | default dict -}}
{{- if $macros -}}
{{- $opts = dict "macros" $macros | merge $opts -}}
{{- end -}}
{{- $opts := $math.katex | merge (dict "output" "htmlAndMathml" "displayMode" (eq $.Type "block")) }}
{{- /* render mathematical markup to HTML */ -}}
{{- with try (transform.ToMath .Inner $opts) }}
{{- with .Err }}
+45 -57
View File
@@ -14,7 +14,6 @@
*/ -}}
{{- $noop := .WordCount -}}
{{- $params := partial "function/params.html" -}}
{{- $cdn := .Site.Store.Get "cdn" | default dict -}}
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
{{- $config := (.Store.Get "this").config -}}
@@ -33,36 +32,36 @@
{{- $source := $cdn.autocompleteJS | default "lib/autocomplete-js/index.production.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $placeholder := $search.placeholder | default (T "assets.searchPlaceholder") -}}
{{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "assets.noResultsFound") "placeholder" $placeholder "clearText" (T "assets.clear") | dict "search" | merge $config -}}
{{- $config = dict "maxResultLength" $search.max_result_length "snippetLength" $search.snippet_length "highlightTag" $search.highlight_tag "noResultsFound" (T "assets.noResultsFound") "placeholder" $placeholder "clearText" (T "assets.clear") | dict "search" | merge $config -}}
{{- if eq $search.type "algolia" -}}
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/browser.umd.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
{{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.app_id "algoliaSearchKey" $search.algolia.search_key | dict "search" | merge $config -}}
{{- else if eq $search.type "fuse" -}}
{{- with .Site.Home.OutputFormats.Get "search" -}}
{{- $config = dict "type" "fuse" "fuseIndexURL" .RelPermalink | dict "search" | merge $config -}}
{{- end -}}
{{- dict "Source" "js/lib/fuse.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $config = dict "isCaseSensitive" $search.fuse.isCaseSensitive "minMatchCharLength" $search.fuse.minMatchCharLength "findAllMatches" $search.fuse.findAllMatches "location" $search.fuse.location "threshold" $search.fuse.threshold "distance" $search.fuse.distance "ignoreLocation" $search.fuse.ignoreLocation "useExtendedSearch" $search.fuse.useExtendedSearch "ignoreFieldNorm" $search.fuse.ignoreFieldNorm | dict "search" | merge $config -}}
{{- $config = dict "isCaseSensitive" $search.fuse.is_case_sensitive "minMatchCharLength" $search.fuse.min_match_char_length "findAllMatches" $search.fuse.find_all_matches "location" $search.fuse.location "threshold" $search.fuse.threshold "distance" $search.fuse.distance "ignoreLocation" $search.fuse.ignore_location "useExtendedSearch" $search.fuse.use_extended_search "ignoreFieldNorm" $search.fuse.ignore_field_norm | dict "search" | merge $config -}}
{{- else if eq $search.type "pagefind" -}}
{{- $config = dict "type" "pagefind" | dict "search" | merge $config -}}
{{- $pagefind := $search.pagefind | default dict -}}
{{- $bundlePath := relURL ($pagefind.bundlePath | default "pagefind/") -}}
{{- $bundlePath := relURL ($pagefind.bundle_path | default "pagefind/") -}}
{{- if not (hasSuffix $bundlePath "/") -}}
{{- $bundlePath = printf "%v/" $bundlePath -}}
{{- end -}}
{{- $config = dict
"bundlePath" $bundlePath
"debounceTimeoutMs" ($pagefind.debounceTimeoutMs | default 300)
"useBuiltInFilters" ($pagefind.useBuiltInFilters | default true)
"sortBy" ($pagefind.sortBy | default "")
"sortOrder" ($pagefind.sortOrder | default "desc")
"debounceTimeoutMs" ($pagefind.debounce_timeout_ms | default 300)
"useBuiltInFilters" ($pagefind.use_built_in_filters | default true)
"sortBy" ($pagefind.sort_by | default "")
"sortOrder" ($pagefind.sort_order | default "desc")
| dict "pagefind" | merge $config
-}}
{{- else if eq $search.type "cse" -}}
{{- $config = dict "type" "cse" | dict "search" | merge $config -}}
{{- $cse := .Site.Params.cse -}}
{{- $resultsPage := $cse.resultsPage -}}
{{- $resultsPage := $cse.results_page -}}
{{- if not (hasPrefix $resultsPage (relURL "")) -}}
{{- $resultsPage = path.Join (relURL "") $resultsPage -}}
{{- end -}}
@@ -77,7 +76,7 @@
{{- end -}}
{{- /* instant.page */ -}}
{{- if $params.instantPage -}}
{{- if .Param "instant_page" -}}
{{- $source := $cdn.instantPage | default "lib/instant-page/instantpage.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}
@@ -89,8 +88,18 @@
{{- dict "Source" "js/lib/json-viewer.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}
{{- /* Mermaid */ -}}
{{- if .Store.Get "hasMermaid" | and (not $isArchivesOrOffline) -}}
{{- if .Store.Get "hasPanzoom" -}}
{{- $source := $cdn.panzoomJS | default "lib/panzoom/panzoom.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- end -}}
{{- $mermaid := dict "Page" . "Key" "mermaid" "ToCamel" true | partial "function/param.html" -}}
{{- $config = dict "mermaid" $mermaid | merge $config -}}
{{- end -}}
{{- /* twemoji */ -}}
{{- if $params.twemoji -}}
{{- if .Param "twemoji" -}}
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $config = dict "twemoji" true | merge $config -}}
@@ -98,7 +107,7 @@
{{- end -}}
{{- /* lightgallery */ -}}
{{- if $params.lightgallery | or (eq $params.lightgallery "force") -}}
{{- if (.Param "lightgallery") | or (eq (.Param "lightgallery") "force") -}}
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
@@ -119,15 +128,15 @@
{{- /* TypeIt */ -}}
{{- if .Store.Get "hasTyped" -}}
{{- $typeit := .Site.Params.typeit -}}
{{- $typeit := partial "function/camel-case-keys.html" .Site.Params.typeit -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "loop" $typeit.loop | dict "typeit" | merge $config -}}
{{- $config = dict "typeit" $typeit | merge $config -}}
{{- dict "Source" "js/lib/typeit.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}
{{- /* KaTeX */ -}}
{{- $math := .Store.Get "math" -}}
{{- $math := dict "Page" . "Key" "math" "ToCamel" true | partial "function/param.html" -}}
{{- if .Store.Get "hasKaTeX" | and (not $isArchivesOrOffline) -}}
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
@@ -185,7 +194,8 @@
{{- $source = $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.js" -}}
{{- dict "Source" $source "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}}
{{- $mapbox := dict "Page" . "Key" "mapbox" | partial "function/param.html" -}}
{{- $config = dict "accessToken" $mapbox.access_token "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}}
{{- dict "Source" "js/lib/mapbox.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}
@@ -244,17 +254,13 @@
{{- end -}}
{{- /* Watermark */ -}}
{{- if eq .Site.Params.watermark.enable true -}}
{{- $watermarkConfig := partial "function/camel-case-keys.html" .Site.Params.watermark | default dict -}}
{{- if $watermarkConfig.enable -}}
{{- $source := $cdn.cellWatermarkJS | default "lib/cell-watermark/watermark.js" -}}
{{- dict "Source" $source "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $watermarkConfig := .Site.Params.watermark | default dict -}}
{{- $watermarkConfig = dict
"appendTo" ".widgets"
"content" ($watermarkConfig.content | default $author.name | default .Site.Title)
"rowSpacing" $watermarkConfig.rowSpacing
"colSpacing" $watermarkConfig.colSpacing
"fontSize" $watermarkConfig.fontSize
"fontFamily" $watermarkConfig.fontFamily
| merge $watermarkConfig
-}}
{{- $config = dict "watermark" $watermarkConfig | merge $config -}}
@@ -263,7 +269,7 @@
{{- /* Content Decryption */ -}}
{{- $encryptPartial := .Store.Get "hasEncryptor" -}}
{{- if $params.password | or $encryptPartial -}}
{{- if .Params.password | or $encryptPartial -}}
{{- $cryptoCoreJS := $cdn.cryptoCoreJS | default "lib/crypto-js/core.js" -}}
{{- $cryptoEncBase64JS := $cdn.cryptoEncBase64JS | default "lib/crypto-js/enc-base64.js" -}}
{{- $cryptoSha256JS := $cdn.cryptoSha256JS | default "lib/crypto-js/sha256.js" -}}
@@ -274,7 +280,7 @@
{{- dict "Source" $xxhashWasmJS "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- /* Decryption script */ -}}
{{- dict "Source" "js/lib/fixit-decryptor.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $config = dict "all" (isset $params "password") "shortcode" ($encryptPartial | default false) | dict "encryption" | merge $config -}}
{{- $config = dict "all" (.Params.password | not | not) "shortcode" ($encryptPartial | default false) | dict "encryption" | merge $config -}}
{{- end -}}
{{- /* Busuanzi visitor counter */ -}}
@@ -284,7 +290,7 @@
{{- end -}}
{{- /* Site creation time */ -}}
{{- $siteTime := .Site.Store.Get "siteTime" -}}
{{- $siteTime := .Site.Params.footer.site_time -}}
{{- if $siteTime.enable -}}
{{- with $siteTime.value -}}
{{- $config = dict "siteTime" . | merge $config -}}
@@ -307,7 +313,7 @@
{{- /* Auto Bookmark */ -}}
{{- if eq .Kind "page" -}}
{{- with $params.autoBookmark -}}
{{- with .Param "auto_bookmark" -}}
{{- $config = dict "autoBookmark" . | merge $config -}}
{{- end -}}
{{- end -}}
@@ -333,56 +339,38 @@
{{- end -}}
{{- /* Print */ -}}
{{- $config = partial "function/snake2camel.html" .Site.Params.print | dict "print" | merge $config -}}
{{- $config = partial "function/camel-case-keys.html" .Site.Params.print | dict "print" | merge $config -}}
{{- /* PostChat */ -}}
{{- partial "plugin/post-chat-ai.html" . -}}
{{- range $params.library.css -}}
{{- $library := dict "Page" . "Key" "library" | partial "function/param.html" -}}
{{- range $library.css -}}
{{- dict "Source" . "Fingerprint" $fingerprint | dict "Page" $ "Data" | partial "store/style.html" -}}
{{- end -}}
{{- range $params.library.js -}}
{{- range $library.js -}}
{{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- end -}}
{{- /* Runtime config script (window.config) */ -}}
{{- $configJS := $config | jsonify | printf "window.config=%s;" -}}
{{- if hugo.IsServer -}}
{{- $configJS = add $configJS "console.log('Page config:', window.config);" -}}
{{- end -}}
{{- $targetPath := "" -}}
{{- /* Runtime config script */ -}}
{{- $configJS := dict "Config" $config | partial "gen/config.html" -}}
{{- $configPath := "" -}}
{{- if $uniqueFileId | and (not .IsHome) -}}
{{- $targetPath = printf "%s/js/config/%s.js" $languagePrefix $uniqueFileId -}}
{{- $configPath = printf "%s/js/config/%s.js" $languagePrefix $uniqueFileId -}}
{{- end -}}
{{- dict "Content" $configJS "Path" $targetPath "Minify" hugo.IsProduction "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- dict "Content" $configJS "Path" $configPath "Minify" hugo.IsProduction "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- /* File-tree plugin */ -}}
{{- dict "Source" "js/lib/file-tree.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- /* Mermaid plugin */ -}}
{{- /* Mermaid module */ -}}
{{- if .Store.Get "hasMermaid" | and (not $isArchivesOrOffline) -}}
{{- if .Store.Get "hasPanzoom" -}}
{{- $source := $cdn.panzoomJS | default "lib/panzoom/panzoom.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- end -}}
{{- $mermaid := .Site.Params.mermaid -}}
{{- $mermaidCDN := $mermaid.cdn | default "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs" -}}
{{- $zenumlCDN := $mermaid.zenuml | default "" -}}
{{- $layoutLoaders := $mermaid.layoutloaders | default slice -}}
{{- $options := dict "format" "esm" -}}
{{- $mermaidModule := dict "Resource" (resources.Get "js/lib/mermaid.ts") "Build" $options "Fingerprint" $fingerprint | partial "function/js-build.html" -}}
{{- $mermaidModuleURL := $mermaidModule.RelPermalink -}}
{{- $bootstrapJS := dict
"MermaidModuleURL" $mermaidModuleURL
"MermaidCDN" $mermaidCDN
"ZenumlCDN" $zenumlCDN
"LayoutLoaders" $layoutLoaders
"Mermaid" $mermaid
| partial "plugin/mermaid-bootstrap.html"
"MermaidModuleURL" $mermaidModule.RelPermalink
| partial "gen/mermaid-bootstrap.html"
| htmlUnescape
-}}
{{- dict "Content" $bootstrapJS "Path" "js/lib/mermaid-bootstrap.js" "Minify" hugo.IsProduction "Attr" `type="module"` "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
+4 -4
View File
@@ -3,12 +3,12 @@
<nav aria-label="breadcrumb" class="breadcrumb-container{{ if .Site.Params.breadcrumb.sticky }} sticky{{ end }}">
<ol class="breadcrumb">
{{- range .Ancestors.Reverse -}}
{{- if .IsHome | and (not .Site.Params.breadcrumb.showHome) -}}
{{- if .IsHome | and (not .Site.Params.breadcrumb.show_home) -}}
{{- continue -}}
{{- end -}}
{{- $title := "" -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}}
{{- $capitalizeTitles := .Param "capitalize_titles" -}}
{{- with .Description -}}
{{- $title = . -}}
{{- else -}}
@@ -23,14 +23,14 @@
{{- $innerText = T "single.home" -}}
{{- else -}}
{{- $innerText = .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}}
{{- $innerText = cond ((.Param "breadcrumb.capitalize") | and $capitalizeTitles) (title $innerText) $innerText -}}
{{- $innerText = cond (.Site.Params.breadcrumb.capitalize | and $capitalizeTitles) (title $innerText) $innerText -}}
{{- end -}}
<li class="breadcrumb-item" data-separator="{{ $separator }}"><a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $innerText }}</a></li>
{{- end -}}
{{- $currentText := .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}}
{{- $currentText = cond ((.Param "breadcrumb.capitalize") | and (.Param "capitalizeTitles")) (title $currentText) $currentText -}}
{{- $currentText = cond (.Site.Params.breadcrumb.capitalize | and (.Param "capitalize_titles")) (title $currentText) $currentText -}}
<li class="breadcrumb-item active" data-separator="{{ $separator }}" aria-current="page">{{ $currentText }}</li>
</ol>
</nav>
+1 -2
View File
@@ -386,8 +386,7 @@
{{- block "custom-comment" . }}{{ end -}}
</div>
{{- /* lightgallery for Artalk and Twikoo */ -}}
{{- $params := partial "function/params.html" -}}
{{- if not $params.lightgallery | and (($artalk.enable | and $artalk.lightgallery) | or ($twikoo.enable | and $twikoo.lightgallery)) -}}
{{- if not (.Param "lightgallery") | and (($artalk.enable | and $artalk.lightgallery) | or ($twikoo.enable | and $twikoo.lightgallery)) -}}
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
+3 -3
View File
@@ -11,11 +11,11 @@
<div class="footer-line powered{{ with $footerConfig.order.powered }} order-{{ . }}{{ end }}">
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreferrer" title="Hugo %v">{hugoLogo}Hugo</a>` hugo.Version -}}
{{- $theme := printf `<a href="https://github.com/hugo-fixit/FixIt" target="_blank" rel="external" title="FixIt %v">{themeLogo}FixIt</a>` (hugo.Store.Get "version") -}}
{{- if $footerConfig.powered.hugoLogo -}}
{{- if $footerConfig.powered.hugo_logo -}}
{{- $hugoLogo := printf `<img class="hugo-icon" src="%v" alt="Hugo logo" /> ` (resources.Get "images/hugo.svg" | minify).RelPermalink -}}
{{- $hugo = replace $hugo "{hugoLogo}" $hugoLogo -}}
{{- end -}}
{{- if $footerConfig.powered.themeLogo -}}
{{- if $footerConfig.powered.theme_logo -}}
{{- $themeLogo := printf `<img class="fixit-icon" src="%v" alt="FixIt logo" /> ` (resources.Get "images/fixit.svg" | minify).RelPermalink -}}
{{- $theme = replace $theme "{themeLogo}" $themeLogo -}}
{{- end -}}
@@ -53,7 +53,7 @@
</div>
{{- end -}}
{{- $siteTime := .Site.Store.Get "siteTime" -}}
{{- $siteTime := .Site.Params.footer.site_time -}}
{{- if $siteTime.enable -}}
<div class="footer-line statistics{{ with $footerConfig.order.statistics }} order-{{ . }}{{ end }}">
{{- if $siteTime.enable | and $siteTime.value -}}
+10 -11
View File
@@ -50,7 +50,7 @@
{{- end -}}
{{- /* Mastodon Verification */ -}}
{{- with .Site.Params.social.Mastodon -}}
{{- with .Site.Params.social.mastodon -}}
{{- $id := "" -}}
{{- $prefix := "https://mastodon.social/" -}}
{{- if reflect.IsMap . -}}
@@ -66,7 +66,7 @@
{{- end -}}
{{- /* ========== LINK: Favicon, Canonical, Feeds, Stylesheets ========== */ -}}
{{- $title := printf "%s %s %s" .Title .Site.Params.titleDelimiter .Site.Title -}}
{{- $title := printf "%s %s %s" .Title .Site.Params.title_delimiter .Site.Title -}}
{{- if .IsHome -}}
{{- $title = .Site.Title -}}
{{- end -}}
@@ -123,8 +123,6 @@
<link rel="preload" href="{{ $mainResource.RelPermalink }}" as="script">
{{- /* ========== SEO: Structured Data (Schema.org) ========== */ -}}
{{- $params := partial "function/params.html" -}}
{{- /* Search Engine Verification */ -}}
{{- with .Site.Params.verification.google -}}
<meta name="google-site-verification" content="{{ . }}" />
@@ -167,7 +165,7 @@
{{- with .Site.Params.description -}}
"description": {{ . | safeHTML }},
{{- end -}}
{{- $image := .Site.Params.seo.image -}}
{{- $image := .Site.Params.seo.cover -}}
{{- with dict "Path" $image | partial "function/resource.html" -}}
"image": {
"@type": "ImageObject",
@@ -180,7 +178,7 @@
"image": "{{ . | absURL }}",
{{- end -}}
{{- end -}}
{{- with .Site.Params.seo.thumbnailUrl -}}
{{- with .Site.Params.seo.thumbnail_url -}}
{{- with dict "Path" . | partial "function/resource.html" -}}
"thumbnailUrl": "{{ .Permalink }}",
{{- else -}}
@@ -204,6 +202,7 @@
{{- $authorName = . -}}
{{- end -}}
{{- end -}}
{{- $seo := dict "Page" . "Key" "seo" | partial "function/param.html" -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
@@ -214,7 +213,7 @@
"@type": "WebPage",
"@id": "{{ .Permalink }}"
},
{{- $images := $params.seo.images | default slice -}}
{{- $images := $seo.images | default slice -}}
{{- if not $images -}}
{{- with .Resources.GetMatch "featured-image-preview" -}}
{{- $images = slice "featured-image-preview" -}}
@@ -223,7 +222,7 @@
{{- $images = slice "featured-image" -}}
{{- end -}}
{{- end -}}
{{- with .Site.Params.seo.image -}}
{{- with .Site.Params.seo.cover -}}
{{- $images = $images | default (slice .) -}}
{{- end -}}
{{- with $images -}}
@@ -263,11 +262,11 @@
"license": {{ . | safeHTML }},
{{- end -}}
{{- $publisher := $authorName | dict "name" -}}
{{- $publisher = $params.seo.publisher | default dict | merge $publisher -}}
{{- $publisher = $seo.publisher | default dict | merge $publisher -}}
"publisher": {
"@type": "Organization",
"name": {{ $publisher.name | safeHTML }}
{{- $logo := $publisher.logoUrl -}}
{{- $logo := $publisher.logo_url -}}
{{- with dict "Path" $logo | partial "function/resource.html" -}}
,"logo": {
"@type": "ImageObject",
@@ -296,7 +295,7 @@
{{- /* Theme Color Scheme & Platform Detection (runs before page render) */ -}}
{{- $options := dict "targetPath" "js/head.js" -}}
{{- $options = dict "defaultTheme" .Site.Params.defaulttheme | dict "params" | merge $options -}}
{{- $options = dict "defaultTheme" .Site.Params.default_theme | dict "params" | merge $options -}}
{{- dict "Source" "js/head/index.ts" "Build" $options "Fingerprint" $fingerprint | partial "plugin/script.html" -}}
{{- /* Custom head */ -}}
+1 -1
View File
@@ -3,7 +3,7 @@
{{- /* Desktop header */ -}}
<header class="desktop animate__faster{{ if .Site.Params.header.blur }} is-blur{{ end }}" id="header-desktop">
<div class="header-wrapper"{{ if .Site.Params.githubCorner.enable }} data-github-corner="{{ .Site.Params.githubCorner.position }}"{{ end }}>
<div class="header-wrapper"{{ if .Site.Params.github_corner.enable }} data-github-corner="{{ .Site.Params.github_corner.position }}"{{ end }}>
<div class="header-title">
<a href="{{ $relLangURL }}" title="{{ .Site.Title }}" class="header-title-link">
{{- with .Site.Params.header.title -}}
+8 -12
View File
@@ -1,6 +1,5 @@
<div class="widgets">
{{- $backToTop := .Site.Params.backToTop -}}
{{- $params := partial "function/params.html" -}}
{{- $backToTop := .Site.Params.back_to_top -}}
{{- $comment := .Store.Get "comment" -}}
{{- if $backToTop.enable | or $comment.enable -}}
<div class="fixed-buttons">
@@ -18,7 +17,7 @@
{{- end -}}
{{- /* toc dialog button */ -}}
{{- if .Store.Get "showToc" -}}
<button type="button" id="toc-drawer-button" class="fixed-button toc-drawer-button hidden{{ with $params.password }} encrypted-hidden{{ end }}" aria-label="{{ T `single.contents` }}" aria-controls="toc-dialog" aria-expanded="false">
<button type="button" id="toc-drawer-button" class="fixed-button toc-drawer-button hidden{{ with .Params.password }} encrypted-hidden{{ end }}" aria-label="{{ T `single.contents` }}" aria-controls="toc-dialog" aria-expanded="false">
{{- dict "Class" "fa-solid fa-bars" | partial "plugin/icon.html" -}}
</button>
{{- end -}}
@@ -32,7 +31,7 @@
{{- end -}}
{{- /* GitHub Corners */ -}}
{{- $githubCorner := .Site.Params.githubCorner -}}
{{- $githubCorner := .Site.Params.github_corner -}}
{{- if $githubCorner.enable -}}
{{- with $githubCorner -}}
{{- $githubImage := `<svg viewBox="0 0 250 250" aria-hidden="true" width="56" height="56"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg>` -}}
@@ -88,7 +87,7 @@
{{- end -}}
{{- /* Reading progress bar */ -}}
{{- $readingProgress := .Site.Params.readingProgress -}}
{{- $readingProgress := .Site.Params.reading_progress -}}
{{- if $readingProgress.enable -}}
{{- with $readingProgress -}}
{{- $style := printf "%v: 0;%v: 0;" (.Start | default "left") (.Position | default "top") -}}
@@ -109,10 +108,7 @@
{{- end -}}
{{- /* Link Guard Dialog */ -}}
{{- $linkGuard := .Site.Params.link.guard -}}
{{- with .Params.link_guard -}}
{{- $linkGuard = (cond (reflect.IsMap .) . (dict "enable" .)) | merge $linkGuard -}}
{{- end -}}
{{- $linkGuard := (dict "Page" . "Key" "link" | partial "function/param.html").guard | default dict -}}
{{- if $linkGuard.enable | and (eq $linkGuard.mode "modal") -}}
<dialog id="link-guard-dialog" aria-labelledby="link-guard-dialog-title" closedby="any">
<div class="guard-content">
@@ -132,9 +128,6 @@
</dialog>
{{- end -}}
{{- /* Custom widgets */ -}}
{{- block "custom-widgets" . }}{{ end -}}
{{- /* Service Worker Update Notification */ -}}
{{- if .Site.Params.app.pwa -}}
<div class="sw-update-notification">
@@ -146,6 +139,9 @@
</div>
{{- end -}}
{{- /* Custom widgets */ -}}
{{- block "custom-widgets" . }}{{ end -}}
<noscript>
<div class="noscript-warning bg-danger text-white text-base font-bold fixed text-center inset-x-0 bottom-0 w-full z-fixed">{{ T "baseof.noscript" }}</div>
</noscript>
+15 -15
View File
@@ -1,104 +1,104 @@
{{- define "custom-head" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.head -}}
{{- range .Site.Params.custom_partials.head -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-menu:desktop" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.menuDesktop -}}
{{- range .Site.Params.custom_partials.menu_desktop -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-menu:mobile" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.menuMobile -}}
{{- range .Site.Params.custom_partials.menu_mobile -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-profile" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.profile -}}
{{- range .Site.Params.custom_partials.profile -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-aside" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.aside -}}
{{- range .Site.Params.custom_partials.aside -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-comment" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.comment -}}
{{- range .Site.Params.custom_partials.comment -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-footer" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.footer -}}
{{- range .Site.Params.custom_partials.footer -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-widgets" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.widgets -}}
{{- range .Site.Params.custom_partials.widgets -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-assets" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.assets -}}
{{- range .Site.Params.custom_partials.assets -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__toc:before" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postTocBefore -}}
{{- range .Site.Params.custom_partials.post_toc_before -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__toc:after" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postTocAfter -}}
{{- range .Site.Params.custom_partials.post_toc_after -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__content:before" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postContentBefore -}}
{{- range .Site.Params.custom_partials.post_content_before -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__content:after" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postContentAfter -}}
{{- range .Site.Params.custom_partials.post_content_after -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__footer:before" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postFooterBefore -}}
{{- range .Site.Params.custom_partials.post_footer_before -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
{{- define "custom-post__footer:after" -}}
{{- $ctx := . -}}
{{- range .Site.Params.customPartials.postFooterAfter -}}
{{- range .Site.Params.custom_partials.post_footer_after -}}
{{- partial . $ctx -}}
{{- end -}}
{{- end -}}
+12 -18
View File
@@ -1,8 +1,12 @@
{{- $pages := .Pages -}}
{{- /* Front matter: password */ -}}
{{- $pages = where $pages "Params.password" "eq" nil -}}
{{- /* Front matter: hiddenFromFeed */ -}}
{{- $pages = where $pages "Params.hiddenFromFeed" "ne" true -}}
{{- /* Front matter: hidden_from_feed */ -}}
{{- if .Site.Params.hidden_from_feed -}}
{{- $pages = where $pages "Params.hidden_from_feed" false -}}
{{- else -}}
{{- $pages = where $pages "Params.hidden_from_feed" "!=" true -}}
{{- end -}}
{{- if ge .Config.limit 1 -}}
{{- $pages = $pages | first .Config.limit -}}
{{- end -}}
@@ -13,10 +17,10 @@
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<description>{{ .Site.Params.description | default .Site.Title }}</description>
{{- if and (.Site.Params.feed.follow.feedId) (.Site.Params.feed.follow.userId) }}
{{- if and (.Site.Params.feed.follow.feed_id) (.Site.Params.feed.follow.user_id) }}
<follow_challenge>
<feedId>{{ .Site.Params.feed.follow.feedId }}</feedId>
<userId>{{ .Site.Params.feed.follow.userId }}</userId>
<feedId>{{ .Site.Params.feed.follow.feed_id }}</feedId>
<userId>{{ .Site.Params.feed.follow.user_id }}</userId>
</follow_challenge>
{{- end }}
<generator>Hugo {{ hugo.Version }} &amp; FixIt {{ hugo.Store.Get "version" }}</generator>
@@ -29,19 +33,9 @@
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }}
{{- range $page := $pages }}
{{- $params := .Params | merge .Site.Params.Page }}
{{- $fullText := ((.Params.feed | default dict) | merge $.Config ).fulltext }}
{{- $fullText := ((.Params.feed | default dict) | merge $.Config ).full_text }}
{{- $author := partial "function/get-author-map.html" .Params.author }}
{{- $image := $params.featuredimagepreview | default $params.featuredimage }}
{{- with dict "Path" $image "Resources" .Resources | partial "function/resource.html" }}
{{- $image = .Permalink }}
{{- end }}
{{- with .Resources.GetMatch "featured-image" }}
{{- $image = .Permalink }}
{{- end }}
{{- with .Resources.GetMatch "featured-image-preview" }}
{{- $image = .Permalink }}
{{- end }}
{{- $cover := dict "Page" . "Preview" true "Build" true | partial "function/get-cover.html" -}}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
@@ -55,7 +49,7 @@
{{- end }}
{{- if $fullText }}
<description>
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome "FeaturedImage" $image | partial "function/xml-content.html" -}}
{{- dict "Content" .Content "Ruby" (.Param "ruby") "Fraction" (.Param "fraction") "Fontawesome" (.Param "fontawesome") "FeaturedImage" $cover.URL | partial "function/xml-content.html" -}}
</description>
{{- else }}
<description>{{ (.Summary | default .Description | default .Title) | transform.XMLEscape | safeHTML }}</description>
@@ -4,8 +4,8 @@
This is mainly used to avoid problems caused by Hugo's case-insensitive config key parsing.
Keep config keys in snake_case, then convert them here for stable access in templates and JS.
@param {map} . - The input map/object with snake_case keys
@return {map} A new map with camelCase keys, or the input if it's not a map
@param {Map|Slice} . - The input with snake_case keys
@return {Map|Slice} A new value with camelCase keys
@example
// Simple Map conversion
@@ -24,9 +24,7 @@
@example
// Practical usage in templates
{{- $siteParams := partial "function/snake2camel.html" .Site.Params }}
// Now access parameters with camelCase: $siteParams.codeBlock.enableWrapper
// [todo] refactor all config to use snake_case in Hugo config files, and camelCase in templates and JS (v1.0 breaking change)
{{- $siteParams := partial "function/camel-case-keys.html" .Site.Params }}
*/ -}}
{{- $input := . -}}
{{- $output := dict -}}
@@ -34,23 +32,8 @@
{{- if reflect.IsMap $input -}}
{{- /* Process map: iterate through all key-value pairs */ -}}
{{- range $key, $value := $input -}}
{{- /*
Convert key from snake_case to camelCase
Example: "max_shown_lines" -> "maxShownLines"
Strategy: split by "_", capitalize first letter of each part (except first), then concatenate
*/ -}}
{{- $parts := split $key "_" -}}
{{- $newKey := index $parts 0 -}}
{{- range $i, $part := $parts -}}
{{- if gt $i 0 -}}
{{- /* Capitalize first letter, preserve the rest */ -}}
{{- $first := upper (substr $part 0 1) -}}
{{- $rest := substr $part 1 -}}
{{- $newKey = printf "%s%s%s" $newKey $first $rest -}}
{{- end -}}
{{- end -}}
{{- /*
{{- $newKey := partial "function/camel-case.html" $key -}}
{{- /*
Recursively process value based on its type
- For nested maps: recursively convert all nested keys
- For arrays: process each map element in the array
@@ -58,18 +41,18 @@
*/ -}}
{{- $newValue := $value -}}
{{- if reflect.IsMap $value -}}
{{- $newValue = partial "function/snake2camel.html" $value -}}
{{- $newValue = partial "function/camel-case-keys.html" $value -}}
{{- else if reflect.IsSlice $value -}}
{{- $newValue = slice -}}
{{- range $item := $value -}}
{{- if reflect.IsMap $item -}}
{{- $newValue = $newValue | append (partial "function/snake2camel.html" $item) -}}
{{- $newValue = $newValue | append (partial "function/camel-case-keys.html" $item) -}}
{{- else -}}
{{- $newValue = $newValue | append $item -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* Add the converted key-value pair to output */ -}}
{{- $output = merge $output (dict $newKey $newValue) -}}
{{- end -}}
@@ -79,13 +62,12 @@
{{- $output := slice -}}
{{- range $item := $input -}}
{{- if reflect.IsMap $item -}}
{{- $output = $output | append (partial "function/snake2camel.html" $item) -}}
{{- $output = $output | append (partial "function/camel-case-keys.html" $item) -}}
{{- else -}}
{{- $output = $output | append $item -}}
{{- end -}}
{{- end -}}
{{- return $output -}}
{{- else -}}
{{- /* Return scalar values unchanged */ -}}
{{- return $input -}}
{{- end -}}
@@ -0,0 +1,17 @@
{{- /*
Convert a snake_case string to camelCase.
Strategy: split by "_", capitalize first letter of each part (except first), then concatenate
@param {String} . - The snake_case string
@return {String} The camelCase string
@example "max_shown_lines" -> "maxShownLines"
*/ -}}
{{- $parts := split . "_" -}}
{{- $result := index $parts 0 -}}
{{- range $i, $part := $parts -}}
{{- if gt $i 0 -}}
{{- $result = printf "%s%s%s" $result (upper (substr $part 0 1)) (substr $part 1) -}}
{{- end -}}
{{- end -}}
{{- return $result -}}
+2 -2
View File
@@ -16,11 +16,11 @@
{{- if $config.title -}}
{{- $titleEl = printf `<span class="code-title">%s<span class="title-inner">%s</span></span>` $foldIcon $config.title -}}
{{- end -}}
{{- if $config.linenostoggler -}}
{{- if $config.line_nos_toggler -}}
{{- $lineNosIcon := dict "Class" "fa-solid fa-list-ol" | partial "plugin/icon.html" -}}
{{- $lineNosBtn = printf `<button type="button" class="action-btn line-nos-btn" aria-label="%s" title="%s">%s</button>` (T "assets.toggleLineNumbers") (T "assets.toggleLineNumbers") $lineNosIcon -}}
{{- end -}}
{{- if $config.linewraptoggler -}}
{{- if $config.line_wrap_toggler -}}
{{- $lineWrapIcon := dict "Class" "fa-solid fa-right-left" | partial "plugin/icon.html" -}}
{{- $lineWrapBtn = printf `<button type="button" class="action-btn line-wrap-btn" aria-label="%s" title="%s">%s</button>` (T "assets.toggleLineWrap") (T "assets.toggleLineWrap") $lineWrapIcon -}}
{{- end -}}
@@ -1,6 +1,6 @@
{{- /*
Get author in map format.
@param {String|Map} . the author name or map
@param {String|Map} . - The author name or map
@returns {Map}
@example {{- $author := partial "function/get-author-map.html" .Params.author -}}
*/ -}}
+74
View File
@@ -0,0 +1,74 @@
{{- /*
Get the cover image for a page.
Resolves the cover image by checking front matter params first, then page resources.
Supports remote URLs, inline data URIs, and local page/global resources.
Resolution order:
1. Front matter: featured_image_preview (if Preview=true) or featured_image
2. Page resources: "featured-image-preview" (if Preview=true), then "featured-image"
3. Global resources: by the front matter value as a path
@param {Map} . - Configuration dict
- Page: {Page} the page context (required)
- Preview: {Boolean} if true, prefer featured_image_preview over featured_image (default: false)
- Build: {Boolean} if true, resolve resource objects and permalinks; if false, only check existence (default: false)
@return {Map} dict with:
- Source: {String} the raw front matter value (may be empty)
- Matches: {Slice} matched resource names (e.g., ["featured-image-preview"])
- Resource: {Object} the resolved Hugo resource object (empty dict if Build=false or not found)
- URL: {String} the resolved permalink, or raw front matter value if resource not found
@example
{{- $cover := dict "Page" . | partial "function/get-cover.html" -}}
{{- with $cover.URL }}<img src="{{ . }}">{{ end -}}
{{- $cover := dict "Page" . "Preview" true | partial "function/get-cover.html" -}}
{{- dict "Src" $cover.URL "Resources" .Resources "Matches" $cover.Matches | partial "plugin/image.html" -}}
*/ -}}
{{- $page := .Page -}}
{{- $preview := .Preview | default false -}}
{{- $build := .Build | default false -}}
{{- /* Resolve front matter value */ -}}
{{- $image := "" -}}
{{- if $preview -}}
{{- $image = $page.Params.featured_image_preview | default $page.Params.featured_image -}}
{{- else -}}
{{- $image = $page.Params.featured_image -}}
{{- end -}}
{{- /* Skip resource resolution for remote URLs and inline data URIs */ -}}
{{- $isInline := strings.HasPrefix $image "data:image" -}}
{{- $isRemote := urls.Parse $image | partial "function/is-url-remote.html" -}}
{{- $matches := slice -}}
{{- $resource := dict -}}
{{- $url := $image -}}
{{- if not $isRemote | and (not $isInline) -}}
{{- /* Check which named resources exist in the page bundle */ -}}
{{- if $preview -}}
{{- if $page.Resources.GetMatch "featured-image-preview" -}}
{{- $matches = $matches | append "featured-image-preview" -}}
{{- end -}}
{{- end -}}
{{- if $page.Resources.GetMatch "featured-image" -}}
{{- $matches = $matches | append "featured-image" -}}
{{- end -}}
{{- /* When Build=true, resolve the actual resource object and its permalink */ -}}
{{- if $build -}}
{{- /* Try matched resource names first (priority order) */ -}}
{{- range $matches -}}
{{- $resource = $page.Resources.GetMatch . -}}
{{- if $resource -}}
{{- break -}}
{{- end -}}
{{- end -}}
{{- /* Fallback: try page resources by path, then global assets */ -}}
{{- $resource = $resource | default ($page.Resources.Get $image) | default (resources.Get $image) -}}
{{- $url = $resource.RelPermalink | default $image -}}
{{- end -}}
{{- end -}}
{{- return (dict "Source" $image "Matches" $matches "Resource" $resource "URL" $url) -}}
+14 -14
View File
@@ -7,24 +7,24 @@
NOTE: For performance reasons, the recursion depth is limited to 10 levels by default.
@param {string} root - The root path to scan (relative to project root or contentDir)
@param {string} [path] - The directory path for recursive calls
@param {int} [level=10] - Descend only level directories deep
@param {int} [deep=0] - Current depth level for recursive calls
@param {array} [ignoreList] - List of file or folder names to ignore
@param {boolean} [isRecursive=false] - Internal flag for recursive calls
@param {string} [name] - Project name for the root node, if set to `{path}`, uses the full root path
@param {string} [lang] - Page language for multilingual sites
@param {boolean} [log=false] - Whether to log warnings
@return {array} Array of tree items with structure: {name, type, children?}, or empty array if root doesn't exist
@param {String} root - The root path to scan (relative to project root or contentDir)
@param {String} [path] - The directory path for recursive calls
@param {Int} [level=10] - Descend only level directories deep
@param {Int} [deep=0] - Current depth level for recursive calls
@param {Array} [ignore_list] - List of file or folder names to ignore
@param {Boolean} [is_recursive=false] - Internal flag for recursive calls
@param {String} [name] - Project name for the root node, if set to `{path}`, uses the full root path
@param {String} [lang] - Page language for multilingual sites
@param {Boolean} [log=false] - Whether to log warnings
@return {Array} Array of tree items with structure: {name, type, children?}, or empty array if root doesn't exist
*/ -}}
{{- $result := slice -}}
{{- $level := .level | default 10 -}}
{{- $deep := .deep | default 0 -}}
{{- $isRecursive := .isRecursive | default false -}}
{{- $isRecursive := .is_recursive | default false -}}
{{- $_ignoreList := slice ".DS_Store" "Thumbs.db" ".directory" ".git" "node_modules" "public" -}}
{{- $ignoreList := .ignoreList | default slice | union $_ignoreList -}}
{{- $ignoreList := .ignore_list | default slice | union $_ignoreList -}}
{{- $_debug := eq hugo.Environment "debug" | and hugo.IsServer -}}
{{- if $isRecursive -}}
@@ -41,7 +41,7 @@
{{- $item := dict "name" .Name "type" (cond .IsDir "dir" "file") -}}
{{- if .IsDir -}}
{{- $fullPath := path.Clean (path.Join $path .Name) -}}
{{- $childOptions := dict "path" $fullPath "deep" (add $deep 1) "ignoreList" $ignoreList "isRecursive" true -}}
{{- $childOptions := dict "path" $fullPath "deep" (add $deep 1) "ignore_list" $ignoreList "is_recursive" true -}}
{{- $children := partial "function/get-file-tree.html" $childOptions -}}
{{- $item = merge $item (dict "children" $children) -}}
{{- end -}}
@@ -85,7 +85,7 @@
{{- /* Build children recursively */ -}}
{{- if $_debug -}}{{- warnf "[file-tree]> %v:" $rootLabel -}}{{- end -}}
{{- $childOptions := dict "path" $root "deep" (add $deep 1) "level" $level "ignoreList" $ignoreList "isRecursive" true -}}
{{- $childOptions := dict "path" $root "deep" (add $deep 1) "level" $level "ignore_list" $ignoreList "is_recursive" true -}}
{{- $children := partial "function/get-file-tree.html" $childOptions -}}
{{- /* Return root item with children */ -}}
+3 -3
View File
@@ -1,8 +1,8 @@
{{- /*
Get Gravatar URL.
@param {String} Email the email address
@param {String} Size the size in pixels (optional, default: 200)
@returns {String} the Gravatar URL
@param {String} Email - The email address
@param {String} Size - The size in pixels (optional, default: 200)
@returns {String} The Gravatar URL
@example {{- $gravatar := dict "Email" "user@example.com" "Size" "32" | partial "function/get-gravatar.html" -}}
*/ -}}
@@ -1,9 +1,9 @@
{{- /*
Resolve taxonomy icon by slot with site-level overrides.
@param {String} .Taxonomy taxonomy singular key, e.g. "tag", "category"
@param {String} .Slot icon slot: "title", "card", "term"
@return {String} icon class
@param {String} .Taxonomy - Taxonomy singular key, e.g. "tag", "category"
@param {String} .Slot - Icon slot: "title", "card", "term"
@return {String} Icon class
*/ -}}
{{- $taxonomy := .Taxonomy | default "category" -}}
{{- $slot := .Slot | default "title" -}}
+4 -4
View File
@@ -1,9 +1,9 @@
{{- /*
Build and minify a JS resource with unified behavior.
@param {resource.Resource} .Resource Hugo resource to process
@param {Object|Boolean} [.Build] true for defaults, dict for custom options, false/omit to skip js.Build
@param {Boolean} [.Minify] extra minify flag; final minify is Minify OR Build.minify
@param {String} [.Fingerprint] fingerprint algorithm (e.g. "sha256")
@param {resource.Resource} .Resource - Hugo resource to process
@param {Object|Boolean} [.Build] - True for defaults, dict for custom options, false/omit to skip js.Build
@param {Boolean} [.Minify] - Extra minify flag; final minify is Minify OR Build.minify
@param {String} [.Fingerprint] - Fingerprint algorithm (e.g. "sha256")
@return {resource.Resource}
*/ -}}
+28
View File
@@ -0,0 +1,28 @@
{{- /*
Get a page-level section param with shorthand support and site defaults merged.
Handles shorthand booleans in front matter (e.g., `toc: true`) by wrapping them
in a dict with an "enable" key, then merges with site-level defaults.
For Page-level scalar params (e.g., capitalize_titles, ruby, password), use
.Param "xxx" directly instead of this partial.
@param {Map} . - Dict with "Page", "Key", and optional "ToCamel" fields
- Page: the page context
- Key: the param key name (e.g., "toc", "reward", "math")
- ToCamel: if true, convert result keys to camelCase (default: false)
@return {Map} The merged param map
@example
{{- $toc := dict "Page" . "Key" "toc" | partial "function/param.html" -}}
{{- $config := dict "Page" . "Key" "math" "ToCamel" true | partial "function/param.html" -}}
*/ -}}
{{- $value := .Page.Param .Key -}}
{{- if not (reflect.IsMap $value) -}}
{{- $value = dict "enable" $value -}}
{{- end -}}
{{- $value = $value | merge (index site.Params .Key) -}}
{{- if .ToCamel -}}
{{- $value = partial "function/camel-case-keys.html" $value -}}
{{- end -}}
{{- return $value -}}
-2
View File
@@ -1,2 +0,0 @@
{{- $params := page.Params | merge site.Params.page -}}
{{- return $params -}}
+1 -1
View File
@@ -13,7 +13,7 @@
"\\?" "fa-regular fa-circle-question"
-}}
{{- /* Custom Task lists */ -}}
{{- $iconMap = site.Params.taskList | merge $iconMap -}}
{{- $iconMap = site.Params.task_list | merge $iconMap -}}
{{- /* Get the extended signs */ -}}
{{- $extendedSigns := slice -}}
+4 -4
View File
@@ -1,9 +1,9 @@
{{- /*
Compile SCSS to CSS via dartsass, optionally minify and fingerprint.
@param {resource.Resource} .Resource SCSS resource
@param {Object|Boolean} [.ToCSS] true for defaults, dict for custom toCSS options, false/omit to skip
@param {Boolean} [.Minify] whether to minify; defaults to hugo.IsProduction when ToCSS is used
@param {String} [.Fingerprint] fingerprint algorithm (e.g. "sha256")
@param {resource.Resource} .Resource - SCSS resource
@param {Object|Boolean} [.ToCSS] - True for defaults, dict for custom toCSS options, false/omit to skip
@param {Boolean} [.Minify] - Whether to minify; defaults to hugo.IsProduction when ToCSS is used
@param {String} [.Fingerprint] - Fingerprint algorithm (e.g. "sha256")
@return {resource.Resource}
*/ -}}
+12
View File
@@ -0,0 +1,12 @@
{{- /*
Generate per-page runtime config as window.config JS content.
@param {Object} .Config - The assembled config dict
@return {string} The JS content string (window.config=<JSON>;)
*/ -}}
{{- $content := .Config | jsonify | printf "window.config=%s;" -}}
{{- if hugo.IsServer -}}
{{- $content = add $content "console.log('Page config:', window.config);" -}}
{{- end -}}
{{- return $content -}}
@@ -0,0 +1,14 @@
{{- /*
Mermaid bootstrap script generator.
Returns inline module JS source used by store/script.html.
Config is read from window.config.mermaid at runtime.
@param {String} .MermaidModuleURL - Mermaid module URL
*/ -}}
{{- printf `/** Mermaid bootstrap script generator. */
import { bootstrapMermaid } from %s
void bootstrapMermaid()
`
(.MermaidModuleURL | jsonify)
-}}
+3 -3
View File
@@ -2,7 +2,7 @@
{{- $author := partial "function/get-author-map.html" .Params.author -}}
<div class="home-profile">
{{- $avatar := dict "Email" $profile.gravatarEmail "Size" "96" | partial "function/get-gravatar.html" | default $profile.avatarURL | default $author.avatar -}}
{{- $avatar := dict "Email" $profile.gravatar_email "Size" "96" | partial "function/get-gravatar.html" | default $profile.avatar_url | default $author.avatar -}}
{{- if $avatar -}}
<div class="home-avatar">
{{- $menus := $.Site.Menus.main | default slice -}}
@@ -12,9 +12,9 @@
(dict "Process" "fill center 192x192 webp" "descriptor" "192w")
-}}
{{- $avatarMenuIndex := 0 -}}
{{- if $profile.avatarMenu -}}
{{- if $profile.avatar_menu -}}
{{- range $index, $menu := $menus -}}
{{- if eq $menu.Identifier $profile.avatarMenu -}}
{{- if eq $menu.Identifier $profile.avatar_menu -}}
{{- $avatarMenuIndex = $index -}}
{{- end -}}
{{- end -}}
+1 -1
View File
@@ -16,7 +16,7 @@
{{- end -}}
{{- /* object-fit-images */ -}}
{{- if $compatibility.objectFit -}}
{{- if $compatibility.object_fit -}}
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}
@@ -6,6 +6,113 @@
{{- $warns = $warns | append "The parameter `params.externalIcon` is deprecated since v1.0.0, use `params.link.external_icon` instead." -}}
{{- end -}}
{{- /* params.page structural migration warnings */ -}}
{{- $deprecatedPageKeys := slice
"capitalize_titles" "summary_plainify" "author_avatar"
"hidden_from_home_page" "hidden_from_search" "hidden_from_related" "hidden_from_feed"
"twemoji" "lightgallery" "ruby" "fraction" "fontawesome" "license"
"page_style" "auto_bookmark" "show_lastmod" "word_count" "reading_time" "end_flag"
"instant_page" "collection_list" "collection_navigation" "edit_url" "source_url"
"featured_image" "featured_image_preview"
"toc" "expiration_reminder" "heading" "math" "mapbox"
"related" "reward" "share" "comment" "library" "seo"
-}}
{{- $onlyFrontMatters := slice "subtitle" "featured_image" "featured_image_preview" "repost" -}}
{{- range $deprecatedPageKeys -}}
{{- $newKey := . -}}
{{- $oldKey := replace . "_" "" -}}
{{- $oldDisplay := partial "function/camel-case.html" $newKey -}}
{{- if (in $.Site.Params.page $oldKey) | and (not (in $onlyFrontMatters $newKey)) -}}
{{- $warns = $warns | append (printf "The parameter `params.page.%s` has been removed since v1.0.0, use `params.%s` instead." $oldDisplay $newKey) -}}
{{- end -}}
{{- if (in $.Site.Params.page $oldKey) | and (in $onlyFrontMatters $newKey) -}}
{{- $warns = $warns | append (printf "The parameter `params.page.%s` has been removed since v1.0.0, use front matter parameter `%s` instead." $oldDisplay $newKey) -}}
{{- end -}}
{{- if (in $.Page.Params $oldKey) | and (in $newKey "_") -}}
{{- $warns = $warns | append (printf "Front matter parameter `%s` is deprecated since v1.0.0, use `%s` instead." $oldDisplay $newKey) -}}
{{- end -}}
{{- end -}}
{{- /* camelCase → snake_case param/section rename warnings */ -}}
{{- $deprecatedKeys := slice
"default_theme"
"date_format"
"with_site_title"
"disable_theme_inject"
"title_delimiter"
"index_with_subtitle"
"enable_translation_merge"
"tag_cloud"
"post_chat"
"post_summary"
"git_info"
"back_to_top"
"reading_progress"
"github_corner"
"recently_updated"
"json_viewer"
"custom_partials"
"task_list"
"repo_version"
-}}
{{- range $deprecatedKeys -}}
{{- $newKey := . -}}
{{- $oldKey := replace . "_" "" -}}
{{- $oldDisplay := partial "function/camel-case.html" $newKey -}}
{{- with index $.Site.Params $oldKey -}}
{{- $warns = $warns | append (printf "The parameter `params.%s` has been removed since v1.0.0, use `params.%s` instead." $oldDisplay $newKey) -}}
{{- end -}}
{{- end -}}
{{- /* Nested camelCase key rename warnings */ -}}
{{- $deprecatedNestedKeys := dict
"search" (slice "content_length" "absolute_url" "max_result_length" "snippet_length" "highlight_tag")
"search.algolia" (slice "app_id" "search_key")
"header" (slice "desktop_mode" "mobile_mode")
"breadcrumb" (slice "show_home")
"navigation" (slice "in_section")
"footer.powered" (slice "hugo_logo" "theme_logo")
"footer" (slice "site_time")
"home.profile" (slice "only_first_page" "gravatar_email" "avatar_url" "avatar_menu")
"home.posts" (slice "image_preview")
"watermark" (slice "row_spacing" "col_spacing" "font_size" "font_family")
"busuanzi" (slice "site_views" "page_views")
"image" (slice "cache_remote" "black_list")
"mermaid" (slice "security_level" "font_family" "layout_loaders")
"codeblock" (slice "wrapper_class" "max_shown_lines" "line_nos_toggler" "line_wrap_toggler")
"filetree" (slice "folder_slash" "ignore_list")
"math.katex" (slice "copy_tex" "throw_on_error" "error_color")
"math.mathjax.options" (slice "enable_menu" "skip_html_tags" "ignore_html_class")
"post_summary" (slice "post_url" "word_limit" "typing_animate" "beginning_text" "loading_text")
-}}
{{- range $sectionPath, $keys := $deprecatedNestedKeys -}}
{{- $parts := split $sectionPath "." -}}
{{- $section := $.Site.Params -}}
{{- $valid := true -}}
{{- range $parts -}}
{{- if reflect.IsMap $section -}}
{{- $section = index $section . -}}
{{- else -}}
{{- $valid = false -}}
{{- end -}}
{{- end -}}
{{- if $valid | and (reflect.IsMap $section) -}}
{{- range $keys -}}
{{- $newKey := . -}}
{{- $oldKey := replace . "_" "" -}}
{{- $oldDisplay := partial "function/camel-case.html" $newKey -}}
{{- with index $section $oldKey -}}
{{- $warns = $warns | append (printf "The parameter `params.%s.%s` has been removed since v1.0.0, use `params.%s.%s` instead." $sectionPath $oldDisplay $sectionPath $newKey) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* Front matter key migration warnings */ -}}
{{- with $.Page.Params.link_guard -}}
{{- $warns = $warns | append "Front matter parameter `link_guard` has been removed since v1.0.0, use `link.guard` instead." -}}
{{- end -}}
{{- if fileExists "assets/css/_custom.scss" -}}
{{- $warns = $warns | append "The file `assets/css/_custom.scss` is deprecated. Please move your custom styles to `assets/scss/custom.scss`." -}}
{{- end -}}
+1 -7
View File
@@ -1,5 +1,4 @@
{{- /* FixIt theme environment detection */ -}}
{{- $params := partial "function/params.html" -}}
{{- if hugo.IsProduction -}}
{{- $cdn := .Site.Params.cdn -}}
@@ -14,12 +13,7 @@
{{- .Site.Store.Set "cdn" $cdn -}}
{{- .Site.Store.Set "fingerprint" .Site.Params.fingerprint -}}
{{- .Site.Store.Set "analytics" .Site.Params.analytics -}}
{{- .Store.Set "comment" $params.comment -}}
{{- if eq .Params.comment true -}}
{{- .Store.Set "comment" .Site.Params.page.comment -}}
{{- else if eq .Params.comment false -}}
{{- .Store.Set "comment" (dict "enable" false) -}}
{{- end -}}
{{- .Store.Set "comment" (dict "Page" . "Key" "comment" | partial "function/param.html") -}}
{{- else -}}
{{- .Site.Store.Set "devOpts" .Site.Params.dev -}}
{{- if ne .Site.Params.dev.enable true -}}
+1 -1
View File
@@ -1,7 +1,7 @@
{{- $pages := .Site.RegularPages }}
{{- /* Merge missing translations from other languages */ -}}
{{- if .Site.Params.enableTranslationMerge -}}
{{- if .Site.Params.enable_translation_merge -}}
{{- range .Site.Home.Translations -}}
{{- $pages = $pages | lang.Merge .Site.RegularPages -}}
{{- end -}}
-1
View File
@@ -6,5 +6,4 @@
{{- partial "init/detection-deprecated.html" . -}}
{{- partial "init/detection-pagefind.html" . -}}
{{- partial "init/global.html" . -}}
{{- partial "init/patch.html" . -}}
{{- partial "init/compatibility.html" . -}}
-38
View File
@@ -1,38 +0,0 @@
{{- /* FixIt theme patches */ -}}
{{- $params := partial "function/params.html" -}}
{{- /* Toc data patch */ -}}
{{- $toc := $params.toc -}}
{{- if not (reflect.IsMap $toc) -}}
{{- $toc = dict "enable" $toc | merge .Site.Params.page.toc -}}
{{- end -}}
{{- .Store.Set "toc" $toc -}}
{{- /* Reward data patch */ -}}
{{- $reward := $params.reward -}}
{{- if eq $reward true -}}
{{- $reward = dict "enable" true | merge .Site.Params.page.reward -}}
{{- else if eq $reward false -}}
{{- $reward = dict "enable" false -}}
{{- end -}}
{{- .Store.Set "reward" $reward -}}
{{- /* KaTeX data patch */ -}}
{{- $math := $params.math -}}
{{- if eq $math true -}}
{{- $math = dict "enable" true | merge .Site.Params.page.math -}}
{{- else if eq $math false -}}
{{- $math = dict "enable" false -}}
{{- end -}}
{{- .Store.Set "math" $math -}}
{{- /* SiteTime config patch */ -}}
{{- $siteTime := dict "Animate" true "Icon" "fa-solid fa-heartbeat" -}}
{{- with .Site.Params.footer.siteTime -}}
{{- if reflect.IsMap . -}}
{{- $siteTime = . -}}
{{- else -}}
{{- $siteTime = dict "enable" true "value" . | merge $siteTime -}}
{{- end -}}
{{- end -}}
{{- .Site.Store.Set "siteTime" $siteTime -}}
+5 -5
View File
@@ -1,11 +1,11 @@
{{- /*
The extended syntax of alert is compatible with Obsidian and FixIt admonition shortcode.
@param {String} .Text the content of the admonition box
@param {String} [.Type] the type of the admonition box
@param {String} [.Title] the title of the admonition box
@param {Boolean} [.Open] whether the admonition box is open, default is true
@param {Boolean} [.Foldable] whether the admonition box is foldable, default is true
@param {String} .Text - The content of the admonition box
@param {String} [.Type] - The type of the admonition box
@param {String} [.Title] - The title of the admonition box
@param {Boolean} [.Open] - Whether the admonition box is open, default is true
@param {Boolean} [.Foldable] - Whether the admonition box is foldable, default is true
For custom admonitions, see https://fixit.lruihao.cn/documentation/content-management/shortcodes/extended/admonition/#customize-admonitions
*/ -}}
+3 -3
View File
@@ -1,8 +1,8 @@
{{- /*
The basic syntax of alert is compatible with GitHub, Obsidian, and Typora.
@param {String} .Type the type of the alert box
@param {String} .Text the content of the alert box
@param {Map} [.Attributes] the attributes of the alert box
@param {String} .Type - The type of the alert box
@param {String} .Text - The content of the alert box
@param {Map} [.Attributes] - The attributes of the alert box
@example {{- dict "Text" .Text "Type" .AlertType "Attributes" .Attributes | partial "plugin/alert.html" -}}
*/ -}}
+1 -1
View File
@@ -3,7 +3,7 @@
- Reads analytics config from Site Store.
- Conditionally renders provider snippets when enabled.
- Supported providers include Google, Fathom, Baidu, Umami, and others.
@param {Object} .Site Hugo site object
@param {Object} .Site - Hugo site object
*/ -}}
{{- $analytics := .Site.Store.Get "analytics" | default dict -}}
@@ -2,14 +2,29 @@
Code block wrapper hook for highlight output.
- Applies wrapper UI features based on codeblock config.
- Supports classic/modern modes, copy button, expand button, and line-number states.
@param {Object} .Attributes code block attributes
@param {Object} .Options code fence options
@param {String} .Inner raw code content
@param {Object} .Page current page context
@param {String} .Type language/type for current block
@param {Object} .Attributes - Code block attributes
@param {Object} .Options - Code fence options
@param {String} .Inner - Raw code content
@param {Object} .Page - Current page context
@param {String} .Type - Language/type for current block
*/ -}}
{{- $config := .Attributes | merge .Page.Params.codeblock | merge .Page.Site.Params.codeblock -}}
{{- $config := .Attributes | merge (dict "Page" .Page "Key" "codeblock" | partial "function/param.html") -}}
{{- /* Deprecated camelCase attribute support: Hugo lowercases Markdown attributes */ -}}
{{- if isset .Attributes "wrapperclass" | and (not (isset .Attributes "wrapper_class")) -}}
{{- warnidf "v1-deprecated-codeblock-attr" "The attribute `wrapperClass` is deprecated since v1.0.0, use `wrapper_class` instead. See %s" .Position -}}
{{- end -}}
{{- if isset .Attributes "maxshownlines" | and (not (isset .Attributes "max_shown_lines")) -}}
{{- warnidf "v1-deprecated-codeblock-attr" "The attribute `maxShownLines` is deprecated since v1.0.0, use `max_shown_lines` instead. See %s" .Position -}}
{{- end -}}
{{- if isset .Attributes "linenostoggler" | and (not (isset .Attributes "line_nos_toggler")) -}}
{{- warnidf "v1-deprecated-codeblock-attr" "The attribute `lineNosToggler` is deprecated since v1.0.0, use `line_nos_toggler` instead. See %s" .Position -}}
{{- end -}}
{{- if isset .Attributes "linewraptoggler" | and (not (isset .Attributes "line_wrap_toggler")) -}}
{{- warnidf "v1-deprecated-codeblock-attr" "The attribute `lineWrapToggler` is deprecated since v1.0.0, use `line_wrap_toggler` instead. See %s" .Position -}}
{{- end -}}
{{- $result := transform.HighlightCodeBlock . -}}
{{- $wrapper := $result.Wrapped -}}
@@ -17,13 +32,13 @@
{{- if $config.wrapper -}}
{{- $mode := $config.mode | default "classic" -}}
{{- $lines := cond .Inner (len (split .Inner "\n")) 0 -}}
{{- $maxShownLines := $config.maxshownlines -}}
{{- $maxShownLines := $config.max_shown_lines | default .Attributes.maxshownlines -}}
{{- $lineNoStart := cond (ne .Options.linenostart nil) .Options.linenostart 1 -}}
{{- $lineNosDigit := strings.RuneCount (sub (add $lines $lineNoStart) 1) -}}
{{- $class := "highlight" -}}
{{- with $config.class -}}{{ $class = add $class " " . }}{{- end -}}
{{- $targetClass := add "code-block " $class -}}
{{- with $config.wrapperclass -}}{{ $targetClass = add $targetClass " " . }}{{- end -}}
{{- with ($config.wrapper_class | default .Attributes.wrapperclass) -}}{{ $targetClass = add $targetClass " " . }}{{- end -}}
{{- /* Add code wrapper around the table or pre */ -}}
{{- $REin := cond (strings.Contains $wrapper `<table class="lntable">`)
@@ -49,7 +64,7 @@
{{- $wrapper = dict "Wrapper" $wrapper "Config" $config | partial "function/code-copy-btn.html" -}}
{{- end -}}
{{- /*
{{- /*
Add data attributes and class
Directly set CSS variables to ensure compatibility with non-Chromium-based browsers
See https://caniuse.com/css3-attr for attr() support status
@@ -1,6 +1,6 @@
{{- /*
Copy button for diagram-like plugins.
@param {String} [.Label] aria label text for copy action
@param {String} [.Label] - Aria label text for copy action
*/ -}}
{{- $label := .Label | default "Copy Diagram code" -}}
+9 -9
View File
@@ -3,15 +3,15 @@
- Skips rendering when MarkupScope is home.
- Supports chart options from inline content, data key, or resource file.
- Supports JavaScript template mode via js/file options.
@param {Object} [.Options] render options from shortcode or code fence attributes
@param {String} [.Options.width] chart container width (default: 100%)
@param {String} [.Options.height] chart container height (default: 30rem)
@param {Boolean} [.Options.js] whether to treat content as JS option builder
@param {Boolean} [.Options.async] whether JS template executes asynchronously
@param {String} [.Options.data] key of data source under data/echarts
@param {String} [.Options.file] local resource path for js/json/yaml/toml source
@param {String} [.Inner] inline chart option content
@param {Object} [.Page] current page context
@param {Object} [.Options] - Render options from shortcode or code fence attributes
@param {String} [.Options.width] - Chart container width (default: 100%)
@param {String} [.Options.height] - Chart container height (default: 30rem)
@param {Boolean} [.Options.js] - Whether to treat content as JS option builder
@param {Boolean} [.Options.async] - Whether JS template executes asynchronously
@param {String} [.Options.data] - Key of data source under data/echarts
@param {String} [.Options.file] - Local resource path for js/json/yaml/toml source
@param {String} [.Inner] - Inline chart option content
@param {Object} [.Page] - Current page context
*/ -}}
{{- if ne hugo.Context.MarkupScope "home" -}}
+16 -16
View File
@@ -1,11 +1,11 @@
{{- /*
Recursive function to render tree from structured data
@param {array} items - Array of tree items
@param {int} level - The expand level of the tree (expand all: -1, collapse all: 0)
@param {int} [depth=0] - Current depth level
@param {bool} [folderSlash=false] - Whether to append a trailing "/" to folder names
@param {array} [ignoreList] - List of file or folder names to ignore
@param {array} [highlightList] - List of file or folder names to highlight
@param {Array} items - Array of tree items
@param {Int} level - The expand level of the tree (expand all: -1, collapse all: 0)
@param {Int} [depth=0] - Current depth level
@param {Boolean} [folder_slash=false] - Whether to append a trailing "/" to folder names
@param {Array} [ignore_list] - List of file or folder names to ignore
@param {Array} [highlight_list] - List of file or folder names to highlight
File tree item structure:
name: string - The name of the file or folder
@@ -16,9 +16,9 @@
{{- $items := .items -}}
{{- $level := .level -}}
{{- $depth := .depth | default 0 -}}
{{- $folderSlash := .folderSlash | default false -}}
{{- $ignoreList := .ignoreList | default slice -}}
{{- $highlightList := .highlightList | default slice -}}
{{- $folderSlash := .folder_slash | default false -}}
{{- $ignoreList := .ignore_list | default slice -}}
{{- $highlightList := .highlight_list | default slice -}}
<ul class="file-tree" data-level="{{ $depth }}">
{{- /* Sort items: directories first, then files */ -}}
@@ -34,7 +34,7 @@
{{- $fileItems = $fileItems | append . -}}
{{- end -}}
{{- end -}}
{{- range (append $fileItems $dirItems) -}}
{{- $isDir := eq .type "dir" -}}
{{- $isCollapsed := $isDir | and (ge $depth $level) | and (ge $level 0) -}}
@@ -43,7 +43,7 @@
{{- if and $isDir $folderSlash -}}
{{- $label = printf "%s/" $label -}}
{{- end -}}
<li class="file-tree-item{{ if $isDir }} file-tree-folder{{ end }}{{ if $isCollapsed }} is-collapsed{{ end }}">
<span class="file-tree-label{{ if $isDir }} file-tree-toggle{{ end }}{{ if $isHighlighted }} is-highlighted{{ end }}">
{{- $icon := "file-tree-icon fa-regular " -}}
@@ -55,15 +55,15 @@
{{- dict "Class" $icon | partial "plugin/icon.html" -}}
<span class="file-tree-label__inner">{{ $label }}</span>
</span>
{{- if and $isDir .children -}}
{{- $options := dict
"items" .children
"depth" (add $depth 1)
"level" $level
"folderSlash" $folderSlash
"ignoreList" $ignoreList
"highlightList" $highlightList
"folder_slash" $folderSlash
"ignore_list" $ignoreList
"highlight_list" $highlightList
-}}
{{- template "render-file-tree" $options -}}
{{- end -}}
@@ -73,7 +73,7 @@
{{- end -}}
{{- if .items -}}
{{- $ignoreList := .ignoreList | default slice -}}
{{- $ignoreList := .ignore_list | default slice -}}
{{- $notEmpty := false -}}
{{- range .items -}}
{{- if not (in $ignoreList .name) -}}
@@ -2,11 +2,11 @@
Encrypted content renderer.
- Encrypts content payload and renders decryptor UI.
- Supports full-page mode and partial mode with isolated target container.
@param {String} .Password encryption password
@param {String} .Content content to encrypt and render
@param {String} [.Message] custom input placeholder message
@param {Boolean} [.IsPartial] whether current render is partial mode
@param {Object} [.Page] current page context (required when IsPartial is true)
@param {String} .Password - Encryption password
@param {String} .Content - Content to encrypt and render
@param {String} [.Message] - Custom input placeholder message
@param {Boolean} [.IsPartial] - Whether current render is partial mode
@param {Object} [.Page] - Current page context (required when IsPartial is true)
*/ -}}
{{- if .Password -}}
+4 -4
View File
@@ -3,10 +3,10 @@
- Renders <i> element when Class is provided.
- Resolves local SVG resources or external SVG URL fallback.
- Supports Simple Icons shorthand by icon name.
@param {String} [.Class] icon class name for <i>
@param {String} [.Src] svg source path or URL
@param {String} [.Simpleicons] simple-icons icon name
@param {String} [.Prefix] custom prefix for simple-icons source path
@param {String} [.Class] - Icon class name for <i>
@param {String} [.Src] - SVG source path or URL
@param {String} [.Simpleicons] - Simple-icons icon name
@param {String} [.Prefix] - Custom prefix for simple-icons source path
*/ -}}
{{- with .Class -}}
+49 -37
View File
@@ -1,35 +1,45 @@
{{- /*
The image plugin is a partial that handles image resources.
{{- /*
Image resource plugin.
Handles page resources, global resources, and remote images.
Supports optimisation, srcset generation, black list filtering, and remote caching.
Parameters:
- Src: The path to the image.
It can be a page resource (inside a page bundle) https://gohugo.io/methods/page/resources/
or a global resource (inside the assets directory) https://gohugo.io/functions/resources/get/
or a link to a remote resource, which can be cached if the site parameter is set https://gohugo.io/functions/resources/getremote/
- Resources: If the image is a page resource, this parameter is required. It is the .Resources of the page.
- OptimConfig: optimisation parameter, defined like
{{- $optim := slice
(dict "Process" "resize 800x Center webp q75" "descriptor" "800w")
(dict "Process" "resize 1200x Center webp q75" "descriptor" "1200w")
(dict "Process" "resize 1600x Center webp q75" "descriptor" "1600w")
-}}
See https://gohugo.io/content-management/image-processing/ for more information.
- Alt: alt text for the image. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#alt
- Height: The intrinsic height of the image, in pixels. Must be an integer without a unit.
We try to generate this value automatically if possible. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#height
- Width: The intrinsic width of the image, in pixels. Must be an integer without a unit.
We try to generate this value automatically if possible. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#width
- Loading: Indicates how the browser should load the image: eager or lazy. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#loading
- Optimise: Override the site parameter to optimise the image.
- CacheRemote: Override the site parameter to cache remote images.
- BlackList: A list of image file names or patterns to exclude from optimisation, default is from site parameter.
- Matches: If the image is a page resource, this parameter can help to find the resource by names. e.g. ["featured-image", "featured-image-preview"].
Pass .Page when the caller needs page-level config override (e.g., content images).
Omit .Page for decorative/site-level images (e.g., logos, avatars, badges).
Thanks @HEIGE-PCloud for the original code in the DoIt theme.
https://github.com/HEIGE-PCloud/DoIt/blob/main/layouts/_partials/plugin/image.html
@param {String} .Src - Image path (page resource, global resource, or remote URL)
@param {Object} [.Resources] - Page resources (.Resources), required for page resources
@param {Array} [.OptimConfig] - srcset processing config, e.g.:
slice (dict "Process" "resize 800x webp" "descriptor" "800w")
See https://gohugo.io/content-management/image-processing/
@param {String} [.Alt] - Alt text
@param {String} [.Title] - Title attribute
@param {String} [.Caption] - Caption for lightgallery
@param {Int} [.Width] - Intrinsic width in pixels
@param {Int} [.Height] - Intrinsic height in pixels
@param {String} [.Loading] - "eager" or "lazy" (default: "lazy")
@param {String} [.Class] - CSS classes
@param {String} [.Sizes] - srcset sizes attribute
@param {Array} [.Matches] - Resource match names, e.g. ["featured-image-preview", "featured-image"]
@param {Boolean} [.Linked] - Wrap in lightgallery link
@param {Object} [.Rel] - rel attribute
@param {String} [.Decoding] - decoding attribute
@param {String} [.Referrerpolicy] - referrerpolicy attribute
@param {Boolean} [.Optimise] - Override site param to enable optimisation
@param {Boolean} [.CacheRemote] - Override site param to enable remote caching
@param {Array} [.BlackList] - Override site param black list
@param {Object} [.Page] - Page context for page-level image config override
@example
{{- dict "Src" "cover.jpg" "Resources" .Resources | partial "plugin/image.html" -}}
{{- dict "Src" "logo.png" "Class" "logo" "Width" 32 "Height" 32 | partial "plugin/image.html" -}}
Thanks @HEIGE-PCloud for the original code in the DoIt theme.
*/ -}}
{{- $config := site.Params.image -}}
{{- $config := partial "function/camel-case-keys.html" site.Params.image -}}
{{- with .Page -}}
{{- $config = dict "Page" . "Key" "image" "ToCamel" true | partial "function/param.html" -}}
{{- end -}}
{{- $Resources := .Resources | default page.Resources -}}
{{- $isInline := strings.HasPrefix .Src "data:image" -}}
{{- $isRemote := urls.Parse .Src | partial "function/is-url-remote.html" -}}
@@ -47,14 +57,6 @@ https://github.com/HEIGE-PCloud/DoIt/blob/main/layouts/_partials/plugin/image.ht
{{- $resource = $resource | default ($Resources.Get .Src) | default (resources.Get .Src) -}}
{{- end -}}
{{- /* Get remote image resource */ -}}
{{- $cacheRemote := .CacheRemote | default $config.cacheRemote | default false -}}
{{- if not $resource | and $cacheRemote -}}
{{- with partial "function/get-remote-image.html" (dict "Src" .Src) -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}
{{- /* Check if the image is blocked from optimisation */ -}}
{{- $blackList := .BlackList | default $config.blackList | default slice -}}
{{- $isBlocked := false -}}
@@ -63,12 +65,22 @@ https://github.com/HEIGE-PCloud/DoIt/blob/main/layouts/_partials/plugin/image.ht
{{- with $blackList -}}
{{- $regex = replace (delimit . "|") "." "\\." -}}
{{- $regex = replace $regex "*" ".*" -}}
{{- $isBlocked = gt (findRE $regex $.Src | len) 0 -}}
{{- end -}}
{{- /* Get remote image resource (skip if blocked by black_list) */ -}}
{{- $cacheRemote := .CacheRemote | default $config.cacheRemote | default false -}}
{{- if not $resource | and $cacheRemote | and (not $isBlocked) -}}
{{- with partial "function/get-remote-image.html" (dict "Src" .Src) -}}
{{- $resource = . -}}
{{- end -}}
{{- end -}}
{{- /* raster graphics */ -}}
{{- $rasterTypes := slice "svg" "avif" -}}
{{- $isRaster := false -}}
{{- if $resource -}}
{{- if $regex -}}
{{- if $regex | and (not $isBlocked) -}}
{{- $isBlocked = gt (findRE $regex $resource.Name | len) 0 -}}
{{- end -}}
{{- if not $isBlocked -}}
+21 -26
View File
@@ -3,20 +3,20 @@
- Auto-detects external links and applies target/rel policies.
- Supports optional icon, download hint, and external icon display.
- Supports card mode with URL meta and favicon fallback.
@param {String} .Destination target URL
@param {String} [.Content] link label HTML
@param {String} [.Title] title attribute
@param {String} [.Class] custom CSS classes
@param {String} [.Rel] rel attribute value
@param {Boolean} [.Newtab] force external behavior
@param {Boolean} [.Noreferrer] whether to include noreferrer (default: true)
@param {Boolean} [.ExternalIcon] whether to show external-link icon
@param {Object} [.Icon] icon params for plugin/icon.html
@param {Boolean} [.Card] whether to render card link layout
@param {String} [.CardIcon] card icon URL or icon class
@param {String} [.Download] download attribute value
@param {Boolean} [.IsGuarded] explicitly enable or disable link guard
@param {Object} [.Page] current page context
@param {String} .Destination - Target URL
@param {String} [.Content] - Link label HTML
@param {String} [.Title] - Title attribute
@param {String} [.Class] - Custom CSS classes
@param {String} [.Rel] - Rel attribute value
@param {Boolean} [.Newtab] - Force external behavior
@param {Boolean} [.Noreferrer] - Whether to include noreferrer (default: true)
@param {Boolean} [.ExternalIcon] - Whether to show external-link icon
@param {Object} [.Icon] - Icon params for plugin/icon.html
@param {Boolean} [.Card] - Whether to render card link layout
@param {String} [.CardIcon] - Card icon URL or icon class
@param {String} [.Download] - Download attribute value
@param {Boolean} [.IsGuarded] - Explicitly enable or disable link guard
@param {Object} [.Page] - Page context for page-level link config override
*/ -}}
{{- /* Regular link rendering */ -}}
@@ -102,7 +102,10 @@
{{- end -}}
{{- $blockSchemes := slice "javascript" "mailto" "tel" "file" "data" "vscode" "trae" -}}
{{- $config := partial "function/snake2camel.html" site.Params.link -}}
{{- $config := partial "function/camel-case-keys.html" site.Params.link -}}
{{- with .Page -}}
{{- $config = dict "Page" . "Key" "link" "ToCamel" true | partial "function/param.html" -}}
{{- end -}}
{{- $rel := .Rel | default "" -}}
{{- $isExternal := false -}}
{{- $noreferrer := true -}}
@@ -126,18 +129,10 @@
{{- /* External link guard */ -}}
{{- $isGuarded := false -}}
{{- $guardConfig := $config.guard -}}
{{- with .Page.Params.link_guard -}}
{{- if reflect.IsMap . -}}
{{- $guardConfig = (partial "function/snake2camel.html" .) | merge $guardConfig -}}
{{- else -}}
{{- $guardConfig = (dict "enable" .) | merge $guardConfig -}}
{{- end -}}
{{- end -}}
{{- if
$guardConfig.enable
$config.guard.enable
| and $isExternal
| and (not (in $guardConfig.allowDomains $url.Host))
| and (not (in $config.guard.allowDomains $url.Host))
-}}
{{- $isGuarded = .IsGuarded | default true -}}
{{- end -}}
@@ -159,7 +154,7 @@
{{- with .Download -}}
{{- $attrs = printf ` download="%s"` . | add $attrs -}}
{{- end -}}
{{- if $isGuarded | and (eq $guardConfig.mode "modal") -}}
{{- if $isGuarded | and (eq $config.guard.mode "modal") -}}
{{- $attrs = add $attrs ` data-guard="modal"` -}}
{{- end -}}
@@ -1,32 +0,0 @@
{{- /*
Mermaid bootstrap script generator.
Returns inline module JS source used by store/script.html.
@param {String} .MermaidModuleURL
@param {String} .MermaidCDN
@param {String} .ZenumlCDN
@param {Array} .LayoutLoaders
@param {Object} .Mermaid
*/ -}}
{{- printf `/** Mermaid bootstrap script generator. */
import { bootstrapMermaid } from %s
const mermaidSource = %s
const zenumlSource = %s
const layoutLoaderSources = %s
const mermaidConfig = %s
void bootstrapMermaid({
mermaidSource,
zenumlSource,
layoutLoaderSources,
config: mermaidConfig,
})
`
(.MermaidModuleURL | jsonify)
(.MermaidCDN | jsonify)
(.ZenumlCDN | jsonify)
(.LayoutLoaders | jsonify)
(.Mermaid | jsonify)
-}}
+7 -6
View File
@@ -3,17 +3,18 @@
- Skips rendering when MarkupScope is home.
- Supports wrapped view with tabs/actions and plain diagram mode.
- Supports per-diagram filename for code/download actions.
@param {Object} [.Options] render options from shortcode or code fence attributes
@param {Boolean} [.Options.wrapper] whether to enable wrapped diagram UI
@param {String} [.Options.filename] filename used by diagram/code actions
@param {String} [.Inner] inline Mermaid source content
@param {Object} [.Page] current page context
@param {Object} [.Options] - Render options from shortcode or code fence attributes
@param {Boolean} [.Options.wrapper] - Whether to enable wrapped diagram UI
@param {String} [.Options.filename] - Filename used by diagram/code actions
@param {String} [.Inner] - Inline Mermaid source content
@param {Object} [.Page] - Current page context
*/ -}}
{{- if ne hugo.Context.MarkupScope "home" -}}
{{- $code := strings.TrimSpace .Inner -}}
{{- $wrapped := .Options.wrapper | default site.Params.mermaid.wrapper -}}
{{- $mermaidConfig := dict "Page" .Page "Key" "mermaid" | partial "function/param.html" -}}
{{- $wrapped := .Options.wrapper | default $mermaidConfig.wrapper -}}
{{- if $wrapped -}}
{{- $labelDiagram := T "tabs.diagram" -}}
@@ -1,11 +1,8 @@
{{- if and .Site.Params.search.enable (eq .Site.Params.search.type "pagefind") .IsPage -}}
{{- $params := partial "function/params.html" -}}
{{- $hidden := cond (eq $params.hiddenFromSearch true) "true" "false" -}}
{{- $encrypted := cond (and (isset $params "password") (ne (printf "%v" $params.password) "")) "true" "false" -}}
{{- $pageDate := (.PublishDate | default .Date) -}}
{{- $dateLabel := $pageDate | dateFormat (.Site.Params.dateFormat | default "2006-01-02") -}}
<meta data-pagefind-filter="hidden:{{ $hidden }}">
<meta data-pagefind-filter="encrypted:{{ $encrypted }}">
{{- $dateLabel := $pageDate | dateFormat (.Site.Params.date_format | default "2006-01-02") -}}
<meta data-pagefind-filter="hidden:{{ string (.Param `hidden_from_search`) }}">
<meta data-pagefind-filter="encrypted:{{ string (.Params.password | not | not) }}">
<meta data-pagefind-sort="date:{{ $pageDate.Unix }}">
<meta data-pagefind-sort="title:{{ .Title }}">
<meta data-pagefind-meta="date:{{ $dateLabel }}">
+3 -24
View File
@@ -5,7 +5,7 @@
Podcast: https://ai.zhheo.com/docs/podcast.html
TODO refactor and migrate to theme component
*/ -}}
{{- $params := .Params | merge .Site.Params -}}
{{- $params := .Params | merge .Site.Params | partial "function/camel-case-keys.html" -}}
{{- $chatConfig := $params.postChat -}}
{{- $summaryConfig := $params.postSummary -}}
{{- $podcastConfig := $params.podcast -}}
@@ -17,7 +17,7 @@
"both" "postChatUser_summary.min.js"
-}}
{{- /* PostSummary only for public posts */ -}}
{{- $password := .Params.password | default .Site.Params.page.password -}}
{{- $password := .Params.password -}}
{{- $isPost := (eq .Kind "page") | and (eq .Type "posts") | and (not $password) -}}
{{- $summaryEnable := cond $isPost $summaryConfig.enable false -}}
{{- $enable := $chatConfig.enable | or $summaryEnable -}}
@@ -81,28 +81,7 @@
{{- $blackDom = $blackDom | append . -}}
{{- end -}}
{{- $upLoadWeb := cond (.IsHome | or $password | or (eq .Kind "404")) false $chatConfig.upLoadWeb -}}
{{- $postChatConfig := dict
"userMode" $chatConfig.userMode
"defaultInput" $chatConfig.defaultInput
"left" $chatConfig.left
"bottom" $chatConfig.bottom
"width" $chatConfig.width
"height" $chatConfig.height
"fill" $chatConfig.fill
"backgroundColor" $chatConfig.backgroundColor
"upLoadWeb" $upLoadWeb
"showInviteLink" $chatConfig.showInviteLink
"userTitle" $chatConfig.userTitle
"userDesc" $chatConfig.userDesc
"addButton" $chatConfig.addButton
"blackDom" $blackDom
"frameWidth" $chatConfig.frameWidth
"frameHeight" $chatConfig.frameHeight
"userIcon" $chatConfig.userIcon
"defaultChatQuestions" $chatConfig.defaultChatQuestions
"defaultSearchQuestions" $chatConfig.defaultSearchQuestions
"hotWords" $chatConfig.hotWords
-}}
{{- $postChatConfig := dict "upLoadWeb" $upLoadWeb "blackDom" $blackDom | merge $chatConfig -}}
{{- $configJS = add $configJS ($postChatConfig | jsonify | printf "var postChatConfig=%s") -}}
{{- end -}}
+3 -3
View File
@@ -2,9 +2,9 @@
Post reward panel renderer.
- Renders reward switch button and reward QR/payment images.
- Supports optional author prefix and animation mode.
@param {Object} .Reward reward config object
@param {String} .Id unique input id for reward toggle
@param {String} [.Author] optional author name for image alt text
@param {Object} .Reward - Reward config object
@param {String} .Id - Unique input id for reward toggle
@param {String} [.Author] - Optional author name for image alt text
*/ -}}
{{- $reward := .Reward -}}
+14 -14
View File
@@ -2,20 +2,20 @@
Script tag renderer.
- Accepts direct script HTML, a pre-built resource, or builds from source path.
- Supports template execution, minify/build/fingerprint pipeline, and extra attrs.
@param {String} [.Source] script source URL/path; if starts with "<script" it's treated as raw HTML
@param {resource.Resource} [.Resource] pre-built resource (skips build pipeline)
@param {String} [.Content] inline content to write as generated resource
@param {String} [.Path] target path for resource created from Content
@param {Object} [.Template] target path for resource created from template execution
@param {Object} [.Context] template context for ExecuteAsTemplate
@param {Boolean} [.Minify] whether to minify resource
@param {Object} [.Build] js.Build options (Build.minify is normalized to .Minify for path semantics)
@param {String} [.Fingerprint] fingerprint algorithm
@param {Boolean} [.Async] whether to add async attribute
@param {Boolean} [.Defer] whether to add defer attribute
@param {Boolean} [.Crossorigin] whether to add crossorigin=anonymous
@param {String} [.Integrity] SRI hash value
@param {String} [.Attr] additional attributes
@param {String} [.Source] - Script source URL/path; if starts with "<script" it's treated as raw HTML
@param {resource.Resource} [.Resource] - Pre-built resource (skips build pipeline)
@param {String} [.Content] - Inline content to write as generated resource
@param {String} [.Path] - Target path for resource created from Content
@param {Object} [.Template] - Target path for resource created from template execution
@param {Object} [.Context] - Template context for ExecuteAsTemplate
@param {Boolean} [.Minify] - Whether to minify resource
@param {Object} [.Build] - js.Build options (Build.minify is normalized to .Minify for path semantics)
@param {String} [.Fingerprint] - Fingerprint algorithm
@param {Boolean} [.Async] - Whether to add async attribute
@param {Boolean} [.Defer] - Whether to add defer attribute
@param {Boolean} [.Crossorigin] - Whether to add crossorigin=anonymous
@param {String} [.Integrity] - SRI hash value
@param {String} [.Attr] - Additional attributes
*/ -}}
{{- if strings.HasPrefix (.Source | default "") "<script" -}}
+8 -7
View File
@@ -2,13 +2,14 @@
Social share buttons renderer.
- Reads share switches from merged theme/page params.
- Outputs provider-specific sharer attributes for supported platforms.
@param {Object} .Page current page context
@param {Object} .Page - Current page context
*/ -}}
{{- $share := (partial "function/params.html").share | default dict -}}
{{- $share := dict "Page" . "Key" "share" | partial "function/param.html" | default dict -}}
{{- if $share.enable -}}
{{- $title := cond (.Param "capitalizeTitles") (title .Title) .Title -}}
{{- $title := cond (.Param "capitalize_titles") (title .Title) .Title -}}
{{- $cover := dict "Page" . "Preview" true "Build" true | partial "function/get-cover.html" -}}
{{- $twitterVia := "" -}}
{{- with .Site.Params.social.twitter -}}
{{- if reflect.IsMap . -}}
@@ -54,7 +55,7 @@
{{- /* 006: Pinterest */ -}}
{{- if $share.Pinterest -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pinterest" data-sharer="pinterest" data-url="{{ .Permalink }}"{{ with .Description }} data-description="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
<a href="javascript:void(0);" title="{{ T `shareOn` }} Pinterest" data-sharer="pinterest" data-url="{{ .Permalink }}"{{ with .Description }} data-description="{{ . }}"{{ end }}{{ with $cover.URL }} data-image="{{ . }}"{{ end }}>
{{- dict "Class" "fa-brands fa-pinterest" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
@@ -82,14 +83,14 @@
{{- /* 010: VK */ -}}
{{- if $share.VK -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} VK" data-sharer="vk" data-url="{{ .Permalink }}" data-title="{{ $title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}>
<a href="javascript:void(0);" title="{{ T `shareOn` }} VK" data-sharer="vk" data-url="{{ .Permalink }}" data-title="{{ $title }}"{{ with .Description }} data-caption="{{ . }}"{{ end }}{{ with $cover.URL }} data-image="{{ . }}"{{ end }}>
{{- dict "Class" "fa-brands fa-vk" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
{{- /* 011: Buffer */ -}}
{{- if $share.Buffer -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} Buffer" data-sharer="buffer" data-url="{{ .Permalink }}" data-title="{{ $title }}"{{ with $twitterVia }} data-via="{{ strings.TrimPrefix `@` . }}"{{ end }}{{ with .Params.featuredImage }} data-picture="{{ . }}"{{ end }}>
<a href="javascript:void(0);" title="{{ T `shareOn` }} Buffer" data-sharer="buffer" data-url="{{ .Permalink }}" data-title="{{ $title }}"{{ with $twitterVia }} data-via="{{ strings.TrimPrefix `@` . }}"{{ end }}{{ with $cover.URL }} data-picture="{{ . }}"{{ end }}>
{{- dict "Class" "fa-brands fa-buffer" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
@@ -131,7 +132,7 @@
{{- /* 017: 微博 */ -}}
{{- if $share.Weibo -}}
<a href="javascript:void(0);" title="{{ T `shareOn` }} 微博" data-sharer="weibo" data-url="{{ .Permalink }}" data-title="{{ $title }}"{{ with .Params.featuredImage }} data-image="{{ . }}"{{ end }}{{ with .Site.Params.Social.Weibo }} data-ralateuid="{{ . }}"{{ end }}>
<a href="javascript:void(0);" title="{{ T `shareOn` }} 微博" data-sharer="weibo" data-url="{{ .Permalink }}" data-title="{{ $title }}"{{ with $cover.URL }} data-image="{{ . }}"{{ end }}{{ with .Site.Params.Social.Weibo }} data-ralateuid="{{ . }}"{{ end }}>
{{- dict "Class" "fa-brands fa-weibo" | partial "plugin/icon.html" -}}
</a>
{{ end -}}
+4 -4
View File
@@ -2,10 +2,10 @@
Social profile link helper.
- Builds destination from explicit Url or from Prefix/Template/Id.
- Delegates final rendering to plugin/link.html with rel=me.
@param {String} [.Url] explicit target URL
@param {String} [.Template] URL template containing one %%v placeholder
@param {String} [.Prefix] URL prefix used to build Template
@param {String} [.Id] account id used by Template
@param {String} [.Url] - Explicit target URL
@param {String} [.Template] - URL template containing one %%v placeholder
@param {String} [.Prefix] - URL prefix used to build Template
@param {String} [.Id] - Account id used by Template
*/ -}}
{{- $destination := "" -}}
+13 -13
View File
@@ -2,19 +2,19 @@
Stylesheet tag renderer.
- Accepts direct <link> HTML, a pre-built resource, or builds from source path.
- Supports template execution, optional toCSS, minify/fingerprint, and preload mode.
@param {String} [.Source] stylesheet URL/path; if starts with "<link" it's treated as raw HTML
@param {resource.Resource} [.Resource] pre-built resource (skips build pipeline)
@param {String} [.Content] inline style content to write as generated resource
@param {String} [.Path] target path for resource created from Content
@param {Object} [.Template] target path for resource created from template execution
@param {Object} [.Context] template context for ExecuteAsTemplate
@param {Object|Boolean} [.ToCSS] true for defaults, dict for custom toCSS options, false/omit to skip toCSS
@param {Boolean} [.Minify] whether to minify resource
@param {String} [.Fingerprint] fingerprint algorithm
@param {Boolean} [.Crossorigin] whether to add crossorigin=anonymous
@param {Boolean} [.Preload] whether to output preload + noscript fallback
@param {String} [.Integrity] SRI hash value
@param {String} [.Attr] additional attributes
@param {String} [.Source] - Stylesheet URL/path; if starts with "<link" it's treated as raw HTML
@param {resource.Resource} [.Resource] - Pre-built resource (skips build pipeline)
@param {String} [.Content] - Inline style content to write as generated resource
@param {String} [.Path] - Target path for resource created from Content
@param {Object} [.Template] - Target path for resource created from template execution
@param {Object} [.Context] - Template context for ExecuteAsTemplate
@param {Object|Boolean} [.ToCSS] - True for defaults, dict for custom toCSS options, false/omit to skip toCSS
@param {Boolean} [.Minify] - Whether to minify resource
@param {String} [.Fingerprint] - Fingerprint algorithm
@param {Boolean} [.Crossorigin] - Whether to add crossorigin=anonymous
@param {Boolean} [.Preload] - Whether to output preload + noscript fallback
@param {String} [.Integrity] - SRI hash value
@param {String} [.Attr] - Additional attributes
*/ -}}
{{- if strings.HasPrefix (.Source | default "") "<link" -}}
+11 -11
View File
@@ -2,17 +2,17 @@
Timeline rendering partial for code fences extended syntax and shortcode usage.
- Supports events from inline content, data key, resource file, or direct Events input.
- Supports reverse order, placement, animation, node style, and size options.
@param {Object} [.Options] render options from shortcode or code fence attributes
@param {Boolean} [.Options.reverse] whether to sort events in descending order
@param {String} [.Options.placement] default timestamp placement
@param {Boolean} [.Options.animation] whether to enable item animation
@param {String} [.Options.size] timeline size variant
@param {String} [.Options.node] timeline node style
@param {String} [.Options.data] key of data source under data/timeline
@param {String} [.Options.file] local resource path for timeline data
@param {String} [.Inner] inline timeline source content
@param {Array} [.Events] direct events array override
@param {Object} [.Page] current page context
@param {Object} [.Options] - Render options from shortcode or code fence attributes
@param {Boolean} [.Options.reverse] - Whether to sort events in descending order
@param {String} [.Options.placement] - Default timestamp placement
@param {Boolean} [.Options.animation] - Whether to enable item animation
@param {String} [.Options.size] - Timeline size variant
@param {String} [.Options.node] - Timeline node style
@param {String} [.Options.data] - Key of data source under data/timeline
@param {String} [.Options.file] - Local resource path for timeline data
@param {String} [.Inner] - Inline timeline source content
@param {Array} [.Events] - Direct events array override
@param {Object} [.Page] - Current page context
*/ -}}
{{- $reverse := .Options.reverse | default false -}}
@@ -4,21 +4,21 @@
"section" "section"
"term" "list"
-}}
{{- $recentlyUpdatedConfig := .Site.Params.recentlyUpdated -}}
{{- $recentlyUpdatedConfig := .Site.Params.recently_updated -}}
{{- $scope := index $kindMap .Kind -}}
{{- $scopeEnable := index $recentlyUpdatedConfig $scope | default false -}}
{{- if $scopeEnable | and (eq $.Paginator.PageNumber 1) -}}
{{- $hasTitle := false }}
{{- $postCount := 0 -}}
{{- $maxPostCount := $recentlyUpdatedConfig.maxCount | default 10 -}}
{{- $maxPostCount := $recentlyUpdatedConfig.max_count | default 10 -}}
{{- $days := $recentlyUpdatedConfig.days | default 30 -}}
{{- $dateformat := (index .Site.Params $scope).dateformat | default "01-02" -}}
{{- $dateformat := (index .Site.Params $scope).date_format | default "01-02" -}}
{{- $scopePages := .Pages -}}
{{- if eq $scope "archives" -}}
{{- $scopePages = .Site.Store.Get "mainSectionPages" -}}
{{- end -}}
{{- $scopePages = where $scopePages.ByLastmod.Reverse "Section" "!=" "" -}}
{{- $hiddenAdapters := .Param "hiddenAdapters" | default false -}}
{{- $hiddenAdapters := .Param "hidden_adapters" | default false -}}
{{- if $hiddenAdapters -}}
{{- $scopePages = where $scopePages "File.IsContentAdapter" "ne" true -}}
{{- end -}}
@@ -40,9 +40,9 @@
{{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}}
{{- end -}}
{{- if eq $scope "archives" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}
{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}
{{- else -}}
{{- cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}}
{{- cond (.Param "capitalize_titles") (title .LinkTitle) .LinkTitle -}}
{{- end -}}
</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Lastmod.Format }}'>
@@ -1,7 +1,5 @@
{{- /* Collection List */ -}}
{{- $params := partial "function/params.html" -}}
{{- if .Params.collections | and $params.collectionList -}}
{{- if .Params.collections | and (.Param "collection_list") -}}
{{- $collectionTerms := .GetTerms "collections" -}}
{{- range $collectionTerms -}}
{{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}}
@@ -19,7 +17,7 @@
<nav>
<ul class="collection-list">
{{- range $key, $page := $pages -}}
{{- $capitalizeTitles := $page.Param "capitalizeTitles" -}}
{{- $capitalizeTitles := $page.Param "capitalize_titles" -}}
{{- $title := $page.Params.shortTitle | default $page.LinkTitle -}}
{{- $title = cond $capitalizeTitles (title $title) $title -}}
<li class="collection-item">
@@ -34,7 +32,7 @@
</ul>
<div class="collection-nav-simple">
{{- with $pages.Next $ -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}}
{{- $capitalizeTitles := .Param "capitalize_titles" -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ cond $capitalizeTitles (title .LinkTitle) .LinkTitle }}">
{{- dict "Class" "fa-solid fa-angle-left" | partial "plugin/icon.html" -}}
</a>
@@ -43,7 +41,7 @@
{{- end -}}
<span class="text-secondary">{{ add $currentKey 1 }}/{{ $pages.Len }}</span>
{{- with $pages.Prev $ -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}}
{{- $capitalizeTitles := .Param "capitalize_titles" -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ cond $capitalizeTitles (title .LinkTitle) .LinkTitle }}">
{{- dict "Class" "fa-solid fa-angle-right" | partial "plugin/icon.html" -}}
</a>
+3 -5
View File
@@ -1,7 +1,5 @@
{{- /* Collection Navigation */ -}}
{{- $params := partial "function/params.html" -}}
{{- if .Params.collections | and $params.collectionNavigation -}}
{{- if .Params.collections | and (.Param "collection_navigation") -}}
{{- $collectionTerms := .GetTerms "collections" -}}
{{- range $collectionTerms -}}
{{- $termLink := printf `<a href="%v">%v <span>%v・%v</span></span></a>`
@@ -18,7 +16,7 @@
{{/* TODO JS 实现 reverse 翻转顺序 */}}
{{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}}
{{- with $pages.Next $ -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}}
{{- $capitalizeTitles := .Param "capitalize_titles" -}}
{{- $title := .Params.shortTitle | default .LinkTitle -}}
{{- $title = cond $capitalizeTitles (title $title) $title -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ $title }}">
@@ -27,7 +25,7 @@
</a>
{{- end -}}
{{- with $pages.Prev $ -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}}
{{- $capitalizeTitles := .Param "capitalize_titles" -}}
{{- $title := .Params.shortTitle | default .LinkTitle -}}
{{- $title = cond $capitalizeTitles (title $title) $title -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ $title }}">
@@ -1,8 +1,6 @@
{{- $params := partial "function/params.html" -}}
{{- $expirationReminder := $params.expirationReminder | default dict -}}
{{- $isEnabled := $expirationReminder.enable | and (not $params.password) -}}
{{- $expirationReminder := dict "Page" . "Key" "expiration_reminder" | partial "function/param.html" | default dict -}}
{{- if $isEnabled -}}
{{- if $expirationReminder.enable | and (not .Params.password) -}}
{{- $daysAgo := div (sub now.Unix .Lastmod.Unix) 86400 }}
{{- $reminderThreshold := $expirationReminder.reminder | default 90 }}
{{- $warningThreshold := $expirationReminder.warning | default 180 }}
@@ -21,7 +19,7 @@
</div>
<div class="details-content">
<div class="admonition-content">
{{- with $updateTime | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}}
{{- with $updateTime | dateFormat (.Site.Params.date_format | default "2006-01-02") -}}
{{- dict "Date" . | T "single.expirationReminder" -}}
{{- end -}}
</div>
+58 -55
View File
@@ -1,27 +1,61 @@
{{- $params := partial "function/params.html" -}}
{{- /* Git info */ -}}
{{- $gitRepo := "" -}}
{{- $blobURL := "" -}}
{{- $sourceURL := "" -}}
{{- $editURL := "" -}}
{{- $reportURL := "" -}}
{{- with .Site.Params.gitInfo -}}
{{- if .Repo -}}
{{- $gitRepo = strings.TrimSuffix "/" .Repo -}}
{{- $blobURL = printf "%v/blob/%v/%v/{path}" $gitRepo .Branch .Dir -}}
{{- $editURL = printf "%v/edit/%v/%v/{path}" $gitRepo .Branch .Dir -}}
{{- $reportURL = printf "%v/issues/new?%v" $gitRepo .IssueTpl -}}
{{- with .Site.Params.git_info -}}
{{- if .repo -}}
{{- $gitRepo = strings.TrimSuffix "/" .repo -}}
{{- $blobURL = printf "%v/blob/%v/%v/{path}" $gitRepo .branch .dir -}}
{{- $editURL = printf "%v/edit/%v/%v/{path}" $gitRepo .branch .dir -}}
{{- $reportURL = printf "%v/issues/new?%v" $gitRepo .issue_tpl -}}
{{- end -}}
{{- end -}}
{{- $linkOptions := slice -}}
{{- $postLink := .Param "post_link" | default dict -}}
{{- if not .Params.password -}}
{{- if $postLink.markdown -}}
{{- with .OutputFormats.Get "markdown" -}}
{{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- end -}}
{{- if $postLink.source | and $gitRepo -}}
{{- $link := replace $blobURL "{path}" $.File.Path -}}
{{- $sourceURL = .Param "source_url" | default (add $link "?plain=1") -}}
{{- $options := dict "Class" "link-to-source" "Destination" $sourceURL "Title" (T "single.viewSource") "Content" (T "single.viewSource") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- if $postLink.edit | and $gitRepo -}}
{{- $link := replace $editURL "{path}" $.File.Path -}}
{{- $editURL = .Param "edit_url" | default $link -}}
{{- $options := dict "Class" "link-to-edit" "Destination" $editURL "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- if $postLink.report | and $gitRepo -}}
{{- $link := replace $reportURL "{title}" ($.Title | urlquery) -}}
{{- $link = replace $link "{URL}" $.Permalink -}}
{{- $link = replace $link "{sourceURL}" $sourceURL -}}
{{- $options := dict "Class" "link-to-report" "Destination" $link "Title" (T "single.reportIssue") "Content" (T "single.reportIssue") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- end -}}
{{- with $postLink.editor -}}
{{- if hugo.IsServer | and (not $.File.IsContentAdapter) -}}
{{- $link := printf "%s://file/%v" . $.File.Filename -}}
{{- $options := dict "Class" "link-to-editor" "Destination" $link "Title" (T "single.openInEditor") "Content" (T "single.openInEditor") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- end -}}
<div class="post-footer" id="post-footer">
<div class="post-info">
<div class="post-info-line">
<div class="post-info-mod">
{{- $updateTitle := dict "Date" ("2006-01-02 15:04:05" | .Lastmod.Format) | T "single.updatedOnDate" -}}
<span title="{{ $updateTitle }}">
{{- with .Lastmod | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}}
{{- with .Lastmod | dateFormat (.Site.Params.date_format | default "2006-01-02") -}}
{{- dict "Date" . | T "single.updatedOnDate" -}}&nbsp;
{{- if $gitRepo -}}
{{- with $.GitInfo -}}
@@ -38,60 +72,29 @@
{{- end -}}
</span>
</div>
{{- if not $params.password -}}
{{- with $params.license | string -}}
{{- if not .Params.password -}}
{{- with (.Param "license") | string -}}
<div class="post-info-license">
<span>{{ . | safeHTML }}</span>
</div>
{{- end -}}
{{- end -}}
</div>
{{- if not $params.password -}}
<div class="post-info-line">
<div class="post-info-md">
{{- $linkOptions := slice -}}
{{- if $params.LinkToMarkdown -}}
{{- with .OutputFormats.Get "markdown" -}}
{{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- end -}}
{{- if $params.LinkToSource | and $gitRepo -}}
{{- $link := replace $blobURL "{path}" $.File.Path -}}
{{- $sourceURL = $params.sourceURL | default (add $link "?plain=1") -}}
{{- $options := dict "Class" "link-to-source" "Destination" $sourceURL "Title" (T "single.viewSource") "Content" (T "single.viewSource") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- if $params.LinkToEdit | and $gitRepo -}}
{{- $link := replace $editURL "{path}" $.File.Path -}}
{{- $editURL = $params.editURL | default $link -}}
{{- $options := dict "Class" "link-to-edit" "Destination" $editURL "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- if $params.LinkToReport | and $gitRepo -}}
{{- $link := replace $reportURL "{title}" ($.Title | urlquery) -}}
{{- $link = replace $link "{URL}" $.Permalink -}}
{{- $link = replace $link "{sourceURL}" $sourceURL -}}
{{- $options := dict "Class" "link-to-report" "Destination" $link "Title" (T "single.reportIssue") "Content" (T "single.reportIssue") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- if $params.LinkToVscode | and hugo.IsServer | and (not $.File.IsContentAdapter) -}}
{{- $link := printf "vscode://file/%v" $.File.Filename -}}
{{- $options := dict "Class" "link-to-vscode" "Destination" $link "Title" (T "single.openInEditor") "Content" (T "single.openInEditor") -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- range $linkOptions -}}
{{- $commonOptions := dict "ExternalIcon" false -}}
<span>{{ partial "plugin/link.html" (. | merge $commonOptions) }}</span>
{{- end -}}
</div>
<div class="post-info-line">
<div class="post-info-md">
{{- range $linkOptions -}}
{{- $commonOptions := dict "ExternalIcon" false -}}
<span>{{ partial "plugin/link.html" (. | merge $commonOptions) }}</span>
{{- end -}}
</div>
{{- if not .Params.password -}}
<div class="post-info-share">
<span>
{{- partial "plugin/share.html" . -}}
</span>
</div>
</div>
{{- end -}}
{{- end -}}
</div>
</div>
<div class="post-info-more">
@@ -118,7 +121,7 @@
{{- $prev := $pages.Prev . -}}
{{- $next := $pages.Next . -}}
{{- /* Show the post navigation in section pages */ -}}
{{- if $navigation.inSection -}}
{{- if $navigation.in_section -}}
{{- $prev = .PrevInSection -}}
{{- $next = .NextInSection -}}
{{- end -}}
@@ -128,14 +131,14 @@
{{- $next = $pages.Prev . -}}
{{- end -}}
{{- with $prev -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}}
{{- $capitalizeTitles := .Param "capitalize_titles" -}}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="prev" title="{{ cond $capitalizeTitles (title .LinkTitle) .LinkTitle }}">
{{- dict "Class" "fa-solid fa-angle-left" | partial "plugin/icon.html" -}}
{{- cond $capitalizeTitles (title .LinkTitle) .LinkTitle -}}
</a>
{{- end -}}
{{ with $next }}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}}
{{- $capitalizeTitles := .Param "capitalize_titles" -}}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="next" title="{{ cond $capitalizeTitles (title .LinkTitle) .LinkTitle }}">
{{- cond $capitalizeTitles (title .LinkTitle) .LinkTitle -}}
{{- dict "Class" "fa-solid fa-angle-right" | partial "plugin/icon.html" -}}
+1 -2
View File
@@ -1,4 +1,3 @@
{{- $params := .Params | merge .Site.Params.page -}}
{{- $author := partial "function/get-author-map.html" .Params.author -}}
{{- .Store.Set "author" $author -}}
{{- $optim := slice
@@ -11,7 +10,7 @@
{{- $content := $author.name | default "Anonymous" -}}
{{- $icon := dict "Class" "fa-solid fa-user-circle" -}}
{{- /* Deprecate $params.authorAvatar in favor of $params.showAvatar and add front matter gravatar {bool} */ -}}
{{- if $author.avatar | and $params.authorAvatar -}}
{{- if $author.avatar | and (.Param "author_avatar") -}}
{{- $content = printf "%v&nbsp;%v" (dict "Src" $author.avatar "Class" "avatar" "Alt" $content "Width" 16 "Height" 16 "OptimConfig" $optim | partial "plugin/image.html") $content -}}
{{- $icon = "" -}}
{{- end -}}
+7 -8
View File
@@ -1,15 +1,14 @@
{{- /* Related Content */ -}}
{{- /* https://gohugo.io/content-management/related/ */ -}}
{{- $params := partial "function/params.html" -}}
{{- if $params.related.enable | and ("aside" | in $params.related.position) | and (not $params.password) -}}
{{- $relatedConfig := dict "Page" . "Key" "related" | partial "function/param.html" -}}
{{- if $relatedConfig.enable | and ("aside" | in $relatedConfig.position) | and (not .Params.password) -}}
{{- $posts := .Site.Store.Get "mainSectionPages" -}}
{{- if .Site.Params.page.hiddenFromRelated -}}
{{- $posts = where $posts "Params.hiddenfromrelated" false -}}
{{- if .Site.Params.hidden_from_related -}}
{{- $posts = where $posts "Params.hidden_from_related" false -}}
{{- else -}}
{{- $posts = where $posts "Params.hiddenfromrelated" "!=" true -}}
{{- $posts = where $posts "Params.hidden_from_related" "!=" true -}}
{{- end -}}
{{- $related := $posts.Related . | first ($params.related.count | default 5) -}}
{{- $related := $posts.Related . | first ($relatedConfig.count | default 5) -}}
{{- with $related -}}
<div class="details related-details open">
<div class="details-summary related-summary">
@@ -20,7 +19,7 @@
<div class="details-content related-content">
<ul class="related-list">
{{- range $i, $p := . -}}
{{- $title := cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}}
{{- $title := cond (.Param "capitalize_titles") (title .LinkTitle) .LinkTitle -}}
<li class="related-item">
<a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</a>
{{- with .HeadingsFiltered -}}
+7 -8
View File
@@ -1,21 +1,20 @@
{{- /* Related Content */ -}}
{{- /* https://gohugo.io/content-management/related/ */ -}}
{{- $params := partial "function/params.html" -}}
{{- if $params.related.enable | and ("footer" | in $params.related.position) | and (not $params.password) -}}
{{- $relatedConfig := dict "Page" . "Key" "related" | partial "function/param.html" -}}
{{- if $relatedConfig.enable | and ("footer" | in $relatedConfig.position) | and (not .Params.password) -}}
{{- $posts := .Site.Store.Get "mainSectionPages" -}}
{{- if .Site.Params.page.hiddenFromRelated -}}
{{- $posts = where $posts "Params.hiddenfromrelated" false -}}
{{- if .Site.Params.hidden_from_related -}}
{{- $posts = where $posts "Params.hidden_from_related" false -}}
{{- else -}}
{{- $posts = where $posts "Params.hiddenfromrelated" "!=" true -}}
{{- $posts = where $posts "Params.hidden_from_related" "!=" true -}}
{{- end -}}
{{- $related := $posts.Related . | first ($params.related.count | default 5) -}}
{{- $related := $posts.Related . | first ($relatedConfig.count | default 5) -}}
{{- with $related -}}
<hr class="awesome-hr" />
<h2 id="see-also">{{ T "single.relatedContent" }}</h2>
<ul>
{{- range $i, $p := . -}}
{{- $title := cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}}
{{- $title := cond (.Param "capitalize_titles") (title .LinkTitle) .LinkTitle -}}
<li>
<a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</a>
{{- with .HeadingsFiltered -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- $reward := .Store.Get "reward" -}}
{{- $reward := dict "Page" . "Key" "reward" | partial "function/param.html" -}}
{{- $author := .Store.Get "author" -}}
{{- $options := dict "Reward" $reward "Id" "fi-reward" "Author" $author.name -}}
{{- partial "plugin/reward.html" $options -}}
+5 -5
View File
@@ -1,11 +1,11 @@
{{- /*
Renders an HTML details element.
@param {string} [class] The value of the element's class attribute.
@param {string} [name] The value of the element's name attribute.
@param {string} [summary] The content of the child summary element.
@param {string} [title] The value of the element's title attribute.
@param {bool} [open=false] Whether to initially display the content of the details element.
@param {String} [class] - The value of the element's class attribute.
@param {String} [name] - The value of the element's name attribute.
@param {String} [summary] - The content of the child summary element.
@param {String} [title] - The value of the element's title attribute.
@param {Boolean} [open=false] - Whether to initially display the content of the details element.
@reference https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
+27 -18
View File
@@ -2,14 +2,14 @@
Renders an interactive file tree structure from inline content, resources, data files, or filesystem
See https://fixit.lruihao.cn/documentation/content-management/shortcodes/extended/file-tree/
@param {string} [path="/"] - The path to scan in filesystem (relative to project root or contentDir)
@param {int} [level=1] - The expand level of the tree (expand all: -1, collapse all: 0)
@param {boolean} [folderSlash=false] - Whether to append a trailing "/" to folder names.
@param {string} [file] - The path of a data file in page resources or assets. (JSON/YAML/TOML)
@param {string} [data] - The name of the data file in data/filetree/ directory. (JSON/YAML/TOML)
@param {string} [ignoreList=""] - List of file or folder names to ignore, separated by commas
@param {string} [highlightList=""] - List of file or folder names to highlight, separated by commas
@param {string} [name] - Project name for the root node, if set to `{path}`, uses the full root path
@param {String} [path="/"] - The path to scan in filesystem (relative to project root or contentDir)
@param {Int} [level=1] - The expand level of the tree (expand all: -1, collapse all: 0)
@param {Boolean} [folder_slash=false] - Whether to append a trailing "/" to folder names.
@param {String} [file] - The path of a data file in page resources or assets. (JSON/YAML/TOML)
@param {String} [data] - The name of the data file in data/filetree/ directory. (JSON/YAML/TOML)
@param {String} [ignore_list=""] - List of file or folder names to ignore, separated by commas
@param {String} [highlight_list=""] - List of file or folder names to highlight, separated by commas
@param {String} [name] - Project name for the root node, if set to `{path}`, uses the full root path
Priority order (highest to lowest):
1. Inline content (shortcode body) - Parse tree data from shortcode body
@@ -17,12 +17,12 @@
3. Data files (data parameter) - Load data file from data/filetree/ directory
4. Actual Filesystem (path parameter) - Scan actual directory structure (default)
Fallback mechanism: If the current mode fails (e.g., file not found, invalid format),
Fallback mechanism: If the current mode fails (e.g., file not found, invalid format),
the shortcode will automatically fall back to the next available mode in the priority order.
@example
{{< file-tree "content" 2 />}}
{{< file-tree path="content" level=2 folderSlash=true />}}
{{< file-tree path="content" level=2 folder_slash=true />}}
{{< file-tree file="data/example.yml" />}}
{{< file-tree data="example" />}}
{{< file-tree >}}
@@ -52,17 +52,26 @@
```
*/ -}}
{{- $config := dict | merge .Page.Params.filetree | merge .Site.Params.filetree -}}
{{- $config := dict "Page" .Page "Key" "filetree" | partial "function/param.html" -}}
{{- $root := cond .IsNamedParams (.Get "path") (.Get 0) | default "/" -}}
{{- $level := cond .IsNamedParams (.Get "level") (.Get 1) -}}
{{- $config = cond ((eq $level 0) | or $level) (dict "level" $level | merge $config) $config -}}
{{- $level = cond (isset $config "level") ($config.level | int) 1 -}}
{{- $folderSlash := cond .IsNamedParams (.Get "folderSlash") (.Get 2) | default $config.folderslash | default false -}}
{{- $folderSlash := cond .IsNamedParams (.Get "folder_slash" | default (.Get "folderSlash")) (.Get 2) | default $config.folder_slash | default false -}}
{{- if .IsNamedParams | and (.Get "folderSlash") -}}
{{- warnidf "v1-deprecated-file-tree-param" "[%s]: The parameter `folderSlash` is deprecated since v1.0.0, use `folder_slash` instead. See %s" .Name .Position -}}
{{- end -}}
{{- $fileName := .Get "file" -}}
{{- $dataName := .Get "data" -}}
{{- $supportExts := slice ".yml" ".yaml" ".json" ".toml" -}}
{{- $ignoreList := union (apply (split (.Get "ignoreList" | default "") ",") "trim" "." " ") $config.ignorelist -}}
{{- $highlightList := apply (split (.Get "highlightList" | default "") ",") "trim" "." " " -}}
{{- $ignoreList := union (apply (split (.Get "ignore_list" | default (.Get "ignoreList") | default "") ",") "trim" "." " ") $config.ignore_list -}}
{{- $highlightList := union (apply (split (.Get "highlight_list" | default (.Get "highlightList") | default "") ",") "trim" "." " ") $config.highlight_list -}}
{{- if .IsNamedParams | and (.Get "ignoreList") -}}
{{- warnidf "v1-deprecated-file-tree-param" "[%s]: The parameter `ignoreList` is deprecated since v1.0.0, use `ignore_list` instead. See %s" .Name .Position -}}
{{- end -}}
{{- if .IsNamedParams | and (.Get "highlightList") -}}
{{- warnidf "v1-deprecated-file-tree-param" "[%s]: The parameter `highlightList` is deprecated since v1.0.0, use `highlight_list` instead. See %s" .Name .Position -}}
{{- end -}}
{{- /* Shortcode body */ -}}
{{- $content := strings.TrimSpace .Inner | default "" -}}
@@ -101,7 +110,7 @@
{{- /* Filesystem mode: build structured tree data from filesystem */ -}}
{{- if not $treeData -}}
{{- $buildOptions := dict "root" $root "ignoreList" $ignoreList "name" (.Get "name") "lang" .Page.Language -}}
{{- $buildOptions := dict "root" $root "ignore_list" $ignoreList "name" (.Get "name") "lang" .Page.Language -}}
{{- with partial "function/get-file-tree.html" $buildOptions -}}
{{- $treeData = . -}}
{{- else -}}
@@ -113,8 +122,8 @@
{{- $options := dict
"items" $treeData
"level" $level
"folderSlash" $folderSlash
"ignoreList" $ignoreList
"highlightList" $highlightList
"folder_slash" $folderSlash
"ignore_list" $ignoreList
"highlight_list" $highlightList
-}}
{{- partial "plugin/file-tree.html" $options -}}
+1 -1
View File
@@ -2,7 +2,7 @@
{{- $options = cond .IsNamedParams (.Get "alt") (.Get 1) | .Page.RenderString | dict "Alt" | merge $options -}}
{{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}}
{{- $options = dict "Caption" $caption | merge $options -}}
{{- $options = dict "Resources" .Page.Resources | merge $options -}}
{{- $options = dict "Page" .Page "Resources" .Page.Resources | merge $options -}}
{{- $optim := slice
(dict "Process" "resize 800x webp q75" "descriptor" "800w")
(dict "Process" "resize 1200x webp q75" "descriptor" "1200w")
+3 -3
View File
@@ -1,14 +1,14 @@
{{- if ne hugo.Context.MarkupScope "home" -}}
{{- $mapbox := (.Page.Params | merge .Site.Params.page).mapbox | default dict -}}
{{- $mapbox := dict "Page" .Page "Key" "mapbox" | partial "function/param.html" | default dict -}}
{{- $lng := cond .IsNamedParams (.Get "lng") (.Get 0) -}}
{{- $lat := cond .IsNamedParams (.Get "lat") (.Get 1) -}}
{{- $zoom := cond .IsNamedParams (.Get "zoom") (.Get 2) | default 10 -}}
{{- $marked := cond .IsNamedParams (.Get "marked") (.Get 3) | ne false -}}
{{- $markers := cond .IsNamedParams (.Get "markers") (.Get 6) | default "[]" -}}
{{- $lightStyle := $mapbox.lightStyle -}}
{{- $darkStyle := $mapbox.darkStyle -}}
{{- $lightStyle := $mapbox.light_style -}}
{{- $darkStyle := $mapbox.dark_style -}}
{{- $navigation := $mapbox.navigation -}}
{{- $geolocate := $mapbox.geolocate -}}
{{- $scale := $mapbox.scale -}}
+3 -3
View File
@@ -2,9 +2,9 @@
Renders a tabbed interface with multiple tabs and their corresponding content.
See https://fixit.lruihao.cn/documentation/content-management/shortcodes/extended/tabs/
@param {int} [defaultTab=0] - The index of the tab to be active by default (0-based)
@param {string} [type="underline"] - The style type of the tabs ("underline", "pill", "card", "segment", etc.)
@param {string} [placement="top"] - The placement of the tabs ("top", "bottom", "left", "right")
@param {Int} [defaultTab=0] - The index of the tab to be active by default (0-based)
@param {String} [type="underline"] - The style type of the tabs ("underline", "pill", "card", "segment", etc.)
@param {String} [placement="top"] - The placement of the tabs ("top", "bottom", "left", "right")
Usage:
{{< tabs defaultTab="1" type="card" placement="top" >}}
+14 -1
View File
@@ -1,4 +1,17 @@
{{- $rvc := (.Page.Params | merge .Page.Site.Params).repoVersion -}}
{{- /*
Version badge shortcode.
Renders an inline SVG version badge linking to the repository release/tag.
@param {String} 0 - The version string (e.g., "v1.0.0")
@param {String} [1="new"] - The type: "new", "changed", "deleted", "deprecated"
@param {String} [2] - Custom URL override (defaults to repo_version.url)
@param {String} [3] - Custom repo name override (defaults to repo_version.name)
@example
{{< version "v1.0.0" >}}
{{< version "v0.4.5" "deprecated" >}}
*/ -}}
{{- $rvc := dict "Page" .Page "Key" "repo_version" | partial "function/param.html" | default dict -}}
{{- $version := .Get 0 -}}
{{- $type := .Get 1 | default "new" | lower -}}
{{- $label := T (printf "version.%v" $type) | default (upper $type) -}}
+4 -4
View File
@@ -3,7 +3,7 @@
<!DOCTYPE html>
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Locale }}">
<head>
{{- if .IsHome | and (ne .Site.Params.disableThemeInject true) }}
{{- if .IsHome | and (ne .Site.Params.disable_theme_inject true) }}
<meta name="theme" content='FixIt {{ hugo.Store.Get "version" }}'>
{{- end }}
<meta charset="utf-8">
@@ -12,12 +12,12 @@
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{- partial "base/head/index.html" . -}}
</head>
<body data-instant-intensity="viewport" data-header-desktop="{{ .Site.Params.header.desktopMode }}" data-header-mobile="{{ .Site.Params.header.mobileMode }}">
<body data-instant-intensity="viewport" data-header-desktop="{{ .Site.Params.header.desktop_mode }}" data-header-mobile="{{ .Site.Params.header.mobile_mode }}">
{{- /* Body wrapper */ -}}
<div class="wrapper" data-page-style="{{ (partial `function/params.html`).pageStyle | default `normal` }}">
<div class="wrapper" data-page-style="{{ .Param `page_style` | default `normal` }}">
{{- partial "base/header.html" . -}}
{{- partial "base/breadcrumb.html" . -}}
{{- $toc := .Store.Get "toc" -}}
{{- $toc := dict "Page" .Page "Key" "toc" | partial "function/param.html" -}}
<main class="fi-container"{{ if (eq $toc.enable true) | and (eq $toc.position `left`) }} data-reverse{{ end }}>
{{- block "content" . }}{{ end -}}
</main>
+11 -10
View File
@@ -1,37 +1,38 @@
{{- /*
[todo] refactor #206
[todo] link_guard usage in data file
[todo] link guard usage in data file
Friends page template.
Usage:
1. Friend link items are loaded from data/friends.yml.
2. External link guard is disabled by default on this page.
3. To enable guard for all friend links on the current page, set `link_guard` to `true` in front matter.
3. To enable guard for all friend links on the current page, set link.guard.enable in front matter.
@example
```md
---
title: friends
layout: friends
link_guard: true
link:
guard:
enable: true
---
```
*/ -}}
{{- define "title" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}
{{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
{{- $params := partial "function/params.html" -}}
{{- $isGuarded := .Params.link_guard | default false -}}
{{- $isGuarded := .Params.link.guard.enable | default false -}}
<article class="page single special friends">
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__pulse animate__faster">{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}</h1>
<h1 class="single-title animate__animated animate__pulse animate__faster">{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}}
{{- with .Params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}}
</div>
{{- /* Friend links */ -}}
@@ -59,7 +60,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" (.Param "ruby") "Fraction" (.Param "fraction") "Fontawesome" (.Param "fontawesome") | partial "function/content.html" | safeHTML -}}
</div>
</article>
{{- end -}}
+3 -3
View File
@@ -1,6 +1,6 @@
{{- define "title" -}}
{{- .Params.Title | default (T "archives") -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
@@ -53,10 +53,10 @@
{{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}}
{{- end -}}
{{- /* Use the original title after archiving the articles */ -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}
{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}
</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- .Date | dateFormat ($.Site.Params.archives.dateFormat | default "01-02") -}}
{{- .Date | dateFormat ($.Site.Params.archives.date_format | default "01-02") -}}
</span>
</article>
{{- end -}}
+6 -7
View File
@@ -1,12 +1,11 @@
{{- define "title" -}}
{{- .Site.Title -}}
{{- if .Site.Params.indexWithSubtitle | and .Site.Params.header.subtitle.name -}}
{{- if .Site.Params.index_with_subtitle | and .Site.Params.header.subtitle.name -}}
{{- printf " - %v" .Site.Params.header.subtitle.name -}}
{{- end -}}
{{- end -}}
{{- define "content" -}}
{{- $params := partial "function/params.html" -}}
{{- $profile := .Site.Params.home.profile -}}
{{- $posts := .Site.Params.home.posts -}}
{{- $pages := slice -}}
@@ -14,10 +13,10 @@
{{- /* Paginate calculation */ -}}
{{- if ne $posts.enable false -}}
{{- $pages = .Site.Store.Get "mainSectionPages" -}}
{{- if .Site.Params.page.hiddenFromHomePage -}}
{{- $pages = where $pages "Params.hiddenfromhomepage" false -}}
{{- if .Site.Params.hidden_from_home_page -}}
{{- $pages = where $pages "Params.hidden_from_home_page" false -}}
{{- else -}}
{{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}}
{{- $pages = where $pages "Params.hidden_from_home_page" "!=" true -}}
{{- end -}}
{{- with $posts.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}}
@@ -28,7 +27,7 @@
<div class="page home{{ if ne $posts.enable false }} posts{{ end }}">
{{- /* Only show profile and content on first page */ -}}
{{- if (not $profile.onlyFirstPage) | or (eq $.Paginator.PageNumber 1) -}}
{{- if (not $profile.only_first_page) | or (eq $.Paginator.PageNumber 1) -}}
{{- /* Profile */ -}}
{{- if ne $profile.enable false -}}
{{- partial "home/profile.html" . -}}
@@ -38,7 +37,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" (.Param "ruby") "Fraction" (.Param "fraction") "Fontawesome" (.Param "fontawesome") | partial "function/content.html" | safeHTML -}}
</div>
</div>
{{- end -}}
+1 -1
View File
@@ -1,6 +1,6 @@
{{- define "title" -}}
{{- T "linkRedirection.title" -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
+1 -1
View File
@@ -1,6 +1,6 @@
{{- define "title" -}}
{{- T "offlineTitle" -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
+10 -11
View File
@@ -1,24 +1,23 @@
{{- if .Site.Params.search.enable -}}
{{- $index := slice -}}
{{- $pages := where .Site.RegularPages "Params.password" "eq" nil -}}
{{- if .Site.Params.page.hiddenFromSearch -}}
{{- $pages = where $pages "Params.hiddenfromsearch" false -}}
{{- if .Param "hidden_from_search" -}}
{{- $pages = where $pages "Params.hidden_from_search" false -}}
{{- else -}}
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
{{- $pages = where $pages "Params.hidden_from_search" "!=" true -}}
{{- end -}}
{{- range $pages -}}
{{- $uri := .RelPermalink -}}
{{- if $.Site.Params.search.absoluteURL -}}
{{- if $.Site.Params.search.absolute_url -}}
{{- $uri = .Permalink -}}
{{- end -}}
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories "collections" .Params.collections -}}
{{- $meta = $.Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format | dict "date" | merge $meta -}}
{{- $meta = $.Site.Params.date_format | default "2006-01-02" | .PublishDate.Format | dict "date" | merge $meta -}}
{{- with .Description -}}
{{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}}
{{- end -}}
{{- $params := .Params | merge $.Site.Params.page -}}
{{/* Extended Markdown syntax */}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{- $content := dict "Content" .Content "Ruby" (.Param "ruby") "Fraction" (.Param "fraction") "Fontawesome" (.Param "fontawesome") | partial "function/content.html" -}}
{{- if ne $.Site.Params.search.anchorify false -}}
{{- /* When anchorify is enabled (default), create separate index entries for each heading */ -}}
{{- $anchor := "" -}}
@@ -61,8 +60,8 @@
{{- end -}}
{{/* Plainify and remove (\n, \t) */}}
{{- $contentj = $contentj | plainify | replaceRE `[\n\t ]+` " " -}}
{{- if gt $.Site.Params.search.contentLength 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}}
{{- if gt $.Site.Params.search.content_length 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.content_length -}}
{{- end -}}
{{- if $contentj | and (ne $contentj " ") -}}
{{- $one := printf "%v:%v:%v" $uri $i $j | dict "content" $contentj "heading" $headingText "uri" (printf "%v#%v" $uri $anchor) "objectID" | merge $meta -}}
@@ -86,8 +85,8 @@
{{- end -}}
{{/* Plainify and remove (\n, \t) */}}
{{- $contentj = $contentj | plainify | replaceRE `[\n\t ]+` " " -}}
{{- if gt $.Site.Params.search.contentLength 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}}
{{- if gt $.Site.Params.search.content_length 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.content_length -}}
{{- end -}}
{{- if $contentj | and (ne $contentj " ") -}}
{{- $one := printf "%v:%v:%v" $uri $i $j | dict "content" $contentj "objectID" | merge $meta -}}
+7 -8
View File
@@ -1,30 +1,29 @@
{{- define "title" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}
{{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
{{- $params := partial "function/params.html" -}}
{{- $pagefindEnabled := and .Site.Params.search.enable (eq .Site.Params.search.type "pagefind") -}}
<article class="page single special">
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__pulse animate__faster"{{ if $pagefindEnabled }} data-pagefind-body{{ end }}>{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}</h1>
<h1 class="single-title animate__animated animate__pulse animate__faster"{{ if $pagefindEnabled }} data-pagefind-body{{ end }}>{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}}
{{- with .Params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}}
</div>
{{- /* Content */ -}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- $content := dict "Content" .Content "Ruby" (.Param "ruby") "Fraction" (.Param "fraction") "Fontawesome" (.Param "fontawesome") | partial "function/content.html" | safeHTML -}}
<div class="content" id="content"{{ if $pagefindEnabled }} data-pagefind-body{{ end }}>
{{- if not $params.password -}}
{{- if not .Params.password -}}
{{- $content -}}
{{- end -}}
</div>
{{- /* Content Encryption */ -}}
{{- dict "Content" $content "Password" $params.password "Message" $params.message "Page" . | partial "plugin/fixit-encryptor.html" -}}
{{- dict "Content" $content "Password" .Params.password "Message" .Params.message "Page" . | partial "plugin/fixit-encryptor.html" -}}
</article>
{{- end -}}
+6 -6
View File
@@ -1,8 +1,7 @@
{{- $params := partial "function/params.html" -}}
{{- $author := .Store.Get "author" | default (partial "function/get-author-map.html" .Params.author) -}}
# {{ cond (.Param "capitalizeTitles") (title .Title) .Title }}
# {{ cond (.Param "capitalize_titles") (title .Title) .Title }}
{{ if $params.password -}}
{{ if .Params.password -}}
_**{{ T "single.encryptedAbstract" }}**_
{{- else -}}
{{ .RawContent | replaceRE "\n?{{% fixit-encryptor .+ %}}((\n|.)*){{% /fixit-encryptor %}}\n?" "" }}
@@ -10,6 +9,7 @@
---
> {{ 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 }}
> {{ T "single.author"}}: {{ with $author.link }}[{{ $author.name }}]({{ . }}){{ else }}{{ $author.name }}{{ end }} {{/* EOL */}}
> URL: {{ .Permalink }} {{/* EOL */}}
{{ $repost := .Param "repost" | default dict -}}
{{ if $repost.enable | and (hasPrefix $repost.url "http") }}> {{ T "single.repost" }} URL: {{ $repost.url }}{{ end }}
+30 -35
View File
@@ -1,16 +1,15 @@
{{- define "title" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}
{{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
{{- $title := cond (.Param "capitalizeTitles") (title .Title) .Title -}}
{{- $params := partial "function/params.html" -}}
{{- $toc := .Store.Get "toc" -}}
{{- $tableOfContents := .Fragments.ToHTML ($toc.startlevel | int) ($toc.endlevel | int) ($toc.ordered | default false) -}}
{{- $title := cond (.Param "capitalize_titles") (title .Title) .Title -}}
{{- $toc := dict "Page" . "Key" "toc" | partial "function/param.html" -}}
{{- $tableOfContents := .Fragments.ToHTML ($toc.start_level | int) ($toc.end_level | int) ($toc.ordered | default false) -}}
{{- $showToc := $toc.enable | and (ne $tableOfContents `<nav id="TableOfContents"></nav>`) -}}
{{- .Store.Set "showToc" $showToc -}}
{{- $tableOfContents = dict "Content" $tableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- $tableOfContents = dict "Content" $tableOfContents "Ruby" (.Param "ruby") "Fraction" (.Param "fraction") "Fontawesome" (.Param "fontawesome") | partial "function/content.html" | safeHTML -}}
{{- $pagefindEnabled := and .Site.Params.search.enable (eq .Site.Params.search.type "pagefind") -}}
<aside class="aside-collection animate__animated animate__fadeIn animate__faster" aria-label="{{ T "collections" }}">
@@ -28,7 +27,7 @@
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__flipInX"{{ if $pagefindEnabled }} data-pagefind-body{{ end }}>
{{- $repost := $params.repost | default dict -}}
{{- $repost := .Params.repost | default dict -}}
{{- with $repost -}}
{{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share" -}}
@@ -44,7 +43,7 @@
</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}}
{{- with .Params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}}
</div>
{{- /* Meta */ -}}
@@ -55,27 +54,27 @@
</div>
{{- /* TODO add disclaimer or space between meta and content */ -}}
<div class="post-meta-line">
{{- with .PublishDate | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}}
{{- with .PublishDate | dateFormat (.Site.Params.date_format | default "2006-01-02") -}}
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | $.PublishDate.Format) | T "single.publishedOnDate" }}">
{{- dict "Class" "fa-solid fa-calendar-days me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
</span>&nbsp;
{{- end -}}
{{- if (ne .Lastmod.Unix .PublishDate.Unix) | and $params.showLastmod -}}
{{- with .Lastmod | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}}
{{- if (ne .Lastmod.Unix .PublishDate.Unix) | and (.Param "show_lastmod") -}}
{{- with .Lastmod | dateFormat (.Site.Params.date_format | default "2006-01-02") -}}
<span title="{{ dict "Date" ("2006-01-02 15:04:05" | $.Lastmod.Format) | T "single.updatedOnDate" }}">
{{- dict "Class" "fa-regular fa-calendar-check me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
</span>&nbsp;
{{- end -}}
{{- end -}}
{{- if $params.wordCount -}}
{{- if .Param "word_count" -}}
<span title="{{ T "single.wordCount" .WordCount }}">
{{- dict "Class" "fa-solid fa-pencil-alt me-1" | partial "plugin/icon.html" -}}
{{- T "single.fuzzyWordCount" .FuzzyWordCount -}}
</span>&nbsp;
{{- end -}}
{{- if $params.readingTime -}}
{{- if .Param "reading_time" -}}
<span>
{{- dict "Class" "fa-regular fa-clock me-1" | partial "plugin/icon.html" -}}
{{- T "single.readingTime" .ReadingTime -}}
@@ -83,11 +82,11 @@
{{- end -}}
{{- /* If the article expires, close the comment or not */ -}}
{{- $expirationReminder := $params.expirationReminder | default dict -}}
{{- $expirationReminder := dict "Page" . "Key" "expiration_reminder" | partial "function/param.html" | default dict -}}
{{- if
$expirationReminder.enable
| and (gt (div (sub now.Unix .Lastmod.Unix) 86400) ($expirationReminder.warning | default 180))
| and $expirationReminder.closeComment -}}
| and $expirationReminder.close_comment -}}
{{- .Store.Set "commentExpired" true -}}
{{- end -}}
{{- $comment := .Store.Get "comment" | default dict -}}
@@ -110,7 +109,7 @@
<span id="{{ .RelPermalink }}" class="comment-visitors" data-flag-title="{{ $title }}">
{{- $visitorIcon }}<span id="twikoo_visitors">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
{{- else if .Site.Params.busuanzi.enable | and .Site.Params.busuanzi.pageViews | and hugo.IsProduction -}}
{{- else if .Site.Params.busuanzi.enable | and .Site.Params.busuanzi.page_views | and hugo.IsProduction -}}
<span id="busuanzi_container_page_pv" class="busuanzi_visitors comment-visitors" data-flag-title="{{ $title }}">
{{- $visitorIcon }}<span id="busuanzi_value_page_pv">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp;
@@ -139,25 +138,21 @@
</div>
{{- /* Featured image */ -}}
{{- $image := $params.featuredimage -}}
{{- $matches := slice -}}
{{- if .Resources.GetMatch "featured-image" -}}
{{- $matches = $matches | append "featured-image" -}}
{{- end -}}
{{- if $image | or (gt (len $matches) 0) -}}
{{- $cover := dict "Page" . | partial "function/get-cover.html" -}}
{{- if $cover.Source | or (gt (len $cover.Matches) 0) -}}
<div class="featured-image">
{{- $optim := slice
{{- $optim := slice
(dict "Process" "resize 800x webp" "descriptor" "800w")
(dict "Process" "resize 1200x webp" "descriptor" "1200w")
(dict "Process" "resize 1600x webp" "descriptor" "1600w")
(dict "Process" "resize 1600x webp" "descriptor" "1600w")
-}}
{{- dict "Src" $image "Title" $.Description "Resources" .Resources "Matches" $matches "Loading" "eager" "Sizes" "(max-width: 679.9px) 100vw, (max-width: 959.9px) 80vw, (max-width: 1439.9px) 56vw, 800px" "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- dict "Src" $cover.Source "Title" $.Description "Resources" $.Resources "Matches" $cover.Matches "Loading" "eager" "Sizes" "(max-width: 679.9px) 100vw, (max-width: 959.9px) 80vw, (max-width: 1439.9px) 56vw, 800px" "OptimConfig" $optim | partial "plugin/image.html" -}}
</div>
{{- end -}}
{{- /* Static TOC */ -}}
{{- if $showToc -}}
<div class="details toc{{ with $params.password }} encrypted-hidden{{ end }}" id="toc-static" data-kept="{{ if $toc.keepstatic }}true{{ else }}false{{ end }}">
<div class="details toc{{ with .Params.password }} encrypted-hidden{{ end }}" id="toc-static" data-kept="{{ if $toc.keep_static }}true{{ else }}false{{ end }}">
<div class="details-summary toc-title">
<span>{{ T "single.contents" }}</span>
<span>{{ dict "Class" "details-icon fa-solid fa-angle-right" | partial "plugin/icon.html" }}</span>
@@ -169,7 +164,7 @@
{{- end -}}
{{- /* AI Summary */ -}}
{{- $summaryConfig := (.Params | merge .Site.Params).postSummary -}}
{{- $summaryConfig := dict "Page" . "Key" "post_summary" | partial "function/param.html" -}}
{{- if $summaryConfig.enable -}}
<div class="ai-summary"></div>
{{- end -}}
@@ -181,9 +176,9 @@
{{- partial "single/expiration-reminder.html" . -}}
{{- /* Content */ -}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
<div class="content" id="content"{{ if $pagefindEnabled }} data-pagefind-body{{ end }}{{ with $params.endFlag }} data-end-flag="{{ . }}"{{ end }}>
{{- if not $params.password -}}
{{- $content := dict "Content" .Content "Ruby" (.Param "ruby") "Fraction" (.Param "fraction") "Fontawesome" (.Param "fontawesome") | partial "function/content.html" | safeHTML -}}
<div class="content" id="content"{{ if $pagefindEnabled }} data-pagefind-body{{ end }}{{ with .Param "end_flag" }} data-end-flag="{{ . }}"{{ end }}>
{{- if not .Params.password -}}
{{- $content -}}
{{- end -}}
</div>
@@ -195,13 +190,13 @@
{{- partial "single/related.html" . -}}
{{- /* Reward before Footer */ -}}
{{- $reward := .Store.Get "reward" -}}
{{- $reward := dict "Page" . "Key" "reward" | partial "function/param.html" -}}
{{- if eq $reward.position "before" -}}
{{- partial "single/reward.html" . -}}
{{- end -}}
{{- /* Content Encryption */ -}}
{{- dict "Content" $content "Password" $params.password "Message" $params.message "Page" . | partial "plugin/fixit-encryptor.html" -}}
{{- dict "Content" $content "Password" .Params.password "Message" .Params.message "Page" . | partial "plugin/fixit-encryptor.html" -}}
{{- /* Collection Navigation */ -}}
{{- partial "single/collection-nav.html" . -}}
@@ -227,11 +222,11 @@
{{- /* Auto TOC */ -}}
{{- if $showToc -}}
<h2 class="toc-title{{ with $params.password }} encrypted-hidden{{ end }}">
<h2 class="toc-title{{ with .Params.password }} encrypted-hidden{{ end }}">
{{- T "single.contents" -}}&nbsp;
{{- dict "Class" "toc-icon fa-solid fa-angle-down" | partial "plugin/icon.html" -}}
</h2>
<div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}{{ with $params.password }} encrypted-hidden{{ end }}" id="toc-content-auto"></div>
<div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}{{ with .Params.password }} encrypted-hidden{{ end }}" id="toc-content-auto"></div>
{{- end -}}
{{- /* Custom block after post toc */ -}}
+5 -6
View File
@@ -1,23 +1,22 @@
{{- define "title" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}
{{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
{{- $params := partial "function/params.html" -}}
{{- $cse := .Site.Params.cse -}}
<article class="page single special search">
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__pulse animate__faster">{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}</h1>
<h1 class="single-title animate__animated animate__pulse animate__faster">{{- cond (.Param "capitalize_titles") (title .Title) .Title -}}</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}}
{{- with .Params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . | $.RenderString }}</p>{{- end -}}
</div>
{{- /* 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" (.Param "ruby") "Fraction" (.Param "fraction") "Fontawesome" (.Param "fontawesome") | partial "function/content.html" | safeHTML -}}
</div>
{{- /* Google CSE */ -}}
+3 -3
View File
@@ -1,6 +1,6 @@
{{- define "title" -}}
{{- title (.Params.Title | default ((T .Section) | default .Section | dict "Some" | T "allSome")) -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
{{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}}
{{- end -}}
{{- define "content" -}}
@@ -53,10 +53,10 @@
{{- if eq $repost.enable true -}}
{{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}}
{{- end -}}
{{- cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}}
{{- cond (.Param "capitalize_titles") (title .LinkTitle) .LinkTitle -}}
</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- .Date | dateFormat ($.Site.Params.section.dateFormat | default "01-02") -}}
{{- .Date | dateFormat ($.Site.Params.section.date_format | default "01-02") -}}
</span>
</article>
{{- end -}}
+2 -2
View File
@@ -1,6 +1,6 @@
{{- $title := title (.Params.Title | default ((T .Section) | default .Section | dict "Some" | T "allSome")) -}}
{{- if .Site.Params.withSiteTitle -}}
{{- $title = printf "%s %s %s" $title .Site.Params.titleDelimiter .Site.Title -}}
{{- if .Site.Params.with_site_title -}}
{{- $title = printf "%s %s %s" $title .Site.Params.title_delimiter .Site.Title -}}
{{- end -}}
{{- $config := (.Params.feed | default dict) | merge .Site.Params.section.feed | merge .Site.Params.feed -}}
{{- $options := dict "Site" .Site "Config" $config "OutputFormats" .OutputFormats -}}
+11 -19
View File
@@ -1,16 +1,8 @@
{{- $params := .Params | merge .Site.Params.page -}}
<article class="single summary" itemscope itemtype="http://schema.org/Article">
{{- /* Featured image */ -}}
{{- if ne .Site.Params.home.posts.imagePreview false -}}
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}}
{{- $matches := slice -}}
{{- if .Resources.GetMatch "featured-image-preview" -}}
{{- $matches = $matches | append "featured-image-preview" -}}
{{- else if .Resources.GetMatch "featured-image" -}}
{{- $matches = $matches | append "featured-image" -}}
{{- end -}}
{{- if $image | or (gt (len $matches) 0) -}}
{{- if ne .Site.Params.home.posts.image_preview false -}}
{{- $cover := dict "Page" . "Preview" true | partial "function/get-cover.html" -}}
{{- if $cover.Source | or (gt (len $cover.Matches) 0) -}}
<div class="featured-image-preview">
<a href="{{ $.RelPermalink }}" aria-label="{{ $.Title }}">
{{- $optim := slice
@@ -18,7 +10,7 @@
(dict "Process" "fill 1200x504 Center webp" "descriptor" "1200w")
(dict "Process" "fill 1600x672 Center webp" "descriptor" "1600w")
-}}
{{- dict "Src" $image "Title" $.Title "Resources" $.Resources "Matches" $matches "Loading" "eager" "Width" "800" "Height" "336" "Sizes" "(max-width: 679.9px) 100vw, (max-width: 959.9px) 80vw, (max-width: 1439.9px) 56vw, 800px" "OptimConfig" $optim "Alt" (printf "Featured image for %v" $.Title) | partial "plugin/image.html" -}}
{{- dict "Src" $cover.Source "Title" $.Title "Resources" $.Resources "Matches" $cover.Matches "Loading" "eager" "Width" "800" "Height" "336" "Sizes" "(max-width: 679.9px) 100vw, (max-width: 959.9px) 80vw, (max-width: 1439.9px) 56vw, 800px" "OptimConfig" $optim "Alt" (printf "Featured image for %v" $.Title) | partial "plugin/image.html" -}}
</a>
</div>
{{- end -}}
@@ -26,11 +18,11 @@
{{- /* Title */ -}}
<h2 class="single-title" itemprop="name headline">
{{- with $params.weight -}}
{{- with .Params.weight -}}
{{- $icon := dict "Class" "fa-solid fa-thumbtack" -}}
<span title="{{ T "single.pin" }}" class="icon-pin">{{- $icon | partial "plugin/icon.html" -}}</span>
<span title="{{ T `single.pin` }}" class="icon-pin">{{- $icon | partial "plugin/icon.html" -}}</span>
{{- end -}}
{{- $repost := $params.repost | default dict -}}
{{- $repost := .Params.repost | default dict -}}
{{- with $repost -}}
{{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share" -}}
@@ -38,14 +30,14 @@
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
{{- end -}}
{{- end -}}
<a href="{{ .RelPermalink }}">{{ cond (.Param "capitalizeTitles") (title .Title) .Title }}</a>
<a href="{{ .RelPermalink }}">{{ cond (.Param "capitalize_titles") (title .Title) .Title }}</a>
</h2>
{{- /* Meta */ -}}
<div class="post-meta">
{{- partial "single/post-author.html" . -}}
{{- with .PublishDate | dateFormat (.Site.Params.dateFormat | default "2006-01-02") -}}
{{- with .PublishDate | dateFormat (.Site.Params.date_format | default "2006-01-02") -}}
&nbsp;<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>
@@ -57,10 +49,10 @@
{{- /* Summary content */ -}}
<div class="content">
{{- if .Summary -}}
{{- $plainify := (.Param "summaryPlainify") | default false -}}
{{- $plainify := .Param "summary_plainify" | default false -}}
{{- with .Markup "home" -}}
{{- with .Render -}}
{{- $summary := dict "Content" .Summary.Text "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
{{- $summary := dict "Content" .Summary.Text "Ruby" ($.Param "ruby") "Fraction" ($.Param "fraction") "Fontawesome" ($.Param "fontawesome") | partial "function/content.html" | safeHTML -}}
{{- cond $plainify ($summary | plainify) $summary -}}
{{- end -}}
{{- end -}}
+2 -2
View File
@@ -1,11 +1,11 @@
{{- /* Tags Page */ -}}
{{- $tagCloud := .Site.Params.tagcloud -}}
{{- $tagCloud := .Site.Params.tag_cloud -}}
<div class="tags{{ with $tagCloud.enable }} tag-cloud-tags{{ end }}">
{{- /* Tags Cloud */ -}}
{{- if $tagCloud.enable -}}
{{- $tags := cond (eq $tagCloud.orderby "name") $.Site.Taxonomies.tags.Alphabetical $.Site.Taxonomies.tags.ByCount -}}
{{- $baseGrade := div ($tagCloud.peakCount | default 10) 10.0 -}}
{{- $baseGrade := div ($tagCloud.peak_count | default 10) 10.0 -}}
{{- $minFont := $tagCloud.min | default 16 -}}
{{- $baseFont := div (sub ($tagCloud.max | default 32) $minFont) 10.0 -}}
{{- range $tags -}}

Some files were not shown because too many files have changed in this diff Show More