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 #### YAML format
{{< file-tree folderSlash=true >}} {{< file-tree folder_slash=true >}}
- name: project-root - name: project-root
type: dir type: dir
children: children:
@@ -99,7 +99,7 @@ type = "file"
TOML with folder slash and level 3: 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 #### JSON format
@@ -107,7 +107,7 @@ TOML with folder slash and level 3:
JSON with folder slash and level 2: 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 #### YAML format
@@ -131,15 +131,15 @@ Trying the file not found case (should fallback to next mode):
#### With folder slash #### With folder slash
{{< file-tree data="example" folderSlash=true />}} {{< file-tree data="example" folder_slash=true />}}
#### With level and folder slash #### 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 #### Collapsed with ignore
{{< file-tree data="example" level=0 ignoreList="README.md" />}} {{< file-tree data="example" level=0 ignore_list="README.md" />}}
## Filesystem Mode ## Filesystem Mode
@@ -165,13 +165,13 @@ Trying the file not found case (should fallback to next mode):
{{< file-tree "assets" 0 />}} {{< 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 />}} {{< file-tree "assets" -1 />}}
### With ignore lists ### 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 ### root not exist
@@ -220,7 +220,7 @@ type = "file"
### With parameters ### 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 - name: project
type: dir type: dir
children: children:
@@ -242,7 +242,7 @@ type = "file"
### Fully expanded ### Fully expanded
```file-tree {level=-1 folderSlash=true} ```file-tree {level=-1 folder_slash=true}
- name: backend - name: backend
type: dir type: dir
children: children:
+6 -5
View File
@@ -7,11 +7,12 @@ categories:
- Markdown - Markdown
tags: tags:
- Link - Link
link_guard: link:
enable: true guard:
# mode: redirect enable: true
allow_domains: # mode: redirect
- demo.fixit.lruihao.cn allow_domains:
- demo.fixit.lruihao.cn
--- ---
This post validates link rendering paths in FixIt, including Markdown render hook and link shortcode modes. This post validates link rendering paths in FixIt, including Markdown render hook and link shortcode modes.
@@ -9,6 +9,8 @@ categories:
tags: tags:
- Mermaid - Mermaid
- Diagrams - 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. 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] [params]
version = "1.0.X" version = "1.0.X"
collection_list = true
collection_navigation = true
[params.home.profile] [params.home.profile]
enable = true enable = true
avatarURL = "/images/fixit-test.png" avatar_url = "/images/fixit-test.png"
[params.social] [params.social]
@@ -60,15 +62,8 @@ weight = 1
# for twitter cards # for twitter cards
# site = "hugo-fixit" # site = "hugo-fixit"
[params.page]
collectionList = true
collectionNavigation = true
[params.author] [params.author]
name = "Lruihao" name = "Lruihao"
email = "" email = ""
link = "https://lruihao.cn" link = "https://lruihao.cn"
avatar = "https://lruihao.cn/images/avatar.jpg" 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 }} date: {{ .Date }}
slug: {{ substr .File.UniqueID 0 7 }} slug: {{ substr .File.UniqueID 0 7 }}
draft: true draft: true
author:
name:
link:
email:
avatar:
description: description:
keywords: keywords:
comment: false
weight: 0 weight: 0
tags:
- draft
categories: categories:
- draft - draft
hiddenFromHomePage: false collections:
hiddenFromSearch: false - draft
hiddenFromRelated: false tags:
hiddenFromFeed: false - draft
summary: summary:
resources: resources:
- name: featured-image - name: featured-image
@@ -33,7 +25,7 @@ repost:
enable: false enable: false
url: 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--> <!--more-->
+7 -15
View File
@@ -4,33 +4,25 @@ subtitle:
date: {{ .Date }} date: {{ .Date }}
slug: {{ substr .File.UniqueID 0 7 }} slug: {{ substr .File.UniqueID 0 7 }}
draft: true draft: true
author:
name:
link:
email:
avatar:
description: description:
keywords: keywords:
comment: false
weight: 0 weight: 0
tags:
- draft
categories: categories:
- draft - draft
hiddenFromHomePage: false collections:
hiddenFromSearch: false - draft
hiddenFromRelated: false tags:
hiddenFromFeed: false - draft
summary: summary:
featuredImagePreview: featured_image:
featuredImage: featured_image_preview:
password: password:
message: message:
repost: repost:
enable: false enable: false
url: 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--> <!--more-->
+21 -16
View File
@@ -43,13 +43,6 @@ interface RenderOptions {
darkMode: boolean darkMode: boolean
} }
interface MermaidBootstrapOptions {
mermaidSource: string
zenumlSource?: string
layoutLoaderSources?: string[]
config: MermaidConfig
}
let mermaid: MermaidRuntimeModule | null = null let mermaid: MermaidRuntimeModule | null = null
let config: MermaidConfig = {} let config: MermaidConfig = {}
let hasBoundGlobalEvents = false let hasBoundGlobalEvents = false
@@ -179,8 +172,12 @@ function isRenderContextActive(el: Element): boolean {
return false return false
const panel = el.closest('.tab-panel') const panel = el.closest('.tab-panel')
if (panel instanceof HTMLElement && panel.hidden) if (panel) {
return false // 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 return true
} }
@@ -231,11 +228,11 @@ function ensureMermaidInitialized(theme: string, darkMode: boolean): void {
startOnLoad: false, startOnLoad: false,
darkMode, darkMode,
theme, theme,
securityLevel: config.securitylevel, securityLevel: config.securityLevel,
look: config.look, look: config.look,
layout: config.layout, layout: config.layout,
fontFamily: config.fontfamily, fontFamily: config.fontFamily,
altFontFamily: config.fontfamily, altFontFamily: config.fontFamily,
}) })
} }
@@ -271,7 +268,7 @@ async function renderMermaidElement(el: Element | null, options: RenderOptions):
try { try {
const result = await mermaid.render(id, source, el) const result = await mermaid.render(id, source, el)
const svg = result?.svg ?? '' const svg = result?.svg ?? ''
el.innerHTML = svg svg && (el.innerHTML = svg)
if (typeof result?.bindFunctions === 'function') { if (typeof result?.bindFunctions === 'function') {
try { try {
result.bindFunctions(el) result.bindFunctions(el)
@@ -681,6 +678,12 @@ function bindTabContainerChanged(): void {
if (!panel) if (!panel)
return return
observeMermaidContainers(panel, true) 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) }, false)
} }
@@ -856,10 +859,12 @@ function unwrapModule<T>(mod: { default?: T } | T): T {
/** /**
* Bootstrap entry used by template-injected script. * Bootstrap entry used by template-injected script.
* Loads Mermaid and optional extensions via dynamic import and hands runtime to initMermaidRuntime. * 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> { export async function bootstrapMermaid(): Promise<void> {
const { mermaidSource, zenumlSource = '', layoutLoaderSources = [], config } = options 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 { try {
// Mermaid core module is required; optional modules degrade gracefully. // Mermaid core module is required; optional modules degrade gracefully.
+3 -3
View File
@@ -3,10 +3,10 @@ export interface MermaidConfig {
cdn?: string cdn?: string
zenuml?: string zenuml?: string
themes?: string[] themes?: string[]
securitylevel?: string securityLevel?: string
look?: string look?: string
fontfamily?: string fontFamily?: string
layoutloaders?: string[] layoutLoaders?: string[]
layout?: 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 │ // │ Name │ min-width │ max-width │ Direction │
// ├──────┼───────────┼───────────┼──────────────┤ // ├──────┼───────────┼───────────┼──────────────┤
+1
View File
@@ -4,6 +4,7 @@ export default antfu({
typescript: true, typescript: true,
ignores: [ ignores: [
'node_modules/**', 'node_modules/**',
'archetypes/**',
'assets/css/unocss.css', 'assets/css/unocss.css',
'assets/lib/**', 'assets/lib/**',
'public/**', '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" -}} {{- define "title" -}}
{{- T "pageNotFound" | printf "404 %v" -}} {{- 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 -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
+24 -14
View File
@@ -1,20 +1,20 @@
{{- /* {{- /*
Render hook for file-tree code blocks Render hook for file-tree code blocks
Alternative to file-tree shortcode's inner content rendering. Alternative to file-tree shortcode's inner content rendering.
Supported attributes: Supported attributes:
- level: The expand level of the tree (expand all: -1, collapse all: 0, default: 1) - 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) - folder_slash: Whether to append a trailing "/" to folder names (default: false)
- ignoreList: List of file or folder names to ignore, separated by commas - ignore_list: List of file or folder names to ignore, separated by commas
- highlightList: List of file or folder names to highlight, 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: Content format: YAML/JSON/TOML with the following item structure:
name: string - The name of the file or folder name: string - The name of the file or folder
type: string - Type of item, either "dir" (directory) or "file" type: string - Type of item, either "dir" (directory) or "file"
children?: array - (Optional) Array of child items, only valid for directories children?: array - (Optional) Array of child items, only valid for directories
Example usage: Example usage:
```file-tree {level=2 folderSlash=true} ```file-tree {level=2 folder_slash=true}
- name: my-project - name: my-project
type: dir type: dir
children: 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 -}} {{- $config := .Attributes | merge $pageConfig -}}
{{- $level := cond (isset $config "level") ($config.level | int) 1 -}} {{- $level := cond (isset $config "level") ($config.level | int) 1 -}}
{{- $folderSlash := $config.folderslash | default false -}} {{- $folderSlash := $config.folder_slash | default .Attributes.folderslash | default false -}}
{{- $ignoreList := union (apply (split (.Attributes.ignorelist | default "") ",") "trim" "." " ") $pageConfig.ignorelist -}} {{- $ignoreList := union (apply (split (.Attributes.ignore_list | default .Attributes.ignorelist | default "") ",") "trim" "." " ") $pageConfig.ignore_list -}}
{{- $highlightList := apply (split (.Attributes.highlightlist | default "") ",") "trim" "." " " -}} {{- $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 "" -}} {{- $content := strings.TrimSpace .Inner | default "" -}}
{{- $treeData := slice -}} {{- $treeData := slice -}}
@@ -44,8 +54,8 @@
{{- $options := dict {{- $options := dict
"items" $treeData "items" $treeData
"level" $level "level" $level
"folderSlash" $folderSlash "folder_slash" $folderSlash
"ignoreList" $ignoreList "ignore_list" $ignoreList
"highlightList" $highlightList "highlight_list" $highlightList
-}} -}}
{{- partial "plugin/file-tree.html" $options -}} {{- 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") -}} {{- 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 -}} {{- $copyable := false -}}
{{- with $jsonViewer.copyable -}} {{- with $jsonViewer.copyable -}}
{{- $copyable = dict "copyText" (T "assets.copyText") "copiedText" (T "assets.copiedText") -}} {{- $copyable = dict "copyText" (T "assets.copyText") "copiedText" (T "assets.copiedText") -}}
+10 -4
View File
@@ -32,11 +32,17 @@
{{- if ne .Attributes.fullscreen nil -}} {{- if ne .Attributes.fullscreen nil -}}
{{- $commonAttrsStr = printf "%s, fullscreen=%v" $commonAttrsStr .Attributes.fullscreen -}} {{- $commonAttrsStr = printf "%s, fullscreen=%v" $commonAttrsStr .Attributes.fullscreen -}}
{{- end -}} {{- end -}}
{{- if ne .Attributes.linenostoggler nil -}} {{- if ne (.Attributes.line_nos_toggler | default .Attributes.linenostoggler) nil -}}
{{- $commonAttrsStr = printf "%s, lineNosToggler=%v" $commonAttrsStr .Attributes.linenostoggler -}} {{- $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 -}} {{- end -}}
{{- if ne .Attributes.linewraptoggler nil -}} {{- if ne (.Attributes.line_wrap_toggler | default .Attributes.linewraptoggler) nil -}}
{{- $commonAttrsStr = printf "%s, lineWrapToggler=%v" $commonAttrsStr .Attributes.linewraptoggler -}} {{- $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 -}} {{- end -}}
{{- if ne .Attributes.editable nil -}} {{- if ne .Attributes.editable nil -}}
{{- $commonAttrsStr = printf "%s, editable=%v" $commonAttrsStr .Attributes.editable -}} {{- $commonAttrsStr = printf "%s, editable=%v" $commonAttrsStr .Attributes.editable -}}
+4 -9
View File
@@ -1,14 +1,9 @@
{{- /* Read the config and format */ -}} {{- /* Read the config and format */ -}}
{{- $params := .Page.Params | merge site.Params.page -}} {{- $toc := dict "Page" .Page "Key" "toc" | partial "function/param.html" -}}
{{- /* Toc data patch */ -}} {{- $headingConfig := dict "Page" .Page "Key" "heading" | partial "function/param.html" -}}
{{- $toc := $params.toc -}}
{{- if not (reflect.IsMap $toc) -}}
{{- $toc = dict "enable" $toc | merge site.Params.page.toc -}}
{{- end -}}
{{- $headingConfig := $params.heading -}}
{{- /* Only enable in main section pages */ -}} {{- /* Only enable in main section pages */ -}}
{{- $intersect := (slice .Page.Section .Page.Type) | intersect site.MainSections -}} {{- $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 -}} {{- $ordered := $toc.ordered | and $headingConfig.number.enable | and $onlyMainSection -}}
{{- $h1Format := $headingConfig.number.format.h1 | default "{title}" -}} {{- $h1Format := $headingConfig.number.format.h1 | default "{title}" -}}
{{- $h2Format := $headingConfig.number.format.h2 | default "{h2} {title}" -}} {{- $h2Format := $headingConfig.number.format.h2 | default "{h2} {title}" -}}
@@ -17,7 +12,7 @@
{{- $h5Format := $headingConfig.number.format.h5 | default "{h2}.{h3}.{h4}.{h5} {title}" -}} {{- $h5Format := $headingConfig.number.format.h5 | default "{h2}.{h3}.{h4}.{h5} {title}" -}}
{{- $h6Format := $headingConfig.number.format.h6 | default "{h2}.{h3}.{h4}.{h5}.{h6} {title}" -}} {{- $h6Format := $headingConfig.number.format.h6 | default "{h2}.{h3}.{h4}.{h5}.{h6} {title}" -}}
{{- $level := .Level -}} {{- $level := .Level -}}
{{- $maxMarkupLevel := cond $toc.decreaseH1 2 1 -}} {{- $maxMarkupLevel := cond $toc.decrease_h1 2 1 -}}
{{- /* Disable ordered headings on home page */ -}} {{- /* Disable ordered headings on home page */ -}}
{{- if eq hugo.Context.MarkupScope "home" -}} {{- 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 .Text .Destination .Title
*/ -}} */ -}}
{{- $params := .Page.Params | merge site.Params.page -}} {{- $optim := slice
{{- $optim := slice
(dict "Process" "resize 800x webp" "descriptor" "800w") (dict "Process" "resize 800x webp" "descriptor" "800w")
(dict "Process" "resize 1200x webp" "descriptor" "1200w") (dict "Process" "resize 1200x webp" "descriptor" "1200w")
(dict "Process" "resize 1600x webp" "descriptor" "1600w") (dict "Process" "resize 1600x webp" "descriptor" "1600w")
-}} -}}
{{- $lightgallery := .Page.Param "lightgallery" -}}
{{- if .Title -}} {{- if .Title -}}
{{- $linked := ne $params.lightgallery false -}} {{- $linked := ne $lightgallery false -}}
<figure> <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"> <figcaption class="image-caption">
{{- .Title | safeHTML -}} {{- .Title | safeHTML -}}
</figcaption> </figcaption>
</figure> </figure>
{{- else -}} {{- else -}}
{{- $linked := (eq $params.lightgallery "force") | or ($params.lightgallery | and (ne .Title "")) -}} {{- $linked := (eq $lightgallery "force") | or ($lightgallery | and (ne .Title "")) -}}
{{- dict "Src" .Destination "Alt" .PlainText "Title" .Title "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}} {{- dict "Page" .Page "Src" .Destination "Alt" .PlainText "Title" .Title "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}}
{{- end -}} {{- end -}}
+2 -14
View File
@@ -1,10 +1,4 @@
{{- $params := .Page.Params | merge site.Params.page -}} {{- $math := dict "Page" .Page "Key" "math" "ToCamel" true | partial "function/param.html" -}}
{{- $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 -}}
{{- /* {{- /*
Mathematical formulas rendering: Mathematical formulas rendering:
@@ -15,13 +9,7 @@
*/ -}} */ -}}
{{- if $math.enable | and (ne hugo.Context.MarkupScope "home") -}} {{- if $math.enable | and (ne hugo.Context.MarkupScope "home") -}}
{{- if eq $math.type "katex" -}} {{- if eq $math.type "katex" -}}
{{- $katex := $math.katex -}} {{- $opts := $math.katex | merge (dict "output" "htmlAndMathml" "displayMode" (eq $.Type "block")) }}
{{- $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 -}}
{{- /* render mathematical markup to HTML */ -}} {{- /* render mathematical markup to HTML */ -}}
{{- with try (transform.ToMath .Inner $opts) }} {{- with try (transform.ToMath .Inner $opts) }}
{{- with .Err }} {{- with .Err }}
+45 -57
View File
@@ -14,7 +14,6 @@
*/ -}} */ -}}
{{- $noop := .WordCount -}} {{- $noop := .WordCount -}}
{{- $params := partial "function/params.html" -}}
{{- $cdn := .Site.Store.Get "cdn" | default dict -}} {{- $cdn := .Site.Store.Get "cdn" | default dict -}}
{{- $fingerprint := .Site.Store.Get "fingerprint" -}} {{- $fingerprint := .Site.Store.Get "fingerprint" -}}
{{- $config := (.Store.Get "this").config -}} {{- $config := (.Store.Get "this").config -}}
@@ -33,36 +32,36 @@
{{- $source := $cdn.autocompleteJS | default "lib/autocomplete-js/index.production.js" -}} {{- $source := $cdn.autocompleteJS | default "lib/autocomplete-js/index.production.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $placeholder := $search.placeholder | default (T "assets.searchPlaceholder") -}} {{- $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" -}} {{- if eq $search.type "algolia" -}}
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/browser.umd.js" -}} {{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/browser.umd.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- 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" -}} {{- else if eq $search.type "fuse" -}}
{{- with .Site.Home.OutputFormats.Get "search" -}} {{- with .Site.Home.OutputFormats.Get "search" -}}
{{- $config = dict "type" "fuse" "fuseIndexURL" .RelPermalink | dict "search" | merge $config -}} {{- $config = dict "type" "fuse" "fuseIndexURL" .RelPermalink | dict "search" | merge $config -}}
{{- end -}} {{- end -}}
{{- dict "Source" "js/lib/fuse.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- 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" -}} {{- else if eq $search.type "pagefind" -}}
{{- $config = dict "type" "pagefind" | dict "search" | merge $config -}} {{- $config = dict "type" "pagefind" | dict "search" | merge $config -}}
{{- $pagefind := $search.pagefind | default dict -}} {{- $pagefind := $search.pagefind | default dict -}}
{{- $bundlePath := relURL ($pagefind.bundlePath | default "pagefind/") -}} {{- $bundlePath := relURL ($pagefind.bundle_path | default "pagefind/") -}}
{{- if not (hasSuffix $bundlePath "/") -}} {{- if not (hasSuffix $bundlePath "/") -}}
{{- $bundlePath = printf "%v/" $bundlePath -}} {{- $bundlePath = printf "%v/" $bundlePath -}}
{{- end -}} {{- end -}}
{{- $config = dict {{- $config = dict
"bundlePath" $bundlePath "bundlePath" $bundlePath
"debounceTimeoutMs" ($pagefind.debounceTimeoutMs | default 300) "debounceTimeoutMs" ($pagefind.debounce_timeout_ms | default 300)
"useBuiltInFilters" ($pagefind.useBuiltInFilters | default true) "useBuiltInFilters" ($pagefind.use_built_in_filters | default true)
"sortBy" ($pagefind.sortBy | default "") "sortBy" ($pagefind.sort_by | default "")
"sortOrder" ($pagefind.sortOrder | default "desc") "sortOrder" ($pagefind.sort_order | default "desc")
| dict "pagefind" | merge $config | dict "pagefind" | merge $config
-}} -}}
{{- else if eq $search.type "cse" -}} {{- else if eq $search.type "cse" -}}
{{- $config = dict "type" "cse" | dict "search" | merge $config -}} {{- $config = dict "type" "cse" | dict "search" | merge $config -}}
{{- $cse := .Site.Params.cse -}} {{- $cse := .Site.Params.cse -}}
{{- $resultsPage := $cse.resultsPage -}} {{- $resultsPage := $cse.results_page -}}
{{- if not (hasPrefix $resultsPage (relURL "")) -}} {{- if not (hasPrefix $resultsPage (relURL "")) -}}
{{- $resultsPage = path.Join (relURL "") $resultsPage -}} {{- $resultsPage = path.Join (relURL "") $resultsPage -}}
{{- end -}} {{- end -}}
@@ -77,7 +76,7 @@
{{- end -}} {{- end -}}
{{- /* instant.page */ -}} {{- /* instant.page */ -}}
{{- if $params.instantPage -}} {{- if .Param "instant_page" -}}
{{- $source := $cdn.instantPage | default "lib/instant-page/instantpage.min.js" -}} {{- $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" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}} {{- 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" -}} {{- dict "Source" "js/lib/json-viewer.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}} {{- 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 */ -}} {{- /* twemoji */ -}}
{{- if $params.twemoji -}} {{- if .Param "twemoji" -}}
{{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}} {{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- $config = dict "twemoji" true | merge $config -}} {{- $config = dict "twemoji" true | merge $config -}}
@@ -98,7 +107,7 @@
{{- end -}} {{- end -}}
{{- /* lightgallery */ -}} {{- /* 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" -}} {{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}} {{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
@@ -119,15 +128,15 @@
{{- /* TypeIt */ -}} {{- /* TypeIt */ -}}
{{- if .Store.Get "hasTyped" -}} {{- 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" -}} {{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- 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" -}} {{- dict "Source" "js/lib/typeit.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}} {{- end -}}
{{- /* KaTeX */ -}} {{- /* KaTeX */ -}}
{{- $math := .Store.Get "math" -}} {{- $math := dict "Page" . "Key" "math" "ToCamel" true | partial "function/param.html" -}}
{{- if .Store.Get "hasKaTeX" | and (not $isArchivesOrOffline) -}} {{- if .Store.Get "hasKaTeX" | and (not $isArchivesOrOffline) -}}
{{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}} {{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} {{- 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" -}} {{- $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" $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" -}} {{- 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" -}} {{- dict "Source" "js/lib/mapbox.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}} {{- end -}}
@@ -244,17 +254,13 @@
{{- end -}} {{- end -}}
{{- /* Watermark */ -}} {{- /* 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" -}} {{- $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" -}} {{- 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 {{- $watermarkConfig = dict
"appendTo" ".widgets" "appendTo" ".widgets"
"content" ($watermarkConfig.content | default $author.name | default .Site.Title) "content" ($watermarkConfig.content | default $author.name | default .Site.Title)
"rowSpacing" $watermarkConfig.rowSpacing
"colSpacing" $watermarkConfig.colSpacing
"fontSize" $watermarkConfig.fontSize
"fontFamily" $watermarkConfig.fontFamily
| merge $watermarkConfig | merge $watermarkConfig
-}} -}}
{{- $config = dict "watermark" $watermarkConfig | merge $config -}} {{- $config = dict "watermark" $watermarkConfig | merge $config -}}
@@ -263,7 +269,7 @@
{{- /* Content Decryption */ -}} {{- /* Content Decryption */ -}}
{{- $encryptPartial := .Store.Get "hasEncryptor" -}} {{- $encryptPartial := .Store.Get "hasEncryptor" -}}
{{- if $params.password | or $encryptPartial -}} {{- if .Params.password | or $encryptPartial -}}
{{- $cryptoCoreJS := $cdn.cryptoCoreJS | default "lib/crypto-js/core.js" -}} {{- $cryptoCoreJS := $cdn.cryptoCoreJS | default "lib/crypto-js/core.js" -}}
{{- $cryptoEncBase64JS := $cdn.cryptoEncBase64JS | default "lib/crypto-js/enc-base64.js" -}} {{- $cryptoEncBase64JS := $cdn.cryptoEncBase64JS | default "lib/crypto-js/enc-base64.js" -}}
{{- $cryptoSha256JS := $cdn.cryptoSha256JS | default "lib/crypto-js/sha256.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" -}} {{- dict "Source" $xxhashWasmJS "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- /* Decryption script */ -}} {{- /* Decryption script */ -}}
{{- dict "Source" "js/lib/fixit-decryptor.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- 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 -}} {{- end -}}
{{- /* Busuanzi visitor counter */ -}} {{- /* Busuanzi visitor counter */ -}}
@@ -284,7 +290,7 @@
{{- end -}} {{- end -}}
{{- /* Site creation time */ -}} {{- /* Site creation time */ -}}
{{- $siteTime := .Site.Store.Get "siteTime" -}} {{- $siteTime := .Site.Params.footer.site_time -}}
{{- if $siteTime.enable -}} {{- if $siteTime.enable -}}
{{- with $siteTime.value -}} {{- with $siteTime.value -}}
{{- $config = dict "siteTime" . | merge $config -}} {{- $config = dict "siteTime" . | merge $config -}}
@@ -307,7 +313,7 @@
{{- /* Auto Bookmark */ -}} {{- /* Auto Bookmark */ -}}
{{- if eq .Kind "page" -}} {{- if eq .Kind "page" -}}
{{- with $params.autoBookmark -}} {{- with .Param "auto_bookmark" -}}
{{- $config = dict "autoBookmark" . | merge $config -}} {{- $config = dict "autoBookmark" . | merge $config -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@@ -333,56 +339,38 @@
{{- end -}} {{- end -}}
{{- /* Print */ -}} {{- /* 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 */ -}} {{- /* PostChat */ -}}
{{- partial "plugin/post-chat-ai.html" . -}} {{- 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" -}} {{- dict "Source" . "Fingerprint" $fingerprint | dict "Page" $ "Data" | partial "store/style.html" -}}
{{- end -}} {{- end -}}
{{- range $params.library.js -}} {{- range $library.js -}}
{{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}} {{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- end -}} {{- end -}}
{{- /* Runtime config script (window.config) */ -}} {{- /* Runtime config script */ -}}
{{- $configJS := $config | jsonify | printf "window.config=%s;" -}} {{- $configJS := dict "Config" $config | partial "gen/config.html" -}}
{{- if hugo.IsServer -}} {{- $configPath := "" -}}
{{- $configJS = add $configJS "console.log('Page config:', window.config);" -}}
{{- end -}}
{{- $targetPath := "" -}}
{{- if $uniqueFileId | and (not .IsHome) -}} {{- if $uniqueFileId | and (not .IsHome) -}}
{{- $targetPath = printf "%s/js/config/%s.js" $languagePrefix $uniqueFileId -}} {{- $configPath = printf "%s/js/config/%s.js" $languagePrefix $uniqueFileId -}}
{{- end -}} {{- 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 */ -}} {{- /* File-tree plugin */ -}}
{{- dict "Source" "js/lib/file-tree.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- 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 "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" -}} {{- $options := dict "format" "esm" -}}
{{- $mermaidModule := dict "Resource" (resources.Get "js/lib/mermaid.ts") "Build" $options "Fingerprint" $fingerprint | partial "function/js-build.html" -}} {{- $mermaidModule := dict "Resource" (resources.Get "js/lib/mermaid.ts") "Build" $options "Fingerprint" $fingerprint | partial "function/js-build.html" -}}
{{- $mermaidModuleURL := $mermaidModule.RelPermalink -}}
{{- $bootstrapJS := dict {{- $bootstrapJS := dict
"MermaidModuleURL" $mermaidModuleURL "MermaidModuleURL" $mermaidModule.RelPermalink
"MermaidCDN" $mermaidCDN | partial "gen/mermaid-bootstrap.html"
"ZenumlCDN" $zenumlCDN
"LayoutLoaders" $layoutLoaders
"Mermaid" $mermaid
| partial "plugin/mermaid-bootstrap.html"
| htmlUnescape | 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" -}} {{- 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 }}"> <nav aria-label="breadcrumb" class="breadcrumb-container{{ if .Site.Params.breadcrumb.sticky }} sticky{{ end }}">
<ol class="breadcrumb"> <ol class="breadcrumb">
{{- range .Ancestors.Reverse -}} {{- range .Ancestors.Reverse -}}
{{- if .IsHome | and (not .Site.Params.breadcrumb.showHome) -}} {{- if .IsHome | and (not .Site.Params.breadcrumb.show_home) -}}
{{- continue -}} {{- continue -}}
{{- end -}} {{- end -}}
{{- $title := "" -}} {{- $title := "" -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}} {{- $capitalizeTitles := .Param "capitalize_titles" -}}
{{- with .Description -}} {{- with .Description -}}
{{- $title = . -}} {{- $title = . -}}
{{- else -}} {{- else -}}
@@ -23,14 +23,14 @@
{{- $innerText = T "single.home" -}} {{- $innerText = T "single.home" -}}
{{- else -}} {{- else -}}
{{- $innerText = .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}} {{- $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 -}} {{- end -}}
<li class="breadcrumb-item" data-separator="{{ $separator }}"><a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $innerText }}</a></li> <li class="breadcrumb-item" data-separator="{{ $separator }}"><a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $innerText }}</a></li>
{{- end -}} {{- end -}}
{{- $currentText := .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}} {{- $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> <li class="breadcrumb-item active" data-separator="{{ $separator }}" aria-current="page">{{ $currentText }}</li>
</ol> </ol>
</nav> </nav>
+1 -2
View File
@@ -386,8 +386,7 @@
{{- block "custom-comment" . }}{{ end -}} {{- block "custom-comment" . }}{{ end -}}
</div> </div>
{{- /* lightgallery for Artalk and Twikoo */ -}} {{- /* lightgallery for Artalk and Twikoo */ -}}
{{- $params := partial "function/params.html" -}} {{- if not (.Param "lightgallery") | and (($artalk.enable | and $artalk.lightgallery) | or ($twikoo.enable | and $twikoo.lightgallery)) -}}
{{- if not $params.lightgallery | and (($artalk.enable | and $artalk.lightgallery) | or ($twikoo.enable | and $twikoo.lightgallery)) -}}
{{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}} {{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
{{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}} {{- $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 }}"> <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 -}} {{- $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") -}} {{- $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 -}} {{- $hugoLogo := printf `<img class="hugo-icon" src="%v" alt="Hugo logo" /> ` (resources.Get "images/hugo.svg" | minify).RelPermalink -}}
{{- $hugo = replace $hugo "{hugoLogo}" $hugoLogo -}} {{- $hugo = replace $hugo "{hugoLogo}" $hugoLogo -}}
{{- end -}} {{- 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 -}} {{- $themeLogo := printf `<img class="fixit-icon" src="%v" alt="FixIt logo" /> ` (resources.Get "images/fixit.svg" | minify).RelPermalink -}}
{{- $theme = replace $theme "{themeLogo}" $themeLogo -}} {{- $theme = replace $theme "{themeLogo}" $themeLogo -}}
{{- end -}} {{- end -}}
@@ -53,7 +53,7 @@
</div> </div>
{{- end -}} {{- end -}}
{{- $siteTime := .Site.Store.Get "siteTime" -}} {{- $siteTime := .Site.Params.footer.site_time -}}
{{- if $siteTime.enable -}} {{- if $siteTime.enable -}}
<div class="footer-line statistics{{ with $footerConfig.order.statistics }} order-{{ . }}{{ end }}"> <div class="footer-line statistics{{ with $footerConfig.order.statistics }} order-{{ . }}{{ end }}">
{{- if $siteTime.enable | and $siteTime.value -}} {{- if $siteTime.enable | and $siteTime.value -}}
+10 -11
View File
@@ -50,7 +50,7 @@
{{- end -}} {{- end -}}
{{- /* Mastodon Verification */ -}} {{- /* Mastodon Verification */ -}}
{{- with .Site.Params.social.Mastodon -}} {{- with .Site.Params.social.mastodon -}}
{{- $id := "" -}} {{- $id := "" -}}
{{- $prefix := "https://mastodon.social/" -}} {{- $prefix := "https://mastodon.social/" -}}
{{- if reflect.IsMap . -}} {{- if reflect.IsMap . -}}
@@ -66,7 +66,7 @@
{{- end -}} {{- end -}}
{{- /* ========== LINK: Favicon, Canonical, Feeds, Stylesheets ========== */ -}} {{- /* ========== 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 -}} {{- if .IsHome -}}
{{- $title = .Site.Title -}} {{- $title = .Site.Title -}}
{{- end -}} {{- end -}}
@@ -123,8 +123,6 @@
<link rel="preload" href="{{ $mainResource.RelPermalink }}" as="script"> <link rel="preload" href="{{ $mainResource.RelPermalink }}" as="script">
{{- /* ========== SEO: Structured Data (Schema.org) ========== */ -}} {{- /* ========== SEO: Structured Data (Schema.org) ========== */ -}}
{{- $params := partial "function/params.html" -}}
{{- /* Search Engine Verification */ -}} {{- /* Search Engine Verification */ -}}
{{- with .Site.Params.verification.google -}} {{- with .Site.Params.verification.google -}}
<meta name="google-site-verification" content="{{ . }}" /> <meta name="google-site-verification" content="{{ . }}" />
@@ -167,7 +165,7 @@
{{- with .Site.Params.description -}} {{- with .Site.Params.description -}}
"description": {{ . | safeHTML }}, "description": {{ . | safeHTML }},
{{- end -}} {{- end -}}
{{- $image := .Site.Params.seo.image -}} {{- $image := .Site.Params.seo.cover -}}
{{- with dict "Path" $image | partial "function/resource.html" -}} {{- with dict "Path" $image | partial "function/resource.html" -}}
"image": { "image": {
"@type": "ImageObject", "@type": "ImageObject",
@@ -180,7 +178,7 @@
"image": "{{ . | absURL }}", "image": "{{ . | absURL }}",
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- with .Site.Params.seo.thumbnailUrl -}} {{- with .Site.Params.seo.thumbnail_url -}}
{{- with dict "Path" . | partial "function/resource.html" -}} {{- with dict "Path" . | partial "function/resource.html" -}}
"thumbnailUrl": "{{ .Permalink }}", "thumbnailUrl": "{{ .Permalink }}",
{{- else -}} {{- else -}}
@@ -204,6 +202,7 @@
{{- $authorName = . -}} {{- $authorName = . -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- $seo := dict "Page" . "Key" "seo" | partial "function/param.html" -}}
<script type="application/ld+json"> <script type="application/ld+json">
{ {
"@context": "http://schema.org", "@context": "http://schema.org",
@@ -214,7 +213,7 @@
"@type": "WebPage", "@type": "WebPage",
"@id": "{{ .Permalink }}" "@id": "{{ .Permalink }}"
}, },
{{- $images := $params.seo.images | default slice -}} {{- $images := $seo.images | default slice -}}
{{- if not $images -}} {{- if not $images -}}
{{- with .Resources.GetMatch "featured-image-preview" -}} {{- with .Resources.GetMatch "featured-image-preview" -}}
{{- $images = slice "featured-image-preview" -}} {{- $images = slice "featured-image-preview" -}}
@@ -223,7 +222,7 @@
{{- $images = slice "featured-image" -}} {{- $images = slice "featured-image" -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- with .Site.Params.seo.image -}} {{- with .Site.Params.seo.cover -}}
{{- $images = $images | default (slice .) -}} {{- $images = $images | default (slice .) -}}
{{- end -}} {{- end -}}
{{- with $images -}} {{- with $images -}}
@@ -263,11 +262,11 @@
"license": {{ . | safeHTML }}, "license": {{ . | safeHTML }},
{{- end -}} {{- end -}}
{{- $publisher := $authorName | dict "name" -}} {{- $publisher := $authorName | dict "name" -}}
{{- $publisher = $params.seo.publisher | default dict | merge $publisher -}} {{- $publisher = $seo.publisher | default dict | merge $publisher -}}
"publisher": { "publisher": {
"@type": "Organization", "@type": "Organization",
"name": {{ $publisher.name | safeHTML }} "name": {{ $publisher.name | safeHTML }}
{{- $logo := $publisher.logoUrl -}} {{- $logo := $publisher.logo_url -}}
{{- with dict "Path" $logo | partial "function/resource.html" -}} {{- with dict "Path" $logo | partial "function/resource.html" -}}
,"logo": { ,"logo": {
"@type": "ImageObject", "@type": "ImageObject",
@@ -296,7 +295,7 @@
{{- /* Theme Color Scheme & Platform Detection (runs before page render) */ -}} {{- /* Theme Color Scheme & Platform Detection (runs before page render) */ -}}
{{- $options := dict "targetPath" "js/head.js" -}} {{- $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" -}} {{- dict "Source" "js/head/index.ts" "Build" $options "Fingerprint" $fingerprint | partial "plugin/script.html" -}}
{{- /* Custom head */ -}} {{- /* Custom head */ -}}
+1 -1
View File
@@ -3,7 +3,7 @@
{{- /* Desktop header */ -}} {{- /* Desktop header */ -}}
<header class="desktop animate__faster{{ if .Site.Params.header.blur }} is-blur{{ end }}" id="header-desktop"> <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"> <div class="header-title">
<a href="{{ $relLangURL }}" title="{{ .Site.Title }}" class="header-title-link"> <a href="{{ $relLangURL }}" title="{{ .Site.Title }}" class="header-title-link">
{{- with .Site.Params.header.title -}} {{- with .Site.Params.header.title -}}
+8 -12
View File
@@ -1,6 +1,5 @@
<div class="widgets"> <div class="widgets">
{{- $backToTop := .Site.Params.backToTop -}} {{- $backToTop := .Site.Params.back_to_top -}}
{{- $params := partial "function/params.html" -}}
{{- $comment := .Store.Get "comment" -}} {{- $comment := .Store.Get "comment" -}}
{{- if $backToTop.enable | or $comment.enable -}} {{- if $backToTop.enable | or $comment.enable -}}
<div class="fixed-buttons"> <div class="fixed-buttons">
@@ -18,7 +17,7 @@
{{- end -}} {{- end -}}
{{- /* toc dialog button */ -}} {{- /* toc dialog button */ -}}
{{- if .Store.Get "showToc" -}} {{- 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" -}} {{- dict "Class" "fa-solid fa-bars" | partial "plugin/icon.html" -}}
</button> </button>
{{- end -}} {{- end -}}
@@ -32,7 +31,7 @@
{{- end -}} {{- end -}}
{{- /* GitHub Corners */ -}} {{- /* GitHub Corners */ -}}
{{- $githubCorner := .Site.Params.githubCorner -}} {{- $githubCorner := .Site.Params.github_corner -}}
{{- if $githubCorner.enable -}} {{- if $githubCorner.enable -}}
{{- with $githubCorner -}} {{- 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>` -}} {{- $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 -}} {{- end -}}
{{- /* Reading progress bar */ -}} {{- /* Reading progress bar */ -}}
{{- $readingProgress := .Site.Params.readingProgress -}} {{- $readingProgress := .Site.Params.reading_progress -}}
{{- if $readingProgress.enable -}} {{- if $readingProgress.enable -}}
{{- with $readingProgress -}} {{- with $readingProgress -}}
{{- $style := printf "%v: 0;%v: 0;" (.Start | default "left") (.Position | default "top") -}} {{- $style := printf "%v: 0;%v: 0;" (.Start | default "left") (.Position | default "top") -}}
@@ -109,10 +108,7 @@
{{- end -}} {{- end -}}
{{- /* Link Guard Dialog */ -}} {{- /* Link Guard Dialog */ -}}
{{- $linkGuard := .Site.Params.link.guard -}} {{- $linkGuard := (dict "Page" . "Key" "link" | partial "function/param.html").guard | default dict -}}
{{- with .Params.link_guard -}}
{{- $linkGuard = (cond (reflect.IsMap .) . (dict "enable" .)) | merge $linkGuard -}}
{{- end -}}
{{- if $linkGuard.enable | and (eq $linkGuard.mode "modal") -}} {{- if $linkGuard.enable | and (eq $linkGuard.mode "modal") -}}
<dialog id="link-guard-dialog" aria-labelledby="link-guard-dialog-title" closedby="any"> <dialog id="link-guard-dialog" aria-labelledby="link-guard-dialog-title" closedby="any">
<div class="guard-content"> <div class="guard-content">
@@ -132,9 +128,6 @@
</dialog> </dialog>
{{- end -}} {{- end -}}
{{- /* Custom widgets */ -}}
{{- block "custom-widgets" . }}{{ end -}}
{{- /* Service Worker Update Notification */ -}} {{- /* Service Worker Update Notification */ -}}
{{- if .Site.Params.app.pwa -}} {{- if .Site.Params.app.pwa -}}
<div class="sw-update-notification"> <div class="sw-update-notification">
@@ -146,6 +139,9 @@
</div> </div>
{{- end -}} {{- end -}}
{{- /* Custom widgets */ -}}
{{- block "custom-widgets" . }}{{ end -}}
<noscript> <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> <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> </noscript>
+15 -15
View File
@@ -1,104 +1,104 @@
{{- define "custom-head" -}} {{- define "custom-head" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.head -}} {{- range .Site.Params.custom_partials.head -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-menu:desktop" -}} {{- define "custom-menu:desktop" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.menuDesktop -}} {{- range .Site.Params.custom_partials.menu_desktop -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-menu:mobile" -}} {{- define "custom-menu:mobile" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.menuMobile -}} {{- range .Site.Params.custom_partials.menu_mobile -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-profile" -}} {{- define "custom-profile" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.profile -}} {{- range .Site.Params.custom_partials.profile -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-aside" -}} {{- define "custom-aside" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.aside -}} {{- range .Site.Params.custom_partials.aside -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-comment" -}} {{- define "custom-comment" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.comment -}} {{- range .Site.Params.custom_partials.comment -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-footer" -}} {{- define "custom-footer" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.footer -}} {{- range .Site.Params.custom_partials.footer -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-widgets" -}} {{- define "custom-widgets" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.widgets -}} {{- range .Site.Params.custom_partials.widgets -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-assets" -}} {{- define "custom-assets" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.assets -}} {{- range .Site.Params.custom_partials.assets -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-post__toc:before" -}} {{- define "custom-post__toc:before" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.postTocBefore -}} {{- range .Site.Params.custom_partials.post_toc_before -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-post__toc:after" -}} {{- define "custom-post__toc:after" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.postTocAfter -}} {{- range .Site.Params.custom_partials.post_toc_after -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-post__content:before" -}} {{- define "custom-post__content:before" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.postContentBefore -}} {{- range .Site.Params.custom_partials.post_content_before -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-post__content:after" -}} {{- define "custom-post__content:after" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.postContentAfter -}} {{- range .Site.Params.custom_partials.post_content_after -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-post__footer:before" -}} {{- define "custom-post__footer:before" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.postFooterBefore -}} {{- range .Site.Params.custom_partials.post_footer_before -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "custom-post__footer:after" -}} {{- define "custom-post__footer:after" -}}
{{- $ctx := . -}} {{- $ctx := . -}}
{{- range .Site.Params.customPartials.postFooterAfter -}} {{- range .Site.Params.custom_partials.post_footer_after -}}
{{- partial . $ctx -}} {{- partial . $ctx -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
+12 -18
View File
@@ -1,8 +1,12 @@
{{- $pages := .Pages -}} {{- $pages := .Pages -}}
{{- /* Front matter: password */ -}} {{- /* Front matter: password */ -}}
{{- $pages = where $pages "Params.password" "eq" nil -}} {{- $pages = where $pages "Params.password" "eq" nil -}}
{{- /* Front matter: hiddenFromFeed */ -}} {{- /* Front matter: hidden_from_feed */ -}}
{{- $pages = where $pages "Params.hiddenFromFeed" "ne" true -}} {{- 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 -}} {{- if ge .Config.limit 1 -}}
{{- $pages = $pages | first .Config.limit -}} {{- $pages = $pages | first .Config.limit -}}
{{- end -}} {{- end -}}
@@ -13,10 +17,10 @@
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<description>{{ .Site.Params.description | default .Site.Title }}</description> <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> <follow_challenge>
<feedId>{{ .Site.Params.feed.follow.feedId }}</feedId> <feedId>{{ .Site.Params.feed.follow.feed_id }}</feedId>
<userId>{{ .Site.Params.feed.follow.userId }}</userId> <userId>{{ .Site.Params.feed.follow.user_id }}</userId>
</follow_challenge> </follow_challenge>
{{- end }} {{- end }}
<generator>Hugo {{ hugo.Version }} &amp; FixIt {{ hugo.Store.Get "version" }}</generator> <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 }} {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }} {{- end }}
{{- range $page := $pages }} {{- range $page := $pages }}
{{- $params := .Params | merge .Site.Params.Page }} {{- $fullText := ((.Params.feed | default dict) | merge $.Config ).full_text }}
{{- $fullText := ((.Params.feed | default dict) | merge $.Config ).fulltext }}
{{- $author := partial "function/get-author-map.html" .Params.author }} {{- $author := partial "function/get-author-map.html" .Params.author }}
{{- $image := $params.featuredimagepreview | default $params.featuredimage }} {{- $cover := dict "Page" . "Preview" true "Build" true | partial "function/get-cover.html" -}}
{{- 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 }}
<item> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
@@ -55,7 +49,7 @@
{{- end }} {{- end }}
{{- if $fullText }} {{- if $fullText }}
<description> <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> </description>
{{- else }} {{- else }}
<description>{{ (.Summary | default .Description | default .Title) | transform.XMLEscape | safeHTML }}</description> <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. 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. 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 @param {Map|Slice} . - The input with snake_case keys
@return {map} A new map with camelCase keys, or the input if it's not a map @return {Map|Slice} A new value with camelCase keys
@example @example
// Simple Map conversion // Simple Map conversion
@@ -24,9 +24,7 @@
@example @example
// Practical usage in templates // Practical usage in templates
{{- $siteParams := partial "function/snake2camel.html" .Site.Params }} {{- $siteParams := partial "function/camel-case-keys.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)
*/ -}} */ -}}
{{- $input := . -}} {{- $input := . -}}
{{- $output := dict -}} {{- $output := dict -}}
@@ -34,23 +32,8 @@
{{- if reflect.IsMap $input -}} {{- if reflect.IsMap $input -}}
{{- /* Process map: iterate through all key-value pairs */ -}} {{- /* Process map: iterate through all key-value pairs */ -}}
{{- range $key, $value := $input -}} {{- range $key, $value := $input -}}
{{- /* {{- $newKey := partial "function/camel-case.html" $key -}}
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 -}}
{{- /*
Recursively process value based on its type Recursively process value based on its type
- For nested maps: recursively convert all nested keys - For nested maps: recursively convert all nested keys
- For arrays: process each map element in the array - For arrays: process each map element in the array
@@ -58,18 +41,18 @@
*/ -}} */ -}}
{{- $newValue := $value -}} {{- $newValue := $value -}}
{{- if reflect.IsMap $value -}} {{- if reflect.IsMap $value -}}
{{- $newValue = partial "function/snake2camel.html" $value -}} {{- $newValue = partial "function/camel-case-keys.html" $value -}}
{{- else if reflect.IsSlice $value -}} {{- else if reflect.IsSlice $value -}}
{{- $newValue = slice -}} {{- $newValue = slice -}}
{{- range $item := $value -}} {{- range $item := $value -}}
{{- if reflect.IsMap $item -}} {{- if reflect.IsMap $item -}}
{{- $newValue = $newValue | append (partial "function/snake2camel.html" $item) -}} {{- $newValue = $newValue | append (partial "function/camel-case-keys.html" $item) -}}
{{- else -}} {{- else -}}
{{- $newValue = $newValue | append $item -}} {{- $newValue = $newValue | append $item -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- /* Add the converted key-value pair to output */ -}} {{- /* Add the converted key-value pair to output */ -}}
{{- $output = merge $output (dict $newKey $newValue) -}} {{- $output = merge $output (dict $newKey $newValue) -}}
{{- end -}} {{- end -}}
@@ -79,13 +62,12 @@
{{- $output := slice -}} {{- $output := slice -}}
{{- range $item := $input -}} {{- range $item := $input -}}
{{- if reflect.IsMap $item -}} {{- if reflect.IsMap $item -}}
{{- $output = $output | append (partial "function/snake2camel.html" $item) -}} {{- $output = $output | append (partial "function/camel-case-keys.html" $item) -}}
{{- else -}} {{- else -}}
{{- $output = $output | append $item -}} {{- $output = $output | append $item -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- return $output -}} {{- return $output -}}
{{- else -}} {{- else -}}
{{- /* Return scalar values unchanged */ -}}
{{- return $input -}} {{- return $input -}}
{{- end -}} {{- 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 -}} {{- if $config.title -}}
{{- $titleEl = printf `<span class="code-title">%s<span class="title-inner">%s</span></span>` $foldIcon $config.title -}} {{- $titleEl = printf `<span class="code-title">%s<span class="title-inner">%s</span></span>` $foldIcon $config.title -}}
{{- end -}} {{- end -}}
{{- if $config.linenostoggler -}} {{- if $config.line_nos_toggler -}}
{{- $lineNosIcon := dict "Class" "fa-solid fa-list-ol" | partial "plugin/icon.html" -}} {{- $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 -}} {{- $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 -}} {{- end -}}
{{- if $config.linewraptoggler -}} {{- if $config.line_wrap_toggler -}}
{{- $lineWrapIcon := dict "Class" "fa-solid fa-right-left" | partial "plugin/icon.html" -}} {{- $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 -}} {{- $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 -}} {{- end -}}
@@ -1,6 +1,6 @@
{{- /* {{- /*
Get author in map format. Get author in map format.
@param {String|Map} . the author name or map @param {String|Map} . - The author name or map
@returns {Map} @returns {Map}
@example {{- $author := partial "function/get-author-map.html" .Params.author -}} @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. 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} root - The root path to scan (relative to project root or contentDir)
@param {string} [path] - The directory path for recursive calls @param {String} [path] - The directory path for recursive calls
@param {int} [level=10] - Descend only level directories deep @param {Int} [level=10] - Descend only level directories deep
@param {int} [deep=0] - Current depth level for recursive calls @param {Int} [deep=0] - Current depth level for recursive calls
@param {array} [ignoreList] - List of file or folder names to ignore @param {Array} [ignore_list] - List of file or folder names to ignore
@param {boolean} [isRecursive=false] - Internal flag for recursive calls @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} [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 {String} [lang] - Page language for multilingual sites
@param {boolean} [log=false] - Whether to log warnings @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 @return {Array} Array of tree items with structure: {name, type, children?}, or empty array if root doesn't exist
*/ -}} */ -}}
{{- $result := slice -}} {{- $result := slice -}}
{{- $level := .level | default 10 -}} {{- $level := .level | default 10 -}}
{{- $deep := .deep | default 0 -}} {{- $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 := 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 -}} {{- $_debug := eq hugo.Environment "debug" | and hugo.IsServer -}}
{{- if $isRecursive -}} {{- if $isRecursive -}}
@@ -41,7 +41,7 @@
{{- $item := dict "name" .Name "type" (cond .IsDir "dir" "file") -}} {{- $item := dict "name" .Name "type" (cond .IsDir "dir" "file") -}}
{{- if .IsDir -}} {{- if .IsDir -}}
{{- $fullPath := path.Clean (path.Join $path .Name) -}} {{- $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 -}} {{- $children := partial "function/get-file-tree.html" $childOptions -}}
{{- $item = merge $item (dict "children" $children) -}} {{- $item = merge $item (dict "children" $children) -}}
{{- end -}} {{- end -}}
@@ -85,7 +85,7 @@
{{- /* Build children recursively */ -}} {{- /* Build children recursively */ -}}
{{- if $_debug -}}{{- warnf "[file-tree]> %v:" $rootLabel -}}{{- end -}} {{- 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 -}} {{- $children := partial "function/get-file-tree.html" $childOptions -}}
{{- /* Return root item with children */ -}} {{- /* Return root item with children */ -}}
+3 -3
View File
@@ -1,8 +1,8 @@
{{- /* {{- /*
Get Gravatar URL. Get Gravatar URL.
@param {String} Email the email address @param {String} Email - The email address
@param {String} Size the size in pixels (optional, default: 200) @param {String} Size - The size in pixels (optional, default: 200)
@returns {String} the Gravatar URL @returns {String} The Gravatar URL
@example {{- $gravatar := dict "Email" "user@example.com" "Size" "32" | partial "function/get-gravatar.html" -}} @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. Resolve taxonomy icon by slot with site-level overrides.
@param {String} .Taxonomy taxonomy singular key, e.g. "tag", "category" @param {String} .Taxonomy - Taxonomy singular key, e.g. "tag", "category"
@param {String} .Slot icon slot: "title", "card", "term" @param {String} .Slot - Icon slot: "title", "card", "term"
@return {String} icon class @return {String} Icon class
*/ -}} */ -}}
{{- $taxonomy := .Taxonomy | default "category" -}} {{- $taxonomy := .Taxonomy | default "category" -}}
{{- $slot := .Slot | default "title" -}} {{- $slot := .Slot | default "title" -}}
+4 -4
View File
@@ -1,9 +1,9 @@
{{- /* {{- /*
Build and minify a JS resource with unified behavior. Build and minify a JS resource with unified behavior.
@param {resource.Resource} .Resource Hugo resource to process @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 {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 {Boolean} [.Minify] - Extra minify flag; final minify is Minify OR Build.minify
@param {String} [.Fingerprint] fingerprint algorithm (e.g. "sha256") @param {String} [.Fingerprint] - Fingerprint algorithm (e.g. "sha256")
@return {resource.Resource} @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" "\\?" "fa-regular fa-circle-question"
-}} -}}
{{- /* Custom Task lists */ -}} {{- /* Custom Task lists */ -}}
{{- $iconMap = site.Params.taskList | merge $iconMap -}} {{- $iconMap = site.Params.task_list | merge $iconMap -}}
{{- /* Get the extended signs */ -}} {{- /* Get the extended signs */ -}}
{{- $extendedSigns := slice -}} {{- $extendedSigns := slice -}}
+4 -4
View File
@@ -1,9 +1,9 @@
{{- /* {{- /*
Compile SCSS to CSS via dartsass, optionally minify and fingerprint. Compile SCSS to CSS via dartsass, optionally minify and fingerprint.
@param {resource.Resource} .Resource SCSS resource @param {resource.Resource} .Resource - SCSS resource
@param {Object|Boolean} [.ToCSS] true for defaults, dict for custom toCSS options, false/omit to skip @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 {Boolean} [.Minify] - Whether to minify; defaults to hugo.IsProduction when ToCSS is used
@param {String} [.Fingerprint] fingerprint algorithm (e.g. "sha256") @param {String} [.Fingerprint] - Fingerprint algorithm (e.g. "sha256")
@return {resource.Resource} @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 -}} {{- $author := partial "function/get-author-map.html" .Params.author -}}
<div class="home-profile"> <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 -}} {{- if $avatar -}}
<div class="home-avatar"> <div class="home-avatar">
{{- $menus := $.Site.Menus.main | default slice -}} {{- $menus := $.Site.Menus.main | default slice -}}
@@ -12,9 +12,9 @@
(dict "Process" "fill center 192x192 webp" "descriptor" "192w") (dict "Process" "fill center 192x192 webp" "descriptor" "192w")
-}} -}}
{{- $avatarMenuIndex := 0 -}} {{- $avatarMenuIndex := 0 -}}
{{- if $profile.avatarMenu -}} {{- if $profile.avatar_menu -}}
{{- range $index, $menu := $menus -}} {{- range $index, $menu := $menus -}}
{{- if eq $menu.Identifier $profile.avatarMenu -}} {{- if eq $menu.Identifier $profile.avatar_menu -}}
{{- $avatarMenuIndex = $index -}} {{- $avatarMenuIndex = $index -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
+1 -1
View File
@@ -16,7 +16,7 @@
{{- end -}} {{- end -}}
{{- /* object-fit-images */ -}} {{- /* object-fit-images */ -}}
{{- if $compatibility.objectFit -}} {{- if $compatibility.object_fit -}}
{{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}} {{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/script.html" -}} {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}} {{- end -}}
@@ -6,6 +6,113 @@
{{- $warns = $warns | append "The parameter `params.externalIcon` is deprecated since v1.0.0, use `params.link.external_icon` instead." -}} {{- $warns = $warns | append "The parameter `params.externalIcon` is deprecated since v1.0.0, use `params.link.external_icon` instead." -}}
{{- end -}} {{- 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" -}} {{- 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`." -}} {{- $warns = $warns | append "The file `assets/css/_custom.scss` is deprecated. Please move your custom styles to `assets/scss/custom.scss`." -}}
{{- end -}} {{- end -}}
+1 -7
View File
@@ -1,5 +1,4 @@
{{- /* FixIt theme environment detection */ -}} {{- /* FixIt theme environment detection */ -}}
{{- $params := partial "function/params.html" -}}
{{- if hugo.IsProduction -}} {{- if hugo.IsProduction -}}
{{- $cdn := .Site.Params.cdn -}} {{- $cdn := .Site.Params.cdn -}}
@@ -14,12 +13,7 @@
{{- .Site.Store.Set "cdn" $cdn -}} {{- .Site.Store.Set "cdn" $cdn -}}
{{- .Site.Store.Set "fingerprint" .Site.Params.fingerprint -}} {{- .Site.Store.Set "fingerprint" .Site.Params.fingerprint -}}
{{- .Site.Store.Set "analytics" .Site.Params.analytics -}} {{- .Site.Store.Set "analytics" .Site.Params.analytics -}}
{{- .Store.Set "comment" $params.comment -}} {{- .Store.Set "comment" (dict "Page" . "Key" "comment" | partial "function/param.html") -}}
{{- 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 -}}
{{- else -}} {{- else -}}
{{- .Site.Store.Set "devOpts" .Site.Params.dev -}} {{- .Site.Store.Set "devOpts" .Site.Params.dev -}}
{{- if ne .Site.Params.dev.enable true -}} {{- if ne .Site.Params.dev.enable true -}}
+1 -1
View File
@@ -1,7 +1,7 @@
{{- $pages := .Site.RegularPages }} {{- $pages := .Site.RegularPages }}
{{- /* Merge missing translations from other languages */ -}} {{- /* Merge missing translations from other languages */ -}}
{{- if .Site.Params.enableTranslationMerge -}} {{- if .Site.Params.enable_translation_merge -}}
{{- range .Site.Home.Translations -}} {{- range .Site.Home.Translations -}}
{{- $pages = $pages | lang.Merge .Site.RegularPages -}} {{- $pages = $pages | lang.Merge .Site.RegularPages -}}
{{- end -}} {{- end -}}
-1
View File
@@ -6,5 +6,4 @@
{{- partial "init/detection-deprecated.html" . -}} {{- partial "init/detection-deprecated.html" . -}}
{{- partial "init/detection-pagefind.html" . -}} {{- partial "init/detection-pagefind.html" . -}}
{{- partial "init/global.html" . -}} {{- partial "init/global.html" . -}}
{{- partial "init/patch.html" . -}}
{{- partial "init/compatibility.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. The extended syntax of alert is compatible with Obsidian and FixIt admonition shortcode.
@param {String} .Text the content of the admonition box @param {String} .Text - The content of the admonition box
@param {String} [.Type] the type of the admonition box @param {String} [.Type] - The type of the admonition box
@param {String} [.Title] the title 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} [.Open] - Whether the admonition box is open, default is true
@param {Boolean} [.Foldable] whether the admonition box is foldable, 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 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. The basic syntax of alert is compatible with GitHub, Obsidian, and Typora.
@param {String} .Type the type of the alert box @param {String} .Type - The type of the alert box
@param {String} .Text the content of the alert box @param {String} .Text - The content of the alert box
@param {Map} [.Attributes] the attributes 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" -}} @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. - Reads analytics config from Site Store.
- Conditionally renders provider snippets when enabled. - Conditionally renders provider snippets when enabled.
- Supported providers include Google, Fathom, Baidu, Umami, and others. - 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 -}} {{- $analytics := .Site.Store.Get "analytics" | default dict -}}
@@ -2,14 +2,29 @@
Code block wrapper hook for highlight output. Code block wrapper hook for highlight output.
- Applies wrapper UI features based on codeblock config. - Applies wrapper UI features based on codeblock config.
- Supports classic/modern modes, copy button, expand button, and line-number states. - Supports classic/modern modes, copy button, expand button, and line-number states.
@param {Object} .Attributes code block attributes @param {Object} .Attributes - Code block attributes
@param {Object} .Options code fence options @param {Object} .Options - Code fence options
@param {String} .Inner raw code content @param {String} .Inner - Raw code content
@param {Object} .Page current page context @param {Object} .Page - Current page context
@param {String} .Type language/type for current block @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 . -}} {{- $result := transform.HighlightCodeBlock . -}}
{{- $wrapper := $result.Wrapped -}} {{- $wrapper := $result.Wrapped -}}
@@ -17,13 +32,13 @@
{{- if $config.wrapper -}} {{- if $config.wrapper -}}
{{- $mode := $config.mode | default "classic" -}} {{- $mode := $config.mode | default "classic" -}}
{{- $lines := cond .Inner (len (split .Inner "\n")) 0 -}} {{- $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 -}} {{- $lineNoStart := cond (ne .Options.linenostart nil) .Options.linenostart 1 -}}
{{- $lineNosDigit := strings.RuneCount (sub (add $lines $lineNoStart) 1) -}} {{- $lineNosDigit := strings.RuneCount (sub (add $lines $lineNoStart) 1) -}}
{{- $class := "highlight" -}} {{- $class := "highlight" -}}
{{- with $config.class -}}{{ $class = add $class " " . }}{{- end -}} {{- with $config.class -}}{{ $class = add $class " " . }}{{- end -}}
{{- $targetClass := add "code-block " $class -}} {{- $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 */ -}} {{- /* Add code wrapper around the table or pre */ -}}
{{- $REin := cond (strings.Contains $wrapper `<table class="lntable">`) {{- $REin := cond (strings.Contains $wrapper `<table class="lntable">`)
@@ -49,7 +64,7 @@
{{- $wrapper = dict "Wrapper" $wrapper "Config" $config | partial "function/code-copy-btn.html" -}} {{- $wrapper = dict "Wrapper" $wrapper "Config" $config | partial "function/code-copy-btn.html" -}}
{{- end -}} {{- end -}}
{{- /* {{- /*
Add data attributes and class Add data attributes and class
Directly set CSS variables to ensure compatibility with non-Chromium-based browsers Directly set CSS variables to ensure compatibility with non-Chromium-based browsers
See https://caniuse.com/css3-attr for attr() support status See https://caniuse.com/css3-attr for attr() support status
@@ -1,6 +1,6 @@
{{- /* {{- /*
Copy button for diagram-like plugins. 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" -}} {{- $label := .Label | default "Copy Diagram code" -}}
+9 -9
View File
@@ -3,15 +3,15 @@
- Skips rendering when MarkupScope is home. - Skips rendering when MarkupScope is home.
- Supports chart options from inline content, data key, or resource file. - Supports chart options from inline content, data key, or resource file.
- Supports JavaScript template mode via js/file options. - Supports JavaScript template mode via js/file options.
@param {Object} [.Options] render options from shortcode or code fence attributes @param {Object} [.Options] - Render options from shortcode or code fence attributes
@param {String} [.Options.width] chart container width (default: 100%) @param {String} [.Options.width] - Chart container width (default: 100%)
@param {String} [.Options.height] chart container height (default: 30rem) @param {String} [.Options.height] - Chart container height (default: 30rem)
@param {Boolean} [.Options.js] whether to treat content as JS option builder @param {Boolean} [.Options.js] - Whether to treat content as JS option builder
@param {Boolean} [.Options.async] whether JS template executes asynchronously @param {Boolean} [.Options.async] - Whether JS template executes asynchronously
@param {String} [.Options.data] key of data source under data/echarts @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} [.Options.file] - Local resource path for js/json/yaml/toml source
@param {String} [.Inner] inline chart option content @param {String} [.Inner] - Inline chart option content
@param {Object} [.Page] current page context @param {Object} [.Page] - Current page context
*/ -}} */ -}}
{{- if ne hugo.Context.MarkupScope "home" -}} {{- if ne hugo.Context.MarkupScope "home" -}}
+16 -16
View File
@@ -1,11 +1,11 @@
{{- /* {{- /*
Recursive function to render tree from structured data Recursive function to render tree from structured data
@param {array} items - Array of tree items @param {Array} items - Array of tree items
@param {int} level - The expand level of the tree (expand all: -1, collapse all: 0) @param {Int} level - The expand level of the tree (expand all: -1, collapse all: 0)
@param {int} [depth=0] - Current depth level @param {Int} [depth=0] - Current depth level
@param {bool} [folderSlash=false] - Whether to append a trailing "/" to folder names @param {Boolean} [folder_slash=false] - Whether to append a trailing "/" to folder names
@param {array} [ignoreList] - List of file or folder names to ignore @param {Array} [ignore_list] - List of file or folder names to ignore
@param {array} [highlightList] - List of file or folder names to highlight @param {Array} [highlight_list] - List of file or folder names to highlight
File tree item structure: File tree item structure:
name: string - The name of the file or folder name: string - The name of the file or folder
@@ -16,9 +16,9 @@
{{- $items := .items -}} {{- $items := .items -}}
{{- $level := .level -}} {{- $level := .level -}}
{{- $depth := .depth | default 0 -}} {{- $depth := .depth | default 0 -}}
{{- $folderSlash := .folderSlash | default false -}} {{- $folderSlash := .folder_slash | default false -}}
{{- $ignoreList := .ignoreList | default slice -}} {{- $ignoreList := .ignore_list | default slice -}}
{{- $highlightList := .highlightList | default slice -}} {{- $highlightList := .highlight_list | default slice -}}
<ul class="file-tree" data-level="{{ $depth }}"> <ul class="file-tree" data-level="{{ $depth }}">
{{- /* Sort items: directories first, then files */ -}} {{- /* Sort items: directories first, then files */ -}}
@@ -34,7 +34,7 @@
{{- $fileItems = $fileItems | append . -}} {{- $fileItems = $fileItems | append . -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- range (append $fileItems $dirItems) -}} {{- range (append $fileItems $dirItems) -}}
{{- $isDir := eq .type "dir" -}} {{- $isDir := eq .type "dir" -}}
{{- $isCollapsed := $isDir | and (ge $depth $level) | and (ge $level 0) -}} {{- $isCollapsed := $isDir | and (ge $depth $level) | and (ge $level 0) -}}
@@ -43,7 +43,7 @@
{{- if and $isDir $folderSlash -}} {{- if and $isDir $folderSlash -}}
{{- $label = printf "%s/" $label -}} {{- $label = printf "%s/" $label -}}
{{- end -}} {{- end -}}
<li class="file-tree-item{{ if $isDir }} file-tree-folder{{ end }}{{ if $isCollapsed }} is-collapsed{{ 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 }}"> <span class="file-tree-label{{ if $isDir }} file-tree-toggle{{ end }}{{ if $isHighlighted }} is-highlighted{{ end }}">
{{- $icon := "file-tree-icon fa-regular " -}} {{- $icon := "file-tree-icon fa-regular " -}}
@@ -55,15 +55,15 @@
{{- dict "Class" $icon | partial "plugin/icon.html" -}} {{- dict "Class" $icon | partial "plugin/icon.html" -}}
<span class="file-tree-label__inner">{{ $label }}</span> <span class="file-tree-label__inner">{{ $label }}</span>
</span> </span>
{{- if and $isDir .children -}} {{- if and $isDir .children -}}
{{- $options := dict {{- $options := dict
"items" .children "items" .children
"depth" (add $depth 1) "depth" (add $depth 1)
"level" $level "level" $level
"folderSlash" $folderSlash "folder_slash" $folderSlash
"ignoreList" $ignoreList "ignore_list" $ignoreList
"highlightList" $highlightList "highlight_list" $highlightList
-}} -}}
{{- template "render-file-tree" $options -}} {{- template "render-file-tree" $options -}}
{{- end -}} {{- end -}}
@@ -73,7 +73,7 @@
{{- end -}} {{- end -}}
{{- if .items -}} {{- if .items -}}
{{- $ignoreList := .ignoreList | default slice -}} {{- $ignoreList := .ignore_list | default slice -}}
{{- $notEmpty := false -}} {{- $notEmpty := false -}}
{{- range .items -}} {{- range .items -}}
{{- if not (in $ignoreList .name) -}} {{- if not (in $ignoreList .name) -}}
@@ -2,11 +2,11 @@
Encrypted content renderer. Encrypted content renderer.
- Encrypts content payload and renders decryptor UI. - Encrypts content payload and renders decryptor UI.
- Supports full-page mode and partial mode with isolated target container. - Supports full-page mode and partial mode with isolated target container.
@param {String} .Password encryption password @param {String} .Password - Encryption password
@param {String} .Content content to encrypt and render @param {String} .Content - Content to encrypt and render
@param {String} [.Message] custom input placeholder message @param {String} [.Message] - Custom input placeholder message
@param {Boolean} [.IsPartial] whether current render is partial mode @param {Boolean} [.IsPartial] - Whether current render is partial mode
@param {Object} [.Page] current page context (required when IsPartial is true) @param {Object} [.Page] - Current page context (required when IsPartial is true)
*/ -}} */ -}}
{{- if .Password -}} {{- if .Password -}}
+4 -4
View File
@@ -3,10 +3,10 @@
- Renders <i> element when Class is provided. - Renders <i> element when Class is provided.
- Resolves local SVG resources or external SVG URL fallback. - Resolves local SVG resources or external SVG URL fallback.
- Supports Simple Icons shorthand by icon name. - Supports Simple Icons shorthand by icon name.
@param {String} [.Class] icon class name for <i> @param {String} [.Class] - Icon class name for <i>
@param {String} [.Src] svg source path or URL @param {String} [.Src] - SVG source path or URL
@param {String} [.Simpleicons] simple-icons icon name @param {String} [.Simpleicons] - Simple-icons icon name
@param {String} [.Prefix] custom prefix for simple-icons source path @param {String} [.Prefix] - Custom prefix for simple-icons source path
*/ -}} */ -}}
{{- with .Class -}} {{- 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: Pass .Page when the caller needs page-level config override (e.g., content images).
- Src: The path to the image. Omit .Page for decorative/site-level images (e.g., logos, avatars, badges).
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"].
Thanks @HEIGE-PCloud for the original code in the DoIt theme. @param {String} .Src - Image path (page resource, global resource, or remote URL)
https://github.com/HEIGE-PCloud/DoIt/blob/main/layouts/_partials/plugin/image.html @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 -}} {{- $Resources := .Resources | default page.Resources -}}
{{- $isInline := strings.HasPrefix .Src "data:image" -}} {{- $isInline := strings.HasPrefix .Src "data:image" -}}
{{- $isRemote := urls.Parse .Src | partial "function/is-url-remote.html" -}} {{- $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) -}} {{- $resource = $resource | default ($Resources.Get .Src) | default (resources.Get .Src) -}}
{{- end -}} {{- 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 */ -}} {{- /* Check if the image is blocked from optimisation */ -}}
{{- $blackList := .BlackList | default $config.blackList | default slice -}} {{- $blackList := .BlackList | default $config.blackList | default slice -}}
{{- $isBlocked := false -}} {{- $isBlocked := false -}}
@@ -63,12 +65,22 @@ https://github.com/HEIGE-PCloud/DoIt/blob/main/layouts/_partials/plugin/image.ht
{{- with $blackList -}} {{- with $blackList -}}
{{- $regex = replace (delimit . "|") "." "\\." -}} {{- $regex = replace (delimit . "|") "." "\\." -}}
{{- $regex = replace $regex "*" ".*" -}} {{- $regex = replace $regex "*" ".*" -}}
{{- $isBlocked = gt (findRE $regex $.Src | len) 0 -}}
{{- end -}} {{- 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 */ -}} {{- /* raster graphics */ -}}
{{- $rasterTypes := slice "svg" "avif" -}} {{- $rasterTypes := slice "svg" "avif" -}}
{{- $isRaster := false -}} {{- $isRaster := false -}}
{{- if $resource -}} {{- if $resource -}}
{{- if $regex -}} {{- if $regex | and (not $isBlocked) -}}
{{- $isBlocked = gt (findRE $regex $resource.Name | len) 0 -}} {{- $isBlocked = gt (findRE $regex $resource.Name | len) 0 -}}
{{- end -}} {{- end -}}
{{- if not $isBlocked -}} {{- if not $isBlocked -}}
+21 -26
View File
@@ -3,20 +3,20 @@
- Auto-detects external links and applies target/rel policies. - Auto-detects external links and applies target/rel policies.
- Supports optional icon, download hint, and external icon display. - Supports optional icon, download hint, and external icon display.
- Supports card mode with URL meta and favicon fallback. - Supports card mode with URL meta and favicon fallback.
@param {String} .Destination target URL @param {String} .Destination - Target URL
@param {String} [.Content] link label HTML @param {String} [.Content] - Link label HTML
@param {String} [.Title] title attribute @param {String} [.Title] - Title attribute
@param {String} [.Class] custom CSS classes @param {String} [.Class] - Custom CSS classes
@param {String} [.Rel] rel attribute value @param {String} [.Rel] - Rel attribute value
@param {Boolean} [.Newtab] force external behavior @param {Boolean} [.Newtab] - Force external behavior
@param {Boolean} [.Noreferrer] whether to include noreferrer (default: true) @param {Boolean} [.Noreferrer] - Whether to include noreferrer (default: true)
@param {Boolean} [.ExternalIcon] whether to show external-link icon @param {Boolean} [.ExternalIcon] - Whether to show external-link icon
@param {Object} [.Icon] icon params for plugin/icon.html @param {Object} [.Icon] - Icon params for plugin/icon.html
@param {Boolean} [.Card] whether to render card link layout @param {Boolean} [.Card] - Whether to render card link layout
@param {String} [.CardIcon] card icon URL or icon class @param {String} [.CardIcon] - Card icon URL or icon class
@param {String} [.Download] download attribute value @param {String} [.Download] - Download attribute value
@param {Boolean} [.IsGuarded] explicitly enable or disable link guard @param {Boolean} [.IsGuarded] - Explicitly enable or disable link guard
@param {Object} [.Page] current page context @param {Object} [.Page] - Page context for page-level link config override
*/ -}} */ -}}
{{- /* Regular link rendering */ -}} {{- /* Regular link rendering */ -}}
@@ -102,7 +102,10 @@
{{- end -}} {{- end -}}
{{- $blockSchemes := slice "javascript" "mailto" "tel" "file" "data" "vscode" "trae" -}} {{- $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 "" -}} {{- $rel := .Rel | default "" -}}
{{- $isExternal := false -}} {{- $isExternal := false -}}
{{- $noreferrer := true -}} {{- $noreferrer := true -}}
@@ -126,18 +129,10 @@
{{- /* External link guard */ -}} {{- /* External link guard */ -}}
{{- $isGuarded := false -}} {{- $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 {{- if
$guardConfig.enable $config.guard.enable
| and $isExternal | and $isExternal
| and (not (in $guardConfig.allowDomains $url.Host)) | and (not (in $config.guard.allowDomains $url.Host))
-}} -}}
{{- $isGuarded = .IsGuarded | default true -}} {{- $isGuarded = .IsGuarded | default true -}}
{{- end -}} {{- end -}}
@@ -159,7 +154,7 @@
{{- with .Download -}} {{- with .Download -}}
{{- $attrs = printf ` download="%s"` . | add $attrs -}} {{- $attrs = printf ` download="%s"` . | add $attrs -}}
{{- end -}} {{- end -}}
{{- if $isGuarded | and (eq $guardConfig.mode "modal") -}} {{- if $isGuarded | and (eq $config.guard.mode "modal") -}}
{{- $attrs = add $attrs ` data-guard="modal"` -}} {{- $attrs = add $attrs ` data-guard="modal"` -}}
{{- end -}} {{- 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. - Skips rendering when MarkupScope is home.
- Supports wrapped view with tabs/actions and plain diagram mode. - Supports wrapped view with tabs/actions and plain diagram mode.
- Supports per-diagram filename for code/download actions. - Supports per-diagram filename for code/download actions.
@param {Object} [.Options] render options from shortcode or code fence attributes @param {Object} [.Options] - Render options from shortcode or code fence attributes
@param {Boolean} [.Options.wrapper] whether to enable wrapped diagram UI @param {Boolean} [.Options.wrapper] - Whether to enable wrapped diagram UI
@param {String} [.Options.filename] filename used by diagram/code actions @param {String} [.Options.filename] - Filename used by diagram/code actions
@param {String} [.Inner] inline Mermaid source content @param {String} [.Inner] - Inline Mermaid source content
@param {Object} [.Page] current page context @param {Object} [.Page] - Current page context
*/ -}} */ -}}
{{- if ne hugo.Context.MarkupScope "home" -}} {{- if ne hugo.Context.MarkupScope "home" -}}
{{- $code := strings.TrimSpace .Inner -}} {{- $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 -}} {{- if $wrapped -}}
{{- $labelDiagram := T "tabs.diagram" -}} {{- $labelDiagram := T "tabs.diagram" -}}
@@ -1,11 +1,8 @@
{{- if and .Site.Params.search.enable (eq .Site.Params.search.type "pagefind") .IsPage -}} {{- 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) -}} {{- $pageDate := (.PublishDate | default .Date) -}}
{{- $dateLabel := $pageDate | dateFormat (.Site.Params.dateFormat | default "2006-01-02") -}} {{- $dateLabel := $pageDate | dateFormat (.Site.Params.date_format | default "2006-01-02") -}}
<meta data-pagefind-filter="hidden:{{ $hidden }}"> <meta data-pagefind-filter="hidden:{{ string (.Param `hidden_from_search`) }}">
<meta data-pagefind-filter="encrypted:{{ $encrypted }}"> <meta data-pagefind-filter="encrypted:{{ string (.Params.password | not | not) }}">
<meta data-pagefind-sort="date:{{ $pageDate.Unix }}"> <meta data-pagefind-sort="date:{{ $pageDate.Unix }}">
<meta data-pagefind-sort="title:{{ .Title }}"> <meta data-pagefind-sort="title:{{ .Title }}">
<meta data-pagefind-meta="date:{{ $dateLabel }}"> <meta data-pagefind-meta="date:{{ $dateLabel }}">
+3 -24
View File
@@ -5,7 +5,7 @@
Podcast: https://ai.zhheo.com/docs/podcast.html Podcast: https://ai.zhheo.com/docs/podcast.html
TODO refactor and migrate to theme component 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 -}} {{- $chatConfig := $params.postChat -}}
{{- $summaryConfig := $params.postSummary -}} {{- $summaryConfig := $params.postSummary -}}
{{- $podcastConfig := $params.podcast -}} {{- $podcastConfig := $params.podcast -}}
@@ -17,7 +17,7 @@
"both" "postChatUser_summary.min.js" "both" "postChatUser_summary.min.js"
-}} -}}
{{- /* PostSummary only for public posts */ -}} {{- /* 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) -}} {{- $isPost := (eq .Kind "page") | and (eq .Type "posts") | and (not $password) -}}
{{- $summaryEnable := cond $isPost $summaryConfig.enable false -}} {{- $summaryEnable := cond $isPost $summaryConfig.enable false -}}
{{- $enable := $chatConfig.enable | or $summaryEnable -}} {{- $enable := $chatConfig.enable | or $summaryEnable -}}
@@ -81,28 +81,7 @@
{{- $blackDom = $blackDom | append . -}} {{- $blackDom = $blackDom | append . -}}
{{- end -}} {{- end -}}
{{- $upLoadWeb := cond (.IsHome | or $password | or (eq .Kind "404")) false $chatConfig.upLoadWeb -}} {{- $upLoadWeb := cond (.IsHome | or $password | or (eq .Kind "404")) false $chatConfig.upLoadWeb -}}
{{- $postChatConfig := dict {{- $postChatConfig := dict "upLoadWeb" $upLoadWeb "blackDom" $blackDom | merge $chatConfig -}}
"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
-}}
{{- $configJS = add $configJS ($postChatConfig | jsonify | printf "var postChatConfig=%s") -}} {{- $configJS = add $configJS ($postChatConfig | jsonify | printf "var postChatConfig=%s") -}}
{{- end -}} {{- end -}}
+3 -3
View File
@@ -2,9 +2,9 @@
Post reward panel renderer. Post reward panel renderer.
- Renders reward switch button and reward QR/payment images. - Renders reward switch button and reward QR/payment images.
- Supports optional author prefix and animation mode. - Supports optional author prefix and animation mode.
@param {Object} .Reward reward config object @param {Object} .Reward - Reward config object
@param {String} .Id unique input id for reward toggle @param {String} .Id - Unique input id for reward toggle
@param {String} [.Author] optional author name for image alt text @param {String} [.Author] - Optional author name for image alt text
*/ -}} */ -}}
{{- $reward := .Reward -}} {{- $reward := .Reward -}}
+14 -14
View File
@@ -2,20 +2,20 @@
Script tag renderer. Script tag renderer.
- Accepts direct script HTML, a pre-built resource, or builds from source path. - Accepts direct script HTML, a pre-built resource, or builds from source path.
- Supports template execution, minify/build/fingerprint pipeline, and extra attrs. - 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 {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 {resource.Resource} [.Resource] - Pre-built resource (skips build pipeline)
@param {String} [.Content] inline content to write as generated resource @param {String} [.Content] - Inline content to write as generated resource
@param {String} [.Path] target path for resource created from Content @param {String} [.Path] - Target path for resource created from Content
@param {Object} [.Template] target path for resource created from template execution @param {Object} [.Template] - Target path for resource created from template execution
@param {Object} [.Context] template context for ExecuteAsTemplate @param {Object} [.Context] - Template context for ExecuteAsTemplate
@param {Boolean} [.Minify] whether to minify resource @param {Boolean} [.Minify] - Whether to minify resource
@param {Object} [.Build] js.Build options (Build.minify is normalized to .Minify for path semantics) @param {Object} [.Build] - js.Build options (Build.minify is normalized to .Minify for path semantics)
@param {String} [.Fingerprint] fingerprint algorithm @param {String} [.Fingerprint] - Fingerprint algorithm
@param {Boolean} [.Async] whether to add async attribute @param {Boolean} [.Async] - Whether to add async attribute
@param {Boolean} [.Defer] whether to add defer attribute @param {Boolean} [.Defer] - Whether to add defer attribute
@param {Boolean} [.Crossorigin] whether to add crossorigin=anonymous @param {Boolean} [.Crossorigin] - Whether to add crossorigin=anonymous
@param {String} [.Integrity] SRI hash value @param {String} [.Integrity] - SRI hash value
@param {String} [.Attr] additional attributes @param {String} [.Attr] - Additional attributes
*/ -}} */ -}}
{{- if strings.HasPrefix (.Source | default "") "<script" -}} {{- if strings.HasPrefix (.Source | default "") "<script" -}}
+8 -7
View File
@@ -2,13 +2,14 @@
Social share buttons renderer. Social share buttons renderer.
- Reads share switches from merged theme/page params. - Reads share switches from merged theme/page params.
- Outputs provider-specific sharer attributes for supported platforms. - 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 -}} {{- 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 := "" -}} {{- $twitterVia := "" -}}
{{- with .Site.Params.social.twitter -}} {{- with .Site.Params.social.twitter -}}
{{- if reflect.IsMap . -}} {{- if reflect.IsMap . -}}
@@ -54,7 +55,7 @@
{{- /* 006: Pinterest */ -}} {{- /* 006: Pinterest */ -}}
{{- if $share.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" -}} {{- dict "Class" "fa-brands fa-pinterest" | partial "plugin/icon.html" -}}
</a> </a>
{{ end -}} {{ end -}}
@@ -82,14 +83,14 @@
{{- /* 010: VK */ -}} {{- /* 010: VK */ -}}
{{- if $share.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" -}} {{- dict "Class" "fa-brands fa-vk" | partial "plugin/icon.html" -}}
</a> </a>
{{ end -}} {{ end -}}
{{- /* 011: Buffer */ -}} {{- /* 011: Buffer */ -}}
{{- if $share.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" -}} {{- dict "Class" "fa-brands fa-buffer" | partial "plugin/icon.html" -}}
</a> </a>
{{ end -}} {{ end -}}
@@ -131,7 +132,7 @@
{{- /* 017: 微博 */ -}} {{- /* 017: 微博 */ -}}
{{- if $share.Weibo -}} {{- 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" -}} {{- dict "Class" "fa-brands fa-weibo" | partial "plugin/icon.html" -}}
</a> </a>
{{ end -}} {{ end -}}
+4 -4
View File
@@ -2,10 +2,10 @@
Social profile link helper. Social profile link helper.
- Builds destination from explicit Url or from Prefix/Template/Id. - Builds destination from explicit Url or from Prefix/Template/Id.
- Delegates final rendering to plugin/link.html with rel=me. - Delegates final rendering to plugin/link.html with rel=me.
@param {String} [.Url] explicit target URL @param {String} [.Url] - Explicit target URL
@param {String} [.Template] URL template containing one %%v placeholder @param {String} [.Template] - URL template containing one %%v placeholder
@param {String} [.Prefix] URL prefix used to build Template @param {String} [.Prefix] - URL prefix used to build Template
@param {String} [.Id] account id used by Template @param {String} [.Id] - Account id used by Template
*/ -}} */ -}}
{{- $destination := "" -}} {{- $destination := "" -}}
+13 -13
View File
@@ -2,19 +2,19 @@
Stylesheet tag renderer. Stylesheet tag renderer.
- Accepts direct <link> HTML, a pre-built resource, or builds from source path. - Accepts direct <link> HTML, a pre-built resource, or builds from source path.
- Supports template execution, optional toCSS, minify/fingerprint, and preload mode. - 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 {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 {resource.Resource} [.Resource] - Pre-built resource (skips build pipeline)
@param {String} [.Content] inline style content to write as generated resource @param {String} [.Content] - Inline style content to write as generated resource
@param {String} [.Path] target path for resource created from Content @param {String} [.Path] - Target path for resource created from Content
@param {Object} [.Template] target path for resource created from template execution @param {Object} [.Template] - Target path for resource created from template execution
@param {Object} [.Context] template context for ExecuteAsTemplate @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 {Object|Boolean} [.ToCSS] - True for defaults, dict for custom toCSS options, false/omit to skip toCSS
@param {Boolean} [.Minify] whether to minify resource @param {Boolean} [.Minify] - Whether to minify resource
@param {String} [.Fingerprint] fingerprint algorithm @param {String} [.Fingerprint] - Fingerprint algorithm
@param {Boolean} [.Crossorigin] whether to add crossorigin=anonymous @param {Boolean} [.Crossorigin] - Whether to add crossorigin=anonymous
@param {Boolean} [.Preload] whether to output preload + noscript fallback @param {Boolean} [.Preload] - Whether to output preload + noscript fallback
@param {String} [.Integrity] SRI hash value @param {String} [.Integrity] - SRI hash value
@param {String} [.Attr] additional attributes @param {String} [.Attr] - Additional attributes
*/ -}} */ -}}
{{- if strings.HasPrefix (.Source | default "") "<link" -}} {{- 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. 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 events from inline content, data key, resource file, or direct Events input.
- Supports reverse order, placement, animation, node style, and size options. - Supports reverse order, placement, animation, node style, and size options.
@param {Object} [.Options] render options from shortcode or code fence attributes @param {Object} [.Options] - Render options from shortcode or code fence attributes
@param {Boolean} [.Options.reverse] whether to sort events in descending order @param {Boolean} [.Options.reverse] - Whether to sort events in descending order
@param {String} [.Options.placement] default timestamp placement @param {String} [.Options.placement] - Default timestamp placement
@param {Boolean} [.Options.animation] whether to enable item animation @param {Boolean} [.Options.animation] - Whether to enable item animation
@param {String} [.Options.size] timeline size variant @param {String} [.Options.size] - Timeline size variant
@param {String} [.Options.node] timeline node style @param {String} [.Options.node] - Timeline node style
@param {String} [.Options.data] key of data source under data/timeline @param {String} [.Options.data] - Key of data source under data/timeline
@param {String} [.Options.file] local resource path for timeline data @param {String} [.Options.file] - Local resource path for timeline data
@param {String} [.Inner] inline timeline source content @param {String} [.Inner] - Inline timeline source content
@param {Array} [.Events] direct events array override @param {Array} [.Events] - Direct events array override
@param {Object} [.Page] current page context @param {Object} [.Page] - Current page context
*/ -}} */ -}}
{{- $reverse := .Options.reverse | default false -}} {{- $reverse := .Options.reverse | default false -}}
@@ -4,21 +4,21 @@
"section" "section" "section" "section"
"term" "list" "term" "list"
-}} -}}
{{- $recentlyUpdatedConfig := .Site.Params.recentlyUpdated -}} {{- $recentlyUpdatedConfig := .Site.Params.recently_updated -}}
{{- $scope := index $kindMap .Kind -}} {{- $scope := index $kindMap .Kind -}}
{{- $scopeEnable := index $recentlyUpdatedConfig $scope | default false -}} {{- $scopeEnable := index $recentlyUpdatedConfig $scope | default false -}}
{{- if $scopeEnable | and (eq $.Paginator.PageNumber 1) -}} {{- if $scopeEnable | and (eq $.Paginator.PageNumber 1) -}}
{{- $hasTitle := false }} {{- $hasTitle := false }}
{{- $postCount := 0 -}} {{- $postCount := 0 -}}
{{- $maxPostCount := $recentlyUpdatedConfig.maxCount | default 10 -}} {{- $maxPostCount := $recentlyUpdatedConfig.max_count | default 10 -}}
{{- $days := $recentlyUpdatedConfig.days | default 30 -}} {{- $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 -}} {{- $scopePages := .Pages -}}
{{- if eq $scope "archives" -}} {{- if eq $scope "archives" -}}
{{- $scopePages = .Site.Store.Get "mainSectionPages" -}} {{- $scopePages = .Site.Store.Get "mainSectionPages" -}}
{{- end -}} {{- end -}}
{{- $scopePages = where $scopePages.ByLastmod.Reverse "Section" "!=" "" -}} {{- $scopePages = where $scopePages.ByLastmod.Reverse "Section" "!=" "" -}}
{{- $hiddenAdapters := .Param "hiddenAdapters" | default false -}} {{- $hiddenAdapters := .Param "hidden_adapters" | default false -}}
{{- if $hiddenAdapters -}} {{- if $hiddenAdapters -}}
{{- $scopePages = where $scopePages "File.IsContentAdapter" "ne" true -}} {{- $scopePages = where $scopePages "File.IsContentAdapter" "ne" true -}}
{{- end -}} {{- end -}}
@@ -40,9 +40,9 @@
{{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}} {{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}}
{{- end -}} {{- end -}}
{{- if eq $scope "archives" -}} {{- if eq $scope "archives" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}} {{- cond (.Param "capitalize_titles") (title .Title) .Title -}}
{{- else -}} {{- else -}}
{{- cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}} {{- cond (.Param "capitalize_titles") (title .LinkTitle) .LinkTitle -}}
{{- end -}} {{- end -}}
</a> </a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Lastmod.Format }}'> <span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Lastmod.Format }}'>
@@ -1,7 +1,5 @@
{{- /* Collection List */ -}} {{- /* Collection List */ -}}
{{- $params := partial "function/params.html" -}} {{- if .Params.collections | and (.Param "collection_list") -}}
{{- if .Params.collections | and $params.collectionList -}}
{{- $collectionTerms := .GetTerms "collections" -}} {{- $collectionTerms := .GetTerms "collections" -}}
{{- range $collectionTerms -}} {{- range $collectionTerms -}}
{{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}} {{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}}
@@ -19,7 +17,7 @@
<nav> <nav>
<ul class="collection-list"> <ul class="collection-list">
{{- range $key, $page := $pages -}} {{- range $key, $page := $pages -}}
{{- $capitalizeTitles := $page.Param "capitalizeTitles" -}} {{- $capitalizeTitles := $page.Param "capitalize_titles" -}}
{{- $title := $page.Params.shortTitle | default $page.LinkTitle -}} {{- $title := $page.Params.shortTitle | default $page.LinkTitle -}}
{{- $title = cond $capitalizeTitles (title $title) $title -}} {{- $title = cond $capitalizeTitles (title $title) $title -}}
<li class="collection-item"> <li class="collection-item">
@@ -34,7 +32,7 @@
</ul> </ul>
<div class="collection-nav-simple"> <div class="collection-nav-simple">
{{- with $pages.Next $ -}} {{- 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 }}"> <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" -}} {{- dict "Class" "fa-solid fa-angle-left" | partial "plugin/icon.html" -}}
</a> </a>
@@ -43,7 +41,7 @@
{{- end -}} {{- end -}}
<span class="text-secondary">{{ add $currentKey 1 }}/{{ $pages.Len }}</span> <span class="text-secondary">{{ add $currentKey 1 }}/{{ $pages.Len }}</span>
{{- with $pages.Prev $ -}} {{- 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 }}"> <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" -}} {{- dict "Class" "fa-solid fa-angle-right" | partial "plugin/icon.html" -}}
</a> </a>
+3 -5
View File
@@ -1,7 +1,5 @@
{{- /* Collection Navigation */ -}} {{- /* Collection Navigation */ -}}
{{- $params := partial "function/params.html" -}} {{- if .Params.collections | and (.Param "collection_navigation") -}}
{{- if .Params.collections | and $params.collectionNavigation -}}
{{- $collectionTerms := .GetTerms "collections" -}} {{- $collectionTerms := .GetTerms "collections" -}}
{{- range $collectionTerms -}} {{- range $collectionTerms -}}
{{- $termLink := printf `<a href="%v">%v <span>%v・%v</span></span></a>` {{- $termLink := printf `<a href="%v">%v <span>%v・%v</span></span></a>`
@@ -18,7 +16,7 @@
{{/* TODO JS 实现 reverse 翻转顺序 */}} {{/* TODO JS 实现 reverse 翻转顺序 */}}
{{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}} {{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}}
{{- with $pages.Next $ -}} {{- with $pages.Next $ -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}} {{- $capitalizeTitles := .Param "capitalize_titles" -}}
{{- $title := .Params.shortTitle | default .LinkTitle -}} {{- $title := .Params.shortTitle | default .LinkTitle -}}
{{- $title = cond $capitalizeTitles (title $title) $title -}} {{- $title = cond $capitalizeTitles (title $title) $title -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ $title }}"> <a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ $title }}">
@@ -27,7 +25,7 @@
</a> </a>
{{- end -}} {{- end -}}
{{- with $pages.Prev $ -}} {{- with $pages.Prev $ -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}} {{- $capitalizeTitles := .Param "capitalize_titles" -}}
{{- $title := .Params.shortTitle | default .LinkTitle -}} {{- $title := .Params.shortTitle | default .LinkTitle -}}
{{- $title = cond $capitalizeTitles (title $title) $title -}} {{- $title = cond $capitalizeTitles (title $title) $title -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ $title }}"> <a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ $title }}">
@@ -1,8 +1,6 @@
{{- $params := partial "function/params.html" -}} {{- $expirationReminder := dict "Page" . "Key" "expiration_reminder" | partial "function/param.html" | default dict -}}
{{- $expirationReminder := $params.expirationReminder | default dict -}}
{{- $isEnabled := $expirationReminder.enable | and (not $params.password) -}}
{{- if $isEnabled -}} {{- if $expirationReminder.enable | and (not .Params.password) -}}
{{- $daysAgo := div (sub now.Unix .Lastmod.Unix) 86400 }} {{- $daysAgo := div (sub now.Unix .Lastmod.Unix) 86400 }}
{{- $reminderThreshold := $expirationReminder.reminder | default 90 }} {{- $reminderThreshold := $expirationReminder.reminder | default 90 }}
{{- $warningThreshold := $expirationReminder.warning | default 180 }} {{- $warningThreshold := $expirationReminder.warning | default 180 }}
@@ -21,7 +19,7 @@
</div> </div>
<div class="details-content"> <div class="details-content">
<div class="admonition-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" -}} {{- dict "Date" . | T "single.expirationReminder" -}}
{{- end -}} {{- end -}}
</div> </div>
+58 -55
View File
@@ -1,27 +1,61 @@
{{- $params := partial "function/params.html" -}}
{{- /* Git info */ -}} {{- /* Git info */ -}}
{{- $gitRepo := "" -}} {{- $gitRepo := "" -}}
{{- $blobURL := "" -}} {{- $blobURL := "" -}}
{{- $sourceURL := "" -}} {{- $sourceURL := "" -}}
{{- $editURL := "" -}} {{- $editURL := "" -}}
{{- $reportURL := "" -}} {{- $reportURL := "" -}}
{{- with .Site.Params.gitInfo -}} {{- with .Site.Params.git_info -}}
{{- if .Repo -}} {{- if .repo -}}
{{- $gitRepo = strings.TrimSuffix "/" .Repo -}} {{- $gitRepo = strings.TrimSuffix "/" .repo -}}
{{- $blobURL = printf "%v/blob/%v/%v/{path}" $gitRepo .Branch .Dir -}} {{- $blobURL = printf "%v/blob/%v/%v/{path}" $gitRepo .branch .dir -}}
{{- $editURL = printf "%v/edit/%v/%v/{path}" $gitRepo .Branch .Dir -}} {{- $editURL = printf "%v/edit/%v/%v/{path}" $gitRepo .branch .dir -}}
{{- $reportURL = printf "%v/issues/new?%v" $gitRepo .IssueTpl -}} {{- $reportURL = printf "%v/issues/new?%v" $gitRepo .issue_tpl -}}
{{- end -}} {{- end -}}
{{- 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-footer" id="post-footer">
<div class="post-info"> <div class="post-info">
<div class="post-info-line"> <div class="post-info-line">
<div class="post-info-mod"> <div class="post-info-mod">
{{- $updateTitle := dict "Date" ("2006-01-02 15:04:05" | .Lastmod.Format) | T "single.updatedOnDate" -}} {{- $updateTitle := dict "Date" ("2006-01-02 15:04:05" | .Lastmod.Format) | T "single.updatedOnDate" -}}
<span title="{{ $updateTitle }}"> <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; {{- dict "Date" . | T "single.updatedOnDate" -}}&nbsp;
{{- if $gitRepo -}} {{- if $gitRepo -}}
{{- with $.GitInfo -}} {{- with $.GitInfo -}}
@@ -38,60 +72,29 @@
{{- end -}} {{- end -}}
</span> </span>
</div> </div>
{{- if not $params.password -}} {{- if not .Params.password -}}
{{- with $params.license | string -}} {{- with (.Param "license") | string -}}
<div class="post-info-license"> <div class="post-info-license">
<span>{{ . | safeHTML }}</span> <span>{{ . | safeHTML }}</span>
</div> </div>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
</div> </div>
{{- if not $params.password -}} <div class="post-info-line">
<div class="post-info-line"> <div class="post-info-md">
<div class="post-info-md"> {{- range $linkOptions -}}
{{- $linkOptions := slice -}} {{- $commonOptions := dict "ExternalIcon" false -}}
{{- if $params.LinkToMarkdown -}} <span>{{ partial "plugin/link.html" (. | merge $commonOptions) }}</span>
{{- with .OutputFormats.Get "markdown" -}} {{- end -}}
{{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") -}} </div>
{{- $linkOptions = $linkOptions | append $options -}} {{- if not .Params.password -}}
{{- 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-share"> <div class="post-info-share">
<span> <span>
{{- partial "plugin/share.html" . -}} {{- partial "plugin/share.html" . -}}
</span> </span>
</div> </div>
</div> {{- end -}}
{{- end -}} </div>
</div> </div>
<div class="post-info-more"> <div class="post-info-more">
@@ -118,7 +121,7 @@
{{- $prev := $pages.Prev . -}} {{- $prev := $pages.Prev . -}}
{{- $next := $pages.Next . -}} {{- $next := $pages.Next . -}}
{{- /* Show the post navigation in section pages */ -}} {{- /* Show the post navigation in section pages */ -}}
{{- if $navigation.inSection -}} {{- if $navigation.in_section -}}
{{- $prev = .PrevInSection -}} {{- $prev = .PrevInSection -}}
{{- $next = .NextInSection -}} {{- $next = .NextInSection -}}
{{- end -}} {{- end -}}
@@ -128,14 +131,14 @@
{{- $next = $pages.Prev . -}} {{- $next = $pages.Prev . -}}
{{- end -}} {{- end -}}
{{- with $prev -}} {{- with $prev -}}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}} {{- $capitalizeTitles := .Param "capitalize_titles" -}}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="prev" title="{{ cond $capitalizeTitles (title .LinkTitle) .LinkTitle }}"> <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" -}} {{- dict "Class" "fa-solid fa-angle-left" | partial "plugin/icon.html" -}}
{{- cond $capitalizeTitles (title .LinkTitle) .LinkTitle -}} {{- cond $capitalizeTitles (title .LinkTitle) .LinkTitle -}}
</a> </a>
{{- end -}} {{- end -}}
{{ with $next }} {{ with $next }}
{{- $capitalizeTitles := .Param "capitalizeTitles" -}} {{- $capitalizeTitles := .Param "capitalize_titles" -}}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="next" title="{{ cond $capitalizeTitles (title .LinkTitle) .LinkTitle }}"> <a href="{{ .RelPermalink }}" class="post-nav-item" rel="next" title="{{ cond $capitalizeTitles (title .LinkTitle) .LinkTitle }}">
{{- cond $capitalizeTitles (title .LinkTitle) .LinkTitle -}} {{- cond $capitalizeTitles (title .LinkTitle) .LinkTitle -}}
{{- dict "Class" "fa-solid fa-angle-right" | partial "plugin/icon.html" -}} {{- 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 -}} {{- $author := partial "function/get-author-map.html" .Params.author -}}
{{- .Store.Set "author" $author -}} {{- .Store.Set "author" $author -}}
{{- $optim := slice {{- $optim := slice
@@ -11,7 +10,7 @@
{{- $content := $author.name | default "Anonymous" -}} {{- $content := $author.name | default "Anonymous" -}}
{{- $icon := dict "Class" "fa-solid fa-user-circle" -}} {{- $icon := dict "Class" "fa-solid fa-user-circle" -}}
{{- /* Deprecate $params.authorAvatar in favor of $params.showAvatar and add front matter gravatar {bool} */ -}} {{- /* 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 -}} {{- $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 = "" -}} {{- $icon = "" -}}
{{- end -}} {{- end -}}
+7 -8
View File
@@ -1,15 +1,14 @@
{{- /* Related Content */ -}} {{- /* Related Content */ -}}
{{- /* https://gohugo.io/content-management/related/ */ -}} {{- /* https://gohugo.io/content-management/related/ */ -}}
{{- $params := partial "function/params.html" -}} {{- $relatedConfig := dict "Page" . "Key" "related" | partial "function/param.html" -}}
{{- if $relatedConfig.enable | and ("aside" | in $relatedConfig.position) | and (not .Params.password) -}}
{{- if $params.related.enable | and ("aside" | in $params.related.position) | and (not $params.password) -}}
{{- $posts := .Site.Store.Get "mainSectionPages" -}} {{- $posts := .Site.Store.Get "mainSectionPages" -}}
{{- if .Site.Params.page.hiddenFromRelated -}} {{- if .Site.Params.hidden_from_related -}}
{{- $posts = where $posts "Params.hiddenfromrelated" false -}} {{- $posts = where $posts "Params.hidden_from_related" false -}}
{{- else -}} {{- else -}}
{{- $posts = where $posts "Params.hiddenfromrelated" "!=" true -}} {{- $posts = where $posts "Params.hidden_from_related" "!=" true -}}
{{- end -}} {{- end -}}
{{- $related := $posts.Related . | first ($params.related.count | default 5) -}} {{- $related := $posts.Related . | first ($relatedConfig.count | default 5) -}}
{{- with $related -}} {{- with $related -}}
<div class="details related-details open"> <div class="details related-details open">
<div class="details-summary related-summary"> <div class="details-summary related-summary">
@@ -20,7 +19,7 @@
<div class="details-content related-content"> <div class="details-content related-content">
<ul class="related-list"> <ul class="related-list">
{{- range $i, $p := . -}} {{- range $i, $p := . -}}
{{- $title := cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}} {{- $title := cond (.Param "capitalize_titles") (title .LinkTitle) .LinkTitle -}}
<li class="related-item"> <li class="related-item">
<a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</a> <a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</a>
{{- with .HeadingsFiltered -}} {{- with .HeadingsFiltered -}}
+7 -8
View File
@@ -1,21 +1,20 @@
{{- /* Related Content */ -}} {{- /* Related Content */ -}}
{{- /* https://gohugo.io/content-management/related/ */ -}} {{- /* https://gohugo.io/content-management/related/ */ -}}
{{- $params := partial "function/params.html" -}} {{- $relatedConfig := dict "Page" . "Key" "related" | partial "function/param.html" -}}
{{- if $relatedConfig.enable | and ("footer" | in $relatedConfig.position) | and (not .Params.password) -}}
{{- if $params.related.enable | and ("footer" | in $params.related.position) | and (not $params.password) -}}
{{- $posts := .Site.Store.Get "mainSectionPages" -}} {{- $posts := .Site.Store.Get "mainSectionPages" -}}
{{- if .Site.Params.page.hiddenFromRelated -}} {{- if .Site.Params.hidden_from_related -}}
{{- $posts = where $posts "Params.hiddenfromrelated" false -}} {{- $posts = where $posts "Params.hidden_from_related" false -}}
{{- else -}} {{- else -}}
{{- $posts = where $posts "Params.hiddenfromrelated" "!=" true -}} {{- $posts = where $posts "Params.hidden_from_related" "!=" true -}}
{{- end -}} {{- end -}}
{{- $related := $posts.Related . | first ($params.related.count | default 5) -}} {{- $related := $posts.Related . | first ($relatedConfig.count | default 5) -}}
{{- with $related -}} {{- with $related -}}
<hr class="awesome-hr" /> <hr class="awesome-hr" />
<h2 id="see-also">{{ T "single.relatedContent" }}</h2> <h2 id="see-also">{{ T "single.relatedContent" }}</h2>
<ul> <ul>
{{- range $i, $p := . -}} {{- range $i, $p := . -}}
{{- $title := cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}} {{- $title := cond (.Param "capitalize_titles") (title .LinkTitle) .LinkTitle -}}
<li> <li>
<a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</a> <a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</a>
{{- with .HeadingsFiltered -}} {{- 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" -}} {{- $author := .Store.Get "author" -}}
{{- $options := dict "Reward" $reward "Id" "fi-reward" "Author" $author.name -}} {{- $options := dict "Reward" $reward "Id" "fi-reward" "Author" $author.name -}}
{{- partial "plugin/reward.html" $options -}} {{- partial "plugin/reward.html" $options -}}
+5 -5
View File
@@ -1,11 +1,11 @@
{{- /* {{- /*
Renders an HTML details element. Renders an HTML details element.
@param {string} [class] The value of the element's class attribute. @param {String} [class] - The value of the element's class attribute.
@param {string} [name] The value of the element's name attribute. @param {String} [name] - The value of the element's name attribute.
@param {string} [summary] The content of the child summary element. @param {String} [summary] - The content of the child summary element.
@param {string} [title] The value of the element's title attribute. @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 {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 @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 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/ 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 {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 {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 {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} [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} [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} [ignore_list=""] - 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} [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 @param {String} [name] - Project name for the root node, if set to `{path}`, uses the full root path
Priority order (highest to lowest): Priority order (highest to lowest):
1. Inline content (shortcode body) - Parse tree data from shortcode body 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 3. Data files (data parameter) - Load data file from data/filetree/ directory
4. Actual Filesystem (path parameter) - Scan actual directory structure (default) 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. the shortcode will automatically fall back to the next available mode in the priority order.
@example @example
{{< file-tree "content" 2 />}} {{< 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 file="data/example.yml" />}}
{{< file-tree data="example" />}} {{< file-tree data="example" />}}
{{< file-tree >}} {{< 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 "/" -}} {{- $root := cond .IsNamedParams (.Get "path") (.Get 0) | default "/" -}}
{{- $level := cond .IsNamedParams (.Get "level") (.Get 1) -}} {{- $level := cond .IsNamedParams (.Get "level") (.Get 1) -}}
{{- $config = cond ((eq $level 0) | or $level) (dict "level" $level | merge $config) $config -}} {{- $config = cond ((eq $level 0) | or $level) (dict "level" $level | merge $config) $config -}}
{{- $level = cond (isset $config "level") ($config.level | int) 1 -}} {{- $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" -}} {{- $fileName := .Get "file" -}}
{{- $dataName := .Get "data" -}} {{- $dataName := .Get "data" -}}
{{- $supportExts := slice ".yml" ".yaml" ".json" ".toml" -}} {{- $supportExts := slice ".yml" ".yaml" ".json" ".toml" -}}
{{- $ignoreList := union (apply (split (.Get "ignoreList" | default "") ",") "trim" "." " ") $config.ignorelist -}} {{- $ignoreList := union (apply (split (.Get "ignore_list" | default (.Get "ignoreList") | default "") ",") "trim" "." " ") $config.ignore_list -}}
{{- $highlightList := apply (split (.Get "highlightList" | default "") ",") "trim" "." " " -}} {{- $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 */ -}} {{- /* Shortcode body */ -}}
{{- $content := strings.TrimSpace .Inner | default "" -}} {{- $content := strings.TrimSpace .Inner | default "" -}}
@@ -101,7 +110,7 @@
{{- /* Filesystem mode: build structured tree data from filesystem */ -}} {{- /* Filesystem mode: build structured tree data from filesystem */ -}}
{{- if not $treeData -}} {{- 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 -}} {{- with partial "function/get-file-tree.html" $buildOptions -}}
{{- $treeData = . -}} {{- $treeData = . -}}
{{- else -}} {{- else -}}
@@ -113,8 +122,8 @@
{{- $options := dict {{- $options := dict
"items" $treeData "items" $treeData
"level" $level "level" $level
"folderSlash" $folderSlash "folder_slash" $folderSlash
"ignoreList" $ignoreList "ignore_list" $ignoreList
"highlightList" $highlightList "highlight_list" $highlightList
-}} -}}
{{- partial "plugin/file-tree.html" $options -}} {{- 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 -}} {{- $options = cond .IsNamedParams (.Get "alt") (.Get 1) | .Page.RenderString | dict "Alt" | merge $options -}}
{{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}} {{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}}
{{- $options = dict "Caption" $caption | merge $options -}} {{- $options = dict "Caption" $caption | merge $options -}}
{{- $options = dict "Resources" .Page.Resources | merge $options -}} {{- $options = dict "Page" .Page "Resources" .Page.Resources | merge $options -}}
{{- $optim := slice {{- $optim := slice
(dict "Process" "resize 800x webp q75" "descriptor" "800w") (dict "Process" "resize 800x webp q75" "descriptor" "800w")
(dict "Process" "resize 1200x webp q75" "descriptor" "1200w") (dict "Process" "resize 1200x webp q75" "descriptor" "1200w")
+3 -3
View File
@@ -1,14 +1,14 @@
{{- if ne hugo.Context.MarkupScope "home" -}} {{- 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) -}} {{- $lng := cond .IsNamedParams (.Get "lng") (.Get 0) -}}
{{- $lat := cond .IsNamedParams (.Get "lat") (.Get 1) -}} {{- $lat := cond .IsNamedParams (.Get "lat") (.Get 1) -}}
{{- $zoom := cond .IsNamedParams (.Get "zoom") (.Get 2) | default 10 -}} {{- $zoom := cond .IsNamedParams (.Get "zoom") (.Get 2) | default 10 -}}
{{- $marked := cond .IsNamedParams (.Get "marked") (.Get 3) | ne false -}} {{- $marked := cond .IsNamedParams (.Get "marked") (.Get 3) | ne false -}}
{{- $markers := cond .IsNamedParams (.Get "markers") (.Get 6) | default "[]" -}} {{- $markers := cond .IsNamedParams (.Get "markers") (.Get 6) | default "[]" -}}
{{- $lightStyle := $mapbox.lightStyle -}} {{- $lightStyle := $mapbox.light_style -}}
{{- $darkStyle := $mapbox.darkStyle -}} {{- $darkStyle := $mapbox.dark_style -}}
{{- $navigation := $mapbox.navigation -}} {{- $navigation := $mapbox.navigation -}}
{{- $geolocate := $mapbox.geolocate -}} {{- $geolocate := $mapbox.geolocate -}}
{{- $scale := $mapbox.scale -}} {{- $scale := $mapbox.scale -}}
+3 -3
View File
@@ -2,9 +2,9 @@
Renders a tabbed interface with multiple tabs and their corresponding content. Renders a tabbed interface with multiple tabs and their corresponding content.
See https://fixit.lruihao.cn/documentation/content-management/shortcodes/extended/tabs/ 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 {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} [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 {String} [placement="top"] - The placement of the tabs ("top", "bottom", "left", "right")
Usage: Usage:
{{< tabs defaultTab="1" type="card" placement="top" >}} {{< 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 -}} {{- $version := .Get 0 -}}
{{- $type := .Get 1 | default "new" | lower -}} {{- $type := .Get 1 | default "new" | lower -}}
{{- $label := T (printf "version.%v" $type) | default (upper $type) -}} {{- $label := T (printf "version.%v" $type) | default (upper $type) -}}
+4 -4
View File
@@ -3,7 +3,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Locale }}"> <html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Locale }}">
<head> <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" }}'> <meta name="theme" content='FixIt {{ hugo.Store.Get "version" }}'>
{{- end }} {{- end }}
<meta charset="utf-8"> <meta charset="utf-8">
@@ -12,12 +12,12 @@
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title> <title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{- partial "base/head/index.html" . -}} {{- partial "base/head/index.html" . -}}
</head> </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 */ -}} {{- /* 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/header.html" . -}}
{{- partial "base/breadcrumb.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 }}> <main class="fi-container"{{ if (eq $toc.enable true) | and (eq $toc.position `left`) }} data-reverse{{ end }}>
{{- block "content" . }}{{ end -}} {{- block "content" . }}{{ end -}}
</main> </main>
+11 -10
View File
@@ -1,37 +1,38 @@
{{- /* {{- /*
[todo] refactor #206 [todo] refactor #206
[todo] link_guard usage in data file [todo] link guard usage in data file
Friends page template. Friends page template.
Usage: Usage:
1. Friend link items are loaded from data/friends.yml. 1. Friend link items are loaded from data/friends.yml.
2. External link guard is disabled by default on this page. 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 @example
```md ```md
--- ---
title: friends title: friends
layout: friends layout: friends
link_guard: true link:
guard:
enable: true
--- ---
``` ```
*/ -}} */ -}}
{{- define "title" -}} {{- define "title" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}} {{- cond (.Param "capitalize_titles") (title .Title) .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 -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
{{- $params := partial "function/params.html" -}} {{- $isGuarded := .Params.link.guard.enable | default false -}}
{{- $isGuarded := .Params.link_guard | default false -}}
<article class="page single special friends"> <article class="page single special friends">
<div class="header"> <div class="header">
{{- /* Title */ -}} {{- /* 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 */ -}} {{- /* 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> </div>
{{- /* Friend links */ -}} {{- /* Friend links */ -}}
@@ -59,7 +60,7 @@
{{- /* Content */ -}} {{- /* Content */ -}}
<div class="content" id="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> </div>
</article> </article>
{{- end -}} {{- end -}}
+3 -3
View File
@@ -1,6 +1,6 @@
{{- define "title" -}} {{- define "title" -}}
{{- .Params.Title | default (T "archives") -}} {{- .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 -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
@@ -53,10 +53,10 @@
{{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}} {{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}}
{{- end -}} {{- end -}}
{{- /* Use the original title after archiving the articles */ -}} {{- /* Use the original title after archiving the articles */ -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}} {{- cond (.Param "capitalize_titles") (title .Title) .Title -}}
</a> </a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'> <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> </span>
</article> </article>
{{- end -}} {{- end -}}
+6 -7
View File
@@ -1,12 +1,11 @@
{{- define "title" -}} {{- define "title" -}}
{{- .Site.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 -}} {{- printf " - %v" .Site.Params.header.subtitle.name -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
{{- $params := partial "function/params.html" -}}
{{- $profile := .Site.Params.home.profile -}} {{- $profile := .Site.Params.home.profile -}}
{{- $posts := .Site.Params.home.posts -}} {{- $posts := .Site.Params.home.posts -}}
{{- $pages := slice -}} {{- $pages := slice -}}
@@ -14,10 +13,10 @@
{{- /* Paginate calculation */ -}} {{- /* Paginate calculation */ -}}
{{- if ne $posts.enable false -}} {{- if ne $posts.enable false -}}
{{- $pages = .Site.Store.Get "mainSectionPages" -}} {{- $pages = .Site.Store.Get "mainSectionPages" -}}
{{- if .Site.Params.page.hiddenFromHomePage -}} {{- if .Site.Params.hidden_from_home_page -}}
{{- $pages = where $pages "Params.hiddenfromhomepage" false -}} {{- $pages = where $pages "Params.hidden_from_home_page" false -}}
{{- else -}} {{- else -}}
{{- $pages = where $pages "Params.hiddenfromhomepage" "!=" true -}} {{- $pages = where $pages "Params.hidden_from_home_page" "!=" true -}}
{{- end -}} {{- end -}}
{{- with $posts.paginate | default .Site.Params.paginate -}} {{- with $posts.paginate | default .Site.Params.paginate -}}
{{- $pages = $.Paginate $pages . -}} {{- $pages = $.Paginate $pages . -}}
@@ -28,7 +27,7 @@
<div class="page home{{ if ne $posts.enable false }} posts{{ end }}"> <div class="page home{{ if ne $posts.enable false }} posts{{ end }}">
{{- /* Only show profile and content on first page */ -}} {{- /* 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 */ -}} {{- /* Profile */ -}}
{{- if ne $profile.enable false -}} {{- if ne $profile.enable false -}}
{{- partial "home/profile.html" . -}} {{- partial "home/profile.html" . -}}
@@ -38,7 +37,7 @@
{{- if .Content -}} {{- if .Content -}}
<div class="single"> <div class="single">
<div class="content" id="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> </div>
</div> </div>
{{- end -}} {{- end -}}
+1 -1
View File
@@ -1,6 +1,6 @@
{{- define "title" -}} {{- define "title" -}}
{{- T "linkRedirection.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 -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
+1 -1
View File
@@ -1,6 +1,6 @@
{{- define "title" -}} {{- define "title" -}}
{{- T "offlineTitle" -}} {{- 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 -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
+10 -11
View File
@@ -1,24 +1,23 @@
{{- if .Site.Params.search.enable -}} {{- if .Site.Params.search.enable -}}
{{- $index := slice -}} {{- $index := slice -}}
{{- $pages := where .Site.RegularPages "Params.password" "eq" nil -}} {{- $pages := where .Site.RegularPages "Params.password" "eq" nil -}}
{{- if .Site.Params.page.hiddenFromSearch -}} {{- if .Param "hidden_from_search" -}}
{{- $pages = where $pages "Params.hiddenfromsearch" false -}} {{- $pages = where $pages "Params.hidden_from_search" false -}}
{{- else -}} {{- else -}}
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}} {{- $pages = where $pages "Params.hidden_from_search" "!=" true -}}
{{- end -}} {{- end -}}
{{- range $pages -}} {{- range $pages -}}
{{- $uri := .RelPermalink -}} {{- $uri := .RelPermalink -}}
{{- if $.Site.Params.search.absoluteURL -}} {{- if $.Site.Params.search.absolute_url -}}
{{- $uri = .Permalink -}} {{- $uri = .Permalink -}}
{{- end -}} {{- end -}}
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories "collections" .Params.collections -}} {{- $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 -}} {{- with .Description -}}
{{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}} {{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}}
{{- end -}} {{- end -}}
{{- $params := .Params | merge $.Site.Params.page -}}
{{/* Extended Markdown syntax */}} {{/* 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 -}} {{- if ne $.Site.Params.search.anchorify false -}}
{{- /* When anchorify is enabled (default), create separate index entries for each heading */ -}} {{- /* When anchorify is enabled (default), create separate index entries for each heading */ -}}
{{- $anchor := "" -}} {{- $anchor := "" -}}
@@ -61,8 +60,8 @@
{{- end -}} {{- end -}}
{{/* Plainify and remove (\n, \t) */}} {{/* Plainify and remove (\n, \t) */}}
{{- $contentj = $contentj | plainify | replaceRE `[\n\t ]+` " " -}} {{- $contentj = $contentj | plainify | replaceRE `[\n\t ]+` " " -}}
{{- if gt $.Site.Params.search.contentLength 0 -}} {{- if gt $.Site.Params.search.content_length 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}} {{- $contentj = substr $contentj 0 $.Site.Params.search.content_length -}}
{{- end -}} {{- end -}}
{{- if $contentj | and (ne $contentj " ") -}} {{- 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 -}} {{- $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 -}} {{- end -}}
{{/* Plainify and remove (\n, \t) */}} {{/* Plainify and remove (\n, \t) */}}
{{- $contentj = $contentj | plainify | replaceRE `[\n\t ]+` " " -}} {{- $contentj = $contentj | plainify | replaceRE `[\n\t ]+` " " -}}
{{- if gt $.Site.Params.search.contentLength 0 -}} {{- if gt $.Site.Params.search.content_length 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}} {{- $contentj = substr $contentj 0 $.Site.Params.search.content_length -}}
{{- end -}} {{- end -}}
{{- if $contentj | and (ne $contentj " ") -}} {{- if $contentj | and (ne $contentj " ") -}}
{{- $one := printf "%v:%v:%v" $uri $i $j | dict "content" $contentj "objectID" | merge $meta -}} {{- $one := printf "%v:%v:%v" $uri $i $j | dict "content" $contentj "objectID" | merge $meta -}}
+7 -8
View File
@@ -1,30 +1,29 @@
{{- define "title" -}} {{- define "title" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}} {{- cond (.Param "capitalize_titles") (title .Title) .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 -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
{{- $params := partial "function/params.html" -}}
{{- $pagefindEnabled := and .Site.Params.search.enable (eq .Site.Params.search.type "pagefind") -}} {{- $pagefindEnabled := and .Site.Params.search.enable (eq .Site.Params.search.type "pagefind") -}}
<article class="page single special"> <article class="page single special">
<div class="header"> <div class="header">
{{- /* Title */ -}} {{- /* 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 */ -}} {{- /* 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> </div>
{{- /* Content */ -}} {{- /* 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 }}> <div class="content" id="content"{{ if $pagefindEnabled }} data-pagefind-body{{ end }}>
{{- if not $params.password -}} {{- if not .Params.password -}}
{{- $content -}} {{- $content -}}
{{- end -}} {{- end -}}
</div> </div>
{{- /* Content Encryption */ -}} {{- /* 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> </article>
{{- end -}} {{- 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) -}} {{- $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" }}**_ _**{{ T "single.encryptedAbstract" }}**_
{{- else -}} {{- else -}}
{{ .RawContent | replaceRE "\n?{{% fixit-encryptor .+ %}}((\n|.)*){{% /fixit-encryptor %}}\n?" "" }} {{ .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 }} > {{ T "single.author"}}: {{ with $author.link }}[{{ $author.name }}]({{ . }}){{ else }}{{ $author.name }}{{ end }} {{/* EOL */}}
> URL: {{ .Permalink }} > URL: {{ .Permalink }} {{/* EOL */}}
{{ if $params.repost.enable | and (hasPrefix $params.repost.url "http") }}> {{ T "single.repost" }} URL: {{ $params.repost.url }}{{ end }} {{ $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" -}} {{- define "title" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}} {{- cond (.Param "capitalize_titles") (title .Title) .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 -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
{{- $title := cond (.Param "capitalizeTitles") (title .Title) .Title -}} {{- $title := cond (.Param "capitalize_titles") (title .Title) .Title -}}
{{- $params := partial "function/params.html" -}} {{- $toc := dict "Page" . "Key" "toc" | partial "function/param.html" -}}
{{- $toc := .Store.Get "toc" -}} {{- $tableOfContents := .Fragments.ToHTML ($toc.start_level | int) ($toc.end_level | int) ($toc.ordered | default false) -}}
{{- $tableOfContents := .Fragments.ToHTML ($toc.startlevel | int) ($toc.endlevel | int) ($toc.ordered | default false) -}}
{{- $showToc := $toc.enable | and (ne $tableOfContents `<nav id="TableOfContents"></nav>`) -}} {{- $showToc := $toc.enable | and (ne $tableOfContents `<nav id="TableOfContents"></nav>`) -}}
{{- .Store.Set "showToc" $showToc -}} {{- .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") -}} {{- $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" }}"> <aside class="aside-collection animate__animated animate__fadeIn animate__faster" aria-label="{{ T "collections" }}">
@@ -28,7 +27,7 @@
<div class="header"> <div class="header">
{{- /* Title */ -}} {{- /* Title */ -}}
<h1 class="single-title animate__animated animate__flipInX"{{ if $pagefindEnabled }} data-pagefind-body{{ end }}> <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 -}} {{- with $repost -}}
{{- if eq .Enable true -}} {{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share" -}} {{- $icon := dict "Class" "fa-solid fa-share" -}}
@@ -44,7 +43,7 @@
</h1> </h1>
{{- /* Subtitle */ -}} {{- /* 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> </div>
{{- /* Meta */ -}} {{- /* Meta */ -}}
@@ -55,27 +54,27 @@
</div> </div>
{{- /* TODO add disclaimer or space between meta and content */ -}} {{- /* TODO add disclaimer or space between meta and content */ -}}
<div class="post-meta-line"> <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" }}"> <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" -}} {{- dict "Class" "fa-solid fa-calendar-days me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}} {{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
</span>&nbsp; </span>&nbsp;
{{- end -}} {{- end -}}
{{- if (ne .Lastmod.Unix .PublishDate.Unix) | and $params.showLastmod -}} {{- if (ne .Lastmod.Unix .PublishDate.Unix) | and (.Param "show_lastmod") -}}
{{- with .Lastmod | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}} {{- 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" }}"> <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" -}} {{- dict "Class" "fa-regular fa-calendar-check me-1" | partial "plugin/icon.html" -}}
{{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}} {{- printf `<time datetime="%v">%v</time>` . . | safeHTML -}}
</span>&nbsp; </span>&nbsp;
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- if $params.wordCount -}} {{- if .Param "word_count" -}}
<span title="{{ T "single.wordCount" .WordCount }}"> <span title="{{ T "single.wordCount" .WordCount }}">
{{- dict "Class" "fa-solid fa-pencil-alt me-1" | partial "plugin/icon.html" -}} {{- dict "Class" "fa-solid fa-pencil-alt me-1" | partial "plugin/icon.html" -}}
{{- T "single.fuzzyWordCount" .FuzzyWordCount -}} {{- T "single.fuzzyWordCount" .FuzzyWordCount -}}
</span>&nbsp; </span>&nbsp;
{{- end -}} {{- end -}}
{{- if $params.readingTime -}} {{- if .Param "reading_time" -}}
<span> <span>
{{- dict "Class" "fa-regular fa-clock me-1" | partial "plugin/icon.html" -}} {{- dict "Class" "fa-regular fa-clock me-1" | partial "plugin/icon.html" -}}
{{- T "single.readingTime" .ReadingTime -}} {{- T "single.readingTime" .ReadingTime -}}
@@ -83,11 +82,11 @@
{{- end -}} {{- end -}}
{{- /* If the article expires, close the comment or not */ -}} {{- /* 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 {{- if
$expirationReminder.enable $expirationReminder.enable
| and (gt (div (sub now.Unix .Lastmod.Unix) 86400) ($expirationReminder.warning | default 180)) | and (gt (div (sub now.Unix .Lastmod.Unix) 86400) ($expirationReminder.warning | default 180))
| and $expirationReminder.closeComment -}} | and $expirationReminder.close_comment -}}
{{- .Store.Set "commentExpired" true -}} {{- .Store.Set "commentExpired" true -}}
{{- end -}} {{- end -}}
{{- $comment := .Store.Get "comment" | default dict -}} {{- $comment := .Store.Get "comment" | default dict -}}
@@ -110,7 +109,7 @@
<span id="{{ .RelPermalink }}" class="comment-visitors" data-flag-title="{{ $title }}"> <span id="{{ .RelPermalink }}" class="comment-visitors" data-flag-title="{{ $title }}">
{{- $visitorIcon }}<span id="twikoo_visitors">-</span>&nbsp;{{ T "single.views" }} {{- $visitorIcon }}<span id="twikoo_visitors">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp; </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 }}"> <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" }} {{- $visitorIcon }}<span id="busuanzi_value_page_pv">-</span>&nbsp;{{ T "single.views" }}
</span>&nbsp; </span>&nbsp;
@@ -139,25 +138,21 @@
</div> </div>
{{- /* Featured image */ -}} {{- /* Featured image */ -}}
{{- $image := $params.featuredimage -}} {{- $cover := dict "Page" . | partial "function/get-cover.html" -}}
{{- $matches := slice -}} {{- if $cover.Source | or (gt (len $cover.Matches) 0) -}}
{{- if .Resources.GetMatch "featured-image" -}}
{{- $matches = $matches | append "featured-image" -}}
{{- end -}}
{{- if $image | or (gt (len $matches) 0) -}}
<div class="featured-image"> <div class="featured-image">
{{- $optim := slice {{- $optim := slice
(dict "Process" "resize 800x webp" "descriptor" "800w") (dict "Process" "resize 800x webp" "descriptor" "800w")
(dict "Process" "resize 1200x webp" "descriptor" "1200w") (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> </div>
{{- end -}} {{- end -}}
{{- /* Static TOC */ -}} {{- /* Static TOC */ -}}
{{- if $showToc -}} {{- 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"> <div class="details-summary toc-title">
<span>{{ T "single.contents" }}</span> <span>{{ T "single.contents" }}</span>
<span>{{ dict "Class" "details-icon fa-solid fa-angle-right" | partial "plugin/icon.html" }}</span> <span>{{ dict "Class" "details-icon fa-solid fa-angle-right" | partial "plugin/icon.html" }}</span>
@@ -169,7 +164,7 @@
{{- end -}} {{- end -}}
{{- /* AI Summary */ -}} {{- /* AI Summary */ -}}
{{- $summaryConfig := (.Params | merge .Site.Params).postSummary -}} {{- $summaryConfig := dict "Page" . "Key" "post_summary" | partial "function/param.html" -}}
{{- if $summaryConfig.enable -}} {{- if $summaryConfig.enable -}}
<div class="ai-summary"></div> <div class="ai-summary"></div>
{{- end -}} {{- end -}}
@@ -181,9 +176,9 @@
{{- partial "single/expiration-reminder.html" . -}} {{- partial "single/expiration-reminder.html" . -}}
{{- /* Content */ -}} {{- /* 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 }}{{ with $params.endFlag }} data-end-flag="{{ . }}"{{ end }}> <div class="content" id="content"{{ if $pagefindEnabled }} data-pagefind-body{{ end }}{{ with .Param "end_flag" }} data-end-flag="{{ . }}"{{ end }}>
{{- if not $params.password -}} {{- if not .Params.password -}}
{{- $content -}} {{- $content -}}
{{- end -}} {{- end -}}
</div> </div>
@@ -195,13 +190,13 @@
{{- partial "single/related.html" . -}} {{- partial "single/related.html" . -}}
{{- /* Reward before Footer */ -}} {{- /* Reward before Footer */ -}}
{{- $reward := .Store.Get "reward" -}} {{- $reward := dict "Page" . "Key" "reward" | partial "function/param.html" -}}
{{- if eq $reward.position "before" -}} {{- if eq $reward.position "before" -}}
{{- partial "single/reward.html" . -}} {{- partial "single/reward.html" . -}}
{{- end -}} {{- end -}}
{{- /* Content Encryption */ -}} {{- /* 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 */ -}} {{- /* Collection Navigation */ -}}
{{- partial "single/collection-nav.html" . -}} {{- partial "single/collection-nav.html" . -}}
@@ -227,11 +222,11 @@
{{- /* Auto TOC */ -}} {{- /* Auto TOC */ -}}
{{- if $showToc -}} {{- 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; {{- T "single.contents" -}}&nbsp;
{{- dict "Class" "toc-icon fa-solid fa-angle-down" | partial "plugin/icon.html" -}} {{- dict "Class" "toc-icon fa-solid fa-angle-down" | partial "plugin/icon.html" -}}
</h2> </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 -}} {{- end -}}
{{- /* Custom block after post toc */ -}} {{- /* Custom block after post toc */ -}}
+5 -6
View File
@@ -1,23 +1,22 @@
{{- define "title" -}} {{- define "title" -}}
{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}} {{- cond (.Param "capitalize_titles") (title .Title) .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 -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
{{- $params := partial "function/params.html" -}}
{{- $cse := .Site.Params.cse -}} {{- $cse := .Site.Params.cse -}}
<article class="page single special search"> <article class="page single special search">
<div class="header"> <div class="header">
{{- /* Title */ -}} {{- /* 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 */ -}} {{- /* 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> </div>
{{- /* Content */ -}} {{- /* Content */ -}}
<div class="content" id="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> </div>
{{- /* Google CSE */ -}} {{- /* Google CSE */ -}}
+3 -3
View File
@@ -1,6 +1,6 @@
{{- define "title" -}} {{- define "title" -}}
{{- title (.Params.Title | default ((T .Section) | default .Section | dict "Some" | T "allSome")) -}} {{- 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 -}} {{- end -}}
{{- define "content" -}} {{- define "content" -}}
@@ -53,10 +53,10 @@
{{- if eq $repost.enable true -}} {{- if eq $repost.enable true -}}
{{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}} {{- dict "Class" "fa-solid fa-share text-success me-1" | partial "plugin/icon.html" -}}
{{- end -}} {{- end -}}
{{- cond (.Param "capitalizeTitles") (title .LinkTitle) .LinkTitle -}} {{- cond (.Param "capitalize_titles") (title .LinkTitle) .LinkTitle -}}
</a> </a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'> <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> </span>
</article> </article>
{{- end -}} {{- end -}}
+2 -2
View File
@@ -1,6 +1,6 @@
{{- $title := title (.Params.Title | default ((T .Section) | default .Section | dict "Some" | T "allSome")) -}} {{- $title := title (.Params.Title | default ((T .Section) | default .Section | dict "Some" | T "allSome")) -}}
{{- if .Site.Params.withSiteTitle -}} {{- if .Site.Params.with_site_title -}}
{{- $title = printf "%s %s %s" $title .Site.Params.titleDelimiter .Site.Title -}} {{- $title = printf "%s %s %s" $title .Site.Params.title_delimiter .Site.Title -}}
{{- end -}} {{- end -}}
{{- $config := (.Params.feed | default dict) | merge .Site.Params.section.feed | merge .Site.Params.feed -}} {{- $config := (.Params.feed | default dict) | merge .Site.Params.section.feed | merge .Site.Params.feed -}}
{{- $options := dict "Site" .Site "Config" $config "OutputFormats" .OutputFormats -}} {{- $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"> <article class="single summary" itemscope itemtype="http://schema.org/Article">
{{- /* Featured image */ -}} {{- /* Featured image */ -}}
{{- if ne .Site.Params.home.posts.imagePreview false -}} {{- if ne .Site.Params.home.posts.image_preview false -}}
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}} {{- $cover := dict "Page" . "Preview" true | partial "function/get-cover.html" -}}
{{- $matches := slice -}} {{- if $cover.Source | or (gt (len $cover.Matches) 0) -}}
{{- 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) -}}
<div class="featured-image-preview"> <div class="featured-image-preview">
<a href="{{ $.RelPermalink }}" aria-label="{{ $.Title }}"> <a href="{{ $.RelPermalink }}" aria-label="{{ $.Title }}">
{{- $optim := slice {{- $optim := slice
@@ -18,7 +10,7 @@
(dict "Process" "fill 1200x504 Center webp" "descriptor" "1200w") (dict "Process" "fill 1200x504 Center webp" "descriptor" "1200w")
(dict "Process" "fill 1600x672 Center webp" "descriptor" "1600w") (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> </a>
</div> </div>
{{- end -}} {{- end -}}
@@ -26,11 +18,11 @@
{{- /* Title */ -}} {{- /* Title */ -}}
<h2 class="single-title" itemprop="name headline"> <h2 class="single-title" itemprop="name headline">
{{- with $params.weight -}} {{- with .Params.weight -}}
{{- $icon := dict "Class" "fa-solid fa-thumbtack" -}} {{- $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 -}} {{- end -}}
{{- $repost := $params.repost | default dict -}} {{- $repost := .Params.repost | default dict -}}
{{- with $repost -}} {{- with $repost -}}
{{- if eq .Enable true -}} {{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share" -}} {{- $icon := dict "Class" "fa-solid fa-share" -}}
@@ -38,14 +30,14 @@
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span> <span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
<a href="{{ .RelPermalink }}">{{ cond (.Param "capitalizeTitles") (title .Title) .Title }}</a> <a href="{{ .RelPermalink }}">{{ cond (.Param "capitalize_titles") (title .Title) .Title }}</a>
</h2> </h2>
{{- /* Meta */ -}} {{- /* Meta */ -}}
<div class="post-meta"> <div class="post-meta">
{{- partial "single/post-author.html" . -}} {{- 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 }}'> &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 -}} {{- printf `<time datetime="%v">%v</time>` . . | dict "Date" | T "single.publishedOnDate" | safeHTML -}}
</span> </span>
@@ -57,10 +49,10 @@
{{- /* Summary content */ -}} {{- /* Summary content */ -}}
<div class="content"> <div class="content">
{{- if .Summary -}} {{- if .Summary -}}
{{- $plainify := (.Param "summaryPlainify") | default false -}} {{- $plainify := .Param "summary_plainify" | default false -}}
{{- with .Markup "home" -}} {{- with .Markup "home" -}}
{{- with .Render -}} {{- 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 -}} {{- cond $plainify ($summary | plainify) $summary -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
+2 -2
View File
@@ -1,11 +1,11 @@
{{- /* Tags Page */ -}} {{- /* Tags Page */ -}}
{{- $tagCloud := .Site.Params.tagcloud -}} {{- $tagCloud := .Site.Params.tag_cloud -}}
<div class="tags{{ with $tagCloud.enable }} tag-cloud-tags{{ end }}"> <div class="tags{{ with $tagCloud.enable }} tag-cloud-tags{{ end }}">
{{- /* Tags Cloud */ -}} {{- /* Tags Cloud */ -}}
{{- if $tagCloud.enable -}} {{- if $tagCloud.enable -}}
{{- $tags := cond (eq $tagCloud.orderby "name") $.Site.Taxonomies.tags.Alphabetical $.Site.Taxonomies.tags.ByCount -}} {{- $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 -}} {{- $minFont := $tagCloud.min | default 16 -}}
{{- $baseFont := div (sub ($tagCloud.max | default 32) $minFont) 10.0 -}} {{- $baseFont := div (sub ($tagCloud.max | default 32) $minFont) 10.0 -}}
{{- range $tags -}} {{- range $tags -}}

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