From 658f03d1e57b1c28018fc71e499c3a9e2a51e2d2 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 1 Jul 2026 22:27:08 +0800 Subject: [PATCH] refactor(params)!: flatten [params.page] to [params], snake_case keys, more page-level params support (#805) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .../content/posts/file-tree-test/index.md | 20 +- apps/test/content/posts/link-test.md | 11 +- .../content/posts/mermaid-diagrams-test.md | 2 + apps/test/hugo.toml | 11 +- archetypes/post-bundle/index.md | 18 +- archetypes/posts.md | 22 +- assets/js/lib/mermaid.ts | 37 +- assets/js/types/third-party.ts | 6 +- assets/scss/core/mixins/_media.scss | 2 +- eslint.config.ts | 1 + hugo.toml | 1574 +++++++++-------- layouts/404.html | 2 +- .../_markup/render-codeblock-file-tree.html | 38 +- layouts/_markup/render-codeblock-json.html | 9 +- layouts/_markup/render-codeblock-toggle.html | 14 +- layouts/_markup/render-heading.html | 13 +- layouts/_markup/render-image.html | 12 +- layouts/_markup/render-passthrough.html | 16 +- layouts/_partials/base/assets.html | 102 +- layouts/_partials/base/breadcrumb.html | 8 +- layouts/_partials/base/comment.html | 3 +- layouts/_partials/base/footer.html | 6 +- layouts/_partials/base/head/index.html | 21 +- layouts/_partials/base/header.html | 2 +- layouts/_partials/base/widgets.html | 20 +- layouts/_partials/custom.html | 30 +- layouts/_partials/feed/rss.html | 30 +- ...{snake2camel.html => camel-case-keys.html} | 36 +- layouts/_partials/function/camel-case.html | 17 + layouts/_partials/function/code-header.html | 4 +- .../_partials/function/get-author-map.html | 2 +- layouts/_partials/function/get-cover.html | 74 + layouts/_partials/function/get-file-tree.html | 28 +- layouts/_partials/function/get-gravatar.html | 6 +- .../_partials/function/get-taxonomy-icon.html | 6 +- layouts/_partials/function/js-build.html | 8 +- layouts/_partials/function/param.html | 28 + layouts/_partials/function/params.html | 2 - layouts/_partials/function/task-lists.html | 2 +- layouts/_partials/function/to-css.html | 8 +- layouts/_partials/gen/config.html | 12 + layouts/_partials/gen/mermaid-bootstrap.html | 14 + layouts/_partials/home/profile.html | 6 +- layouts/_partials/init/compatibility.html | 2 +- .../_partials/init/detection-deprecated.html | 107 ++ layouts/_partials/init/detection-env.html | 8 +- layouts/_partials/init/global.html | 2 +- layouts/_partials/init/index.html | 1 - layouts/_partials/init/patch.html | 38 - layouts/_partials/plugin/admonition.html | 10 +- layouts/_partials/plugin/alert.html | 6 +- layouts/_partials/plugin/analytics.html | 2 +- .../_partials/plugin/code-block-wrapper.html | 33 +- .../_partials/plugin/diagram-copy-btn.html | 2 +- layouts/_partials/plugin/echarts.html | 18 +- layouts/_partials/plugin/file-tree.html | 32 +- layouts/_partials/plugin/fixit-encryptor.html | 10 +- layouts/_partials/plugin/icon.html | 8 +- layouts/_partials/plugin/image.html | 86 +- layouts/_partials/plugin/link.html | 47 +- .../_partials/plugin/mermaid-bootstrap.html | 32 - layouts/_partials/plugin/mermaid.html | 13 +- .../_partials/plugin/pagefind-metadata.html | 9 +- layouts/_partials/plugin/post-chat-ai.html | 27 +- layouts/_partials/plugin/reward.html | 6 +- layouts/_partials/plugin/script.html | 28 +- layouts/_partials/plugin/share.html | 15 +- layouts/_partials/plugin/social.html | 8 +- layouts/_partials/plugin/style.html | 26 +- layouts/_partials/plugin/timeline.html | 22 +- .../_partials/section/recently-updated.html | 12 +- layouts/_partials/single/collection-list.html | 10 +- layouts/_partials/single/collection-nav.html | 8 +- .../_partials/single/expiration-reminder.html | 8 +- layouts/_partials/single/footer.html | 113 +- layouts/_partials/single/post-author.html | 3 +- layouts/_partials/single/related-aside.html | 15 +- layouts/_partials/single/related.html | 15 +- layouts/_partials/single/reward.html | 2 +- layouts/_shortcodes/details.html | 10 +- layouts/_shortcodes/file-tree.html | 45 +- layouts/_shortcodes/image.html | 2 +- layouts/_shortcodes/mapbox.html | 6 +- layouts/_shortcodes/tabs.html | 6 +- layouts/_shortcodes/version.html | 15 +- layouts/baseof.html | 8 +- layouts/friends.html | 21 +- layouts/home.archives.html | 6 +- layouts/home.html | 13 +- layouts/home.link.html | 2 +- layouts/home.offline.html | 2 +- layouts/home.search.json | 21 +- layouts/page.html | 15 +- layouts/page.md | 12 +- layouts/posts/single.html | 65 +- layouts/search.html | 11 +- layouts/section.html | 6 +- layouts/section.rss.xml | 4 +- layouts/summary.html | 30 +- layouts/tags.html | 4 +- layouts/taxonomies.html | 2 +- layouts/taxonomy.html | 2 +- layouts/term.html | 6 +- layouts/term.rss.xml | 4 +- 104 files changed, 1760 insertions(+), 1625 deletions(-) rename layouts/_partials/function/{snake2camel.html => camel-case-keys.html} (62%) create mode 100644 layouts/_partials/function/camel-case.html create mode 100644 layouts/_partials/function/get-cover.html create mode 100644 layouts/_partials/function/param.html delete mode 100644 layouts/_partials/function/params.html create mode 100644 layouts/_partials/gen/config.html create mode 100644 layouts/_partials/gen/mermaid-bootstrap.html delete mode 100644 layouts/_partials/init/patch.html delete mode 100644 layouts/_partials/plugin/mermaid-bootstrap.html diff --git a/apps/test/content/posts/file-tree-test/index.md b/apps/test/content/posts/file-tree-test/index.md index 6ca616c2..a112b4d7 100644 --- a/apps/test/content/posts/file-tree-test/index.md +++ b/apps/test/content/posts/file-tree-test/index.md @@ -49,7 +49,7 @@ This article tests the **File Tree** shortcode functionality in the FixIt theme. #### YAML format -{{< file-tree folderSlash=true >}} +{{< file-tree folder_slash=true >}} - name: project-root type: dir children: @@ -99,7 +99,7 @@ type = "file" TOML with folder slash and level 3: -{{< file-tree file="data/example.toml" level=3 folderSlash=true />}} +{{< file-tree file="data/example.toml" level=3 folder_slash=true />}} #### JSON format @@ -107,7 +107,7 @@ TOML with folder slash and level 3: JSON with folder slash and level 2: -{{< file-tree file="filetree/example.json" level=2 folderSlash=true />}} +{{< file-tree file="filetree/example.json" level=2 folder_slash=true />}} #### YAML format @@ -131,15 +131,15 @@ Trying the file not found case (should fallback to next mode): #### With folder slash -{{< file-tree data="example" folderSlash=true />}} +{{< file-tree data="example" folder_slash=true />}} #### With level and folder slash -{{< file-tree data="example" level=2 folderSlash=true />}} +{{< file-tree data="example" level=2 folder_slash=true />}} #### Collapsed with ignore -{{< file-tree data="example" level=0 ignoreList="README.md" />}} +{{< file-tree data="example" level=0 ignore_list="README.md" />}} ## Filesystem Mode @@ -165,13 +165,13 @@ Trying the file not found case (should fallback to next mode): {{< file-tree "assets" 0 />}} -{{< file-tree path="assets" level=2 folderSlash=true />}} +{{< file-tree path="assets" level=2 folder_slash=true />}} {{< file-tree "assets" -1 />}} ### With ignore lists -{{< file-tree ignoreList=".hugo_build.lock, public, resources, node_modules" level=2 folderSlash=true />}} +{{< file-tree ignore_list=".hugo_build.lock, public, resources, node_modules" level=2 folder_slash=true />}} ### root not exist @@ -220,7 +220,7 @@ type = "file" ### With parameters -```file-tree {level=2 folderSlash=true ignoreList="config.local.js"} +```file-tree {level=2 folder_slash=true ignore_list="config.local.js"} - name: project type: dir children: @@ -242,7 +242,7 @@ type = "file" ### Fully expanded -```file-tree {level=-1 folderSlash=true} +```file-tree {level=-1 folder_slash=true} - name: backend type: dir children: diff --git a/apps/test/content/posts/link-test.md b/apps/test/content/posts/link-test.md index 9b181bae..badaaa8f 100644 --- a/apps/test/content/posts/link-test.md +++ b/apps/test/content/posts/link-test.md @@ -7,11 +7,12 @@ categories: - Markdown tags: - Link -link_guard: - enable: true - # mode: redirect - allow_domains: - - demo.fixit.lruihao.cn +link: + guard: + enable: true + # mode: redirect + allow_domains: + - demo.fixit.lruihao.cn --- This post validates link rendering paths in FixIt, including Markdown render hook and link shortcode modes. diff --git a/apps/test/content/posts/mermaid-diagrams-test.md b/apps/test/content/posts/mermaid-diagrams-test.md index c652989f..afb8117b 100644 --- a/apps/test/content/posts/mermaid-diagrams-test.md +++ b/apps/test/content/posts/mermaid-diagrams-test.md @@ -9,6 +9,8 @@ categories: tags: - Mermaid - Diagrams +mermaid: + zenuml: https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.min.mjs --- The FixIt theme supports two ways to use Mermaid: code block syntax and shortcode syntax. diff --git a/apps/test/hugo.toml b/apps/test/hugo.toml index abbc3448..dccefeec 100644 --- a/apps/test/hugo.toml +++ b/apps/test/hugo.toml @@ -43,10 +43,12 @@ _merge = "shallow" [params] version = "1.0.X" +collection_list = true +collection_navigation = true [params.home.profile] enable = true -avatarURL = "/images/fixit-test.png" +avatar_url = "/images/fixit-test.png" [params.social] @@ -60,15 +62,8 @@ weight = 1 # for twitter cards # site = "hugo-fixit" -[params.page] -collectionList = true -collectionNavigation = true - [params.author] name = "Lruihao" email = "" link = "https://lruihao.cn" avatar = "https://lruihao.cn/images/avatar.jpg" - -[params.mermaid] -zenuml = "https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.min.mjs" diff --git a/archetypes/post-bundle/index.md b/archetypes/post-bundle/index.md index 02d7bc84..0908a04c 100644 --- a/archetypes/post-bundle/index.md +++ b/archetypes/post-bundle/index.md @@ -4,23 +4,15 @@ subtitle: date: {{ .Date }} slug: {{ substr .File.UniqueID 0 7 }} draft: true -author: - name: - link: - email: - avatar: description: keywords: -comment: false weight: 0 -tags: - - draft categories: - draft -hiddenFromHomePage: false -hiddenFromSearch: false -hiddenFromRelated: false -hiddenFromFeed: false +collections: + - draft +tags: + - draft summary: resources: - name: featured-image @@ -33,7 +25,7 @@ repost: enable: false url: -# See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter +# See: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter --- diff --git a/archetypes/posts.md b/archetypes/posts.md index a0450bb6..b305c808 100644 --- a/archetypes/posts.md +++ b/archetypes/posts.md @@ -4,33 +4,25 @@ subtitle: date: {{ .Date }} slug: {{ substr .File.UniqueID 0 7 }} draft: true -author: - name: - link: - email: - avatar: description: keywords: -comment: false weight: 0 -tags: - - draft categories: - draft -hiddenFromHomePage: false -hiddenFromSearch: false -hiddenFromRelated: false -hiddenFromFeed: false +collections: + - draft +tags: + - draft summary: -featuredImagePreview: -featuredImage: +featured_image: +featured_image_preview: password: message: repost: enable: false url: -# See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter +# See: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter --- diff --git a/assets/js/lib/mermaid.ts b/assets/js/lib/mermaid.ts index 8579aba4..f6cfc895 100644 --- a/assets/js/lib/mermaid.ts +++ b/assets/js/lib/mermaid.ts @@ -43,13 +43,6 @@ interface RenderOptions { darkMode: boolean } -interface MermaidBootstrapOptions { - mermaidSource: string - zenumlSource?: string - layoutLoaderSources?: string[] - config: MermaidConfig -} - let mermaid: MermaidRuntimeModule | null = null let config: MermaidConfig = {} let hasBoundGlobalEvents = false @@ -179,8 +172,12 @@ function isRenderContextActive(el: Element): boolean { return false const panel = el.closest('.tab-panel') - if (panel instanceof HTMLElement && panel.hidden) - return false + if (panel) { + // tab-container uses slot-based hiding; check actual layout visibility + const panelRect = panel.getBoundingClientRect() + if (panelRect.width === 0 && panelRect.height === 0) + return false + } return true } @@ -231,11 +228,11 @@ function ensureMermaidInitialized(theme: string, darkMode: boolean): void { startOnLoad: false, darkMode, theme, - securityLevel: config.securitylevel, + securityLevel: config.securityLevel, look: config.look, layout: config.layout, - fontFamily: config.fontfamily, - altFontFamily: config.fontfamily, + fontFamily: config.fontFamily, + altFontFamily: config.fontFamily, }) } @@ -271,7 +268,7 @@ async function renderMermaidElement(el: Element | null, options: RenderOptions): try { const result = await mermaid.render(id, source, el) const svg = result?.svg ?? '' - el.innerHTML = svg + svg && (el.innerHTML = svg) if (typeof result?.bindFunctions === 'function') { try { result.bindFunctions(el) @@ -681,6 +678,12 @@ function bindTabContainerChanged(): void { if (!panel) return observeMermaidContainers(panel, true) + // Also schedule neutral layer render for the newly visible panel + const neutralNodes = panel.querySelectorAll('.mermaid-neutral') + neutralNodes.forEach((el) => { + if (!el.hasAttribute('data-processed')) + void renderMermaidElement(el, { theme: 'neutral', darkMode: false }) + }) }, false) } @@ -856,10 +859,12 @@ function unwrapModule(mod: { default?: T } | T): T { /** * Bootstrap entry used by template-injected script. * Loads Mermaid and optional extensions via dynamic import and hands runtime to initMermaidRuntime. - * @param options Bootstrap options provided by template-injected script. */ -export async function bootstrapMermaid(options: MermaidBootstrapOptions): Promise { - const { mermaidSource, zenumlSource = '', layoutLoaderSources = [], config } = options +export async function bootstrapMermaid(): Promise { + config = window.config?.mermaid ?? {} + const mermaidSource = config.cdn || 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs' + const zenumlSource = config.zenuml || '' + const layoutLoaderSources = config.layoutLoaders || [] try { // Mermaid core module is required; optional modules degrade gracefully. diff --git a/assets/js/types/third-party.ts b/assets/js/types/third-party.ts index 72200bd8..f461046a 100644 --- a/assets/js/types/third-party.ts +++ b/assets/js/types/third-party.ts @@ -3,10 +3,10 @@ export interface MermaidConfig { cdn?: string zenuml?: string themes?: string[] - securitylevel?: string + securityLevel?: string look?: string - fontfamily?: string - layoutloaders?: string[] + fontFamily?: string + layoutLoaders?: string[] layout?: string } diff --git a/assets/scss/core/mixins/_media.scss b/assets/scss/core/mixins/_media.scss index cdc425de..888d68a9 100644 --- a/assets/scss/core/mixins/_media.scss +++ b/assets/scss/core/mixins/_media.scss @@ -1,4 +1,4 @@ -// FixIt Responsive breakpoints system design +// FixIt responsive breakpoints system design // ┌──────┬───────────┬───────────┬──────────────┐ // │ Name │ min-width │ max-width │ Direction │ // ├──────┼───────────┼───────────┼──────────────┤ diff --git a/eslint.config.ts b/eslint.config.ts index 6c5666e3..fd8af8c8 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -4,6 +4,7 @@ export default antfu({ typescript: true, ignores: [ 'node_modules/**', + 'archetypes/**', 'assets/css/unocss.css', 'assets/lib/**', 'public/**', diff --git a/hugo.toml b/hugo.toml index 965c7975..a6695767 100644 --- a/hugo.toml +++ b/hugo.toml @@ -80,17 +80,17 @@ url = "/archives/" title = "" weight = 1 -# FixIt 0.2.14 | NEW add user-defined content to menu items +# add user-defined content to menu items [menus.main.params] # add css class to a specific menu item class = "" # whether set as a draft menu item whose function is similar to a draft post/page draft = false -# FixIt 0.2.16 | NEW add fontawesome icon to a specific menu item +# add fontawesome icon to a specific menu item icon = "fa-solid fa-archive" -# FixIt 0.2.16 | NEW set menu item type, optional values: ["mobile", "desktop"] +# set menu item type, optional values: ["mobile", "desktop"] type = "" -# FixIt 0.3.9 | NEW whether to show the submenu item divider line +# whether to show the submenu item divider line divided = false [[menus.main]] @@ -322,7 +322,7 @@ privacyEnhanced = true [outputFormats] -# FixIt 0.3.0 | NEW Options to make output /archives/index.html file +# Options to make output /archives/index.html file [outputFormats.archives] path = "archives" baseName = "index" @@ -332,7 +332,7 @@ isHTML = true permalinkable = true notAlternative = true -# FixIt 0.3.0 | NEW Options to make output /offline/index.html file +# Options to make output /offline/index.html file [outputFormats.offline] path = "offline" baseName = "index" @@ -342,7 +342,7 @@ isHTML = true permalinkable = true notAlternative = true -# Fixit 1.0.0 | NEW Options to make output /link/index.html file +# Options to make output /link/index.html file [outputFormats.link] path = "link" baseName = "index" @@ -352,7 +352,7 @@ isHTML = true permalinkable = true notAlternative = true -# FixIt 0.3.0 | NEW Options to make output readme.md file +# Options to make output readme.md file [outputFormats.readme] baseName = "readme" mediaType = "text/markdown" @@ -360,7 +360,7 @@ isPlainText = true isHTML = false notAlternative = true -# FixIt 0.3.0 | CHANGED Options to make output baidu_urls.txt file +# Options to make output baidu_urls.txt file [outputFormats.baidu_urls] baseName = "baidu_urls" mediaType = "text/plain" @@ -368,7 +368,7 @@ isPlainText = true isHTML = false notAlternative = true -# FixIt 0.3.10 | NEW Options to make output search.json file +# Options to make output search.json file [outputFormats.search] baseName = "search" mediaType = "application/json" @@ -377,7 +377,7 @@ isPlainText = true isHTML = false permalinkable = true -# FixIt 1.0.0 | NEW Options to make output site.webmanifest file +# Options to make output site.webmanifest file [outputFormats.manifest] baseName = "site" mediaType = "application/manifest+json" @@ -434,47 +434,115 @@ collection = "collections" # ------------------------------------------------------------------------------------- # Theme Core Configuration +# Two types of params: +# 1. Site-level params — apply to the entire site, can NOT be overridden per-page. +# 2. Page-level params — can be overridden per-page via page front matter. +# # See: https://fixit.lruihao.cn/documentation/basics/#theme-configuration # ------------------------------------------------------------------------------------- [params] -# FixIt 0.2.15 | CHANGED FixIt theme version +# FixIt theme version version = "1.0.X" # e.g. "0.4.X", "0.4.5", "v1.0.0" etc. # site description description = "" # site keywords keywords = [] # site default theme ["light", "dark", "auto"] -defaultTheme = "auto" +default_theme = "auto" # which hash function used for SRI, when empty, no SRI is used # ["sha256", "sha384", "sha512", "md5"] fingerprint = "" # date format -dateFormat = "2006-01-02" +date_format = "2006-01-02" # website images for Open Graph and Twitter Cards images = [] -# FixIt 0.3.13 | NEW whether to capitalize titles -capitalizeTitles = true -# FixIt 0.3.0 | NEW whether to add site title to the title of every page +# whether to add site title to the title of every page # remember to set up your site title in `hugo.toml` (e.g. title = "title") -withSiteTitle = true -# FixIt 0.3.0 | NEW title delimiter when the site title is be added to the title of every page -titleDelimiter = "-" -# FixIt 0.3.0 | NEW whether to add site subtitle to the title of index page +with_site_title = true +# title delimiter when the site title is be added to the title of every page +title_delimiter = "-" +# whether to add site subtitle to the title of index page # remember to set up your site subtitle by `params.header.subtitle.name` -indexWithSubtitle = false -# FixIt 0.3.13 | NEW whether to show summary in plain text -summaryPlainify = false -# FixIt 0.4.0 | NEW whether to enable merging missing translations from other languages +index_with_subtitle = false +# whether to enable merging missing translations from other languages # when set to true, missing translations from other languages will be merged and displayed # default is false for better performance, especially for single-language sites # set to true if your site has multiple languages and you want to show all content -enableTranslationMerge = false -# FixIt 0.4.4 | NEW whether to enable tooltip replacement for elements with title attribute, such as footnote references +enable_translation_merge = false +# whether to enable tooltip replacement for elements with title attribute, such as footnote references tooltip = true -# FixIt 0.2.14 | NEW FixIt will, by default, inject a theme meta tag in the HTML head on the home page only. +# FixIt will, by default, inject a theme meta tag in the HTML head on the home page only. # you can turn it off, but we would really appreciate if you don't, as this is a good way to watch FixIt's popularity on the rise. -disableThemeInject = false +disable_theme_inject = false + +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# Page-level params +# All params and sections below can be used in page front matter to override per-page. +# +# Example front matter: +# --- +# capitalize_titles: false +# hidden_from_home_page: true +# toc: +# enable: true +# math: +# enable: true +# comment: +# enable: false +# --- +# +# See: https://fixit.lruihao.cn/documentation/content-management/front-matter +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +# whether to capitalize titles +capitalize_titles = true +# whether to show summary in plain text +summary_plainify = false +# whether to enable the author's avatar of the post +author_avatar = true +# whether to hide a page from home page +hidden_from_home_page = false +# whether to hide a page from search results +hidden_from_search = false +# whether to hide a page from related posts +hidden_from_related = false +# whether to hide a page from RSS, Atom and JSON feed +hidden_from_feed = false +# whether to enable twemoji +twemoji = false +# whether to enable lightgallery +# set to true, images in the content will be shown as the gallery if the image has a title, e.g. ![alt](src "title") +# set to "force", images in the content will be forced to shown as the gallery regardless of the image has a title or not, e.g. ![alt](src) +# [todo] change gallery engine in the future +lightgallery = false +# whether to enable the ruby extended syntax +ruby = true +# whether to enable the fraction extended syntax +fraction = true +# whether to enable the fontawesome extended syntax +fontawesome = true +# license info (HTML format is supported) +license = 'CC BY-NC-SA 4.0' +# Page style ["narrow", "normal", "wide", ...] +page_style = "normal" +# Auto Bookmark Support +# if true, save the reading progress when closing the page. +auto_bookmark = false +# whether to show the last modified time +show_lastmod = true +# whether to enable wordCount +word_count = true +# whether to enable readingTime +reading_time = true +# whether to enable instant.page +instant_page = false +# whether to enable collection list at the sidebar +collection_list = false +# whether to enable collection navigation at the end of the post +collection_navigation = false +# end of post flag +end_flag = "" # Author Configuration [params.author] @@ -483,8 +551,572 @@ email = "" link = "" avatar = "" -# FixIt 0.3.0 | NEW public Git repository information only then enableGitInfo is true -[params.gitInfo] +# Link config +[params.link] +# whether to add external Icon for external links automatically +external_icon = true + +# External link guard config +[params.link.guard] +enable = false +# external link guard mode, available modes: ["modal", "redirect"] +# in "modal" mode, a dialog will pop up to ask for confirmation when users click external links +# in "redirect" mode, users will be redirected to an intermediate page before visiting external links +mode = "modal" +# allowed domains (exact host or parent domain) will skip confirmation +allow_domains = [] + +# Image config +# combined with Hugo's image processing option `imaging` for image optimisation +[params.image] +# cache remote images for better optimisations +cache_remote = false +# Image resizing and optimisation (may slow builds) +optimise = false +# A list of image file names or patterns to exclude from optimisation +# e.g. ["no-optimize.jpg", "*.tiff", "images/exclude-*.webp"] +black_list = [] + +# Code block wrapper config +# you can override the global config via Markdown attributes, for example: +# ```lang {mode="mac", max_shown_lines=5} +# code here +# ``` +[params.codeblock] +# whether to enable the code block wrapper +wrapper = true +# code block mode +# available modes: ["classic", "mac", "simple", ...] +# if you set to custom value, you need to create a custom CSS for data-mode attribute +mode = "classic" +# additional classes for the code block wrapper +# e.g. "is-collapsed is-expanded line-nos-hidden line-wrapping" +wrapper_class = "" +# the maximum number of lines to show in the code block preview +max_shown_lines = 10 +# whether to show shadow effect for code blocks, available values: ["always", "hover", "never"] +shadow = "never" +# whether to enable code copy button +copyable = true +# [classic] whether to enable code download button in the code block header +downloadable = false +# [classic] whether to enable code fullscreen button in the code block header +fullscreen = false +# [classic] whether to enable line numbers toggle button in the code block header +line_nos_toggler = true +# [classic] whether to enable toggle line wrapping button in the code block header +line_wrap_toggler = true +# [classic][Experimental] whether to enable code edit button in the code block header +editable = false + +# JSON Viewer config +# See https://github.com/Lruihao/json-viewer-element +[params.json_viewer] +enable = true +expand_depth = 1 +copyable = true +sort = false +boxed = true + +# File tree config +# See https://fixit.lruihao.cn/documentation/content-management/shortcodes/extended/file-tree/ +[params.filetree] +# the expand level of the tree (expand all: -1, collapse all: 0) +level = 1 +# whether to append a trailing "/" to folder names +folder_slash = false +# list of file or folder names to ignore +ignore_list = [] +# list of file or folder names to highlight +highlight_list = [] + +# Mermaid config +# See http://fixit.lruihao.cn/documentation/content-management/diagrams-support/mermaid/ +[params.mermaid] +# whether to enable the Mermaid wrapper +# When enabled, Mermaid diagrams are wrapped with diagram tabs and actions: +# - pan/zoom (drag & ctrl+wheel) +# - reset view +# - download as SVG +wrapper = true +# Mermaid ESM module CDN source +# default is https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs +cdn = "" +# ZenUML ESM module CDN source +# default is empty, you can set it to a CDN source to enable ZenUML support +# e.g. https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.min.mjs +zenuml = "" +# for values, see https://mermaid.js.org/config/theming.html#available-themes +themes = [ + "default", + "dark" +] +# The security level for Mermaid diagrams +# optional values: ["strict", "loose", "antiscript", "sandbox"] +security_level = "loose" +# The appearance style for Mermaid diagrams +# optional values: ["classic", "handDrawn"] +look = "handDrawn" +# Specifies the font to be used in the rendered diagrams +font_family = "" +# Layout loaders from ESM module CDN sources (e.g., ELK layout engine) +# Example: ["https://cdn.jsdelivr.net/npm/@mermaid-js/layout-elk/dist/mermaid-layout-elk.esm.min.mjs"] +# this will enable additional layout options: ["elk", "elk.layered", "elk.stress", "elk.force", "elk.mrtree"] +layout_loaders = [] +# default layout algorithm for rendering diagrams +# available options: "dagre" (default), "elk", "elk.layered", "elk.stress", "elk.force", "elk.mrtree" +# note: ELK layouts require layout_loaders to be configured first +layout = "dagre" + +# Table of the contents config +[params.toc] +# whether to enable the table of the contents +enable = true +# whether to keep the static table of the contents in front of the post +keep_static = false +# whether to make the table of the contents in the sidebar automatically collapsed +auto = true +# position of TOC ["left", "right"] +position = "right" +# supersede `markup.tableOfContents` settings +ordered = false +start_level = 2 +end_level = 6 +# whether to decrease the H1 heading level in content +decrease_h1 = false + +# Display a message at the beginning of an article to warn the reader that its content might be expired +[params.expiration_reminder] +enable = false +# display the reminder if the last modified time is more than 90 days ago +reminder = 90 +# display warning if the last modified time is more than 180 days ago +warning = 180 +# if the article expires, close the comment or not +close_comment = false + +# page heading config +[params.heading] +# whether to capitalize automatic text of headings +capitalize = false + +# must set `params.toc.ordered` to true +[params.heading.number] +# whether to enable auto heading numbering +enable = false +# only enable in main section pages (default is posts) +only_main_section = true + +[params.heading.number.format] +h1 = "{title}" +h2 = "{h2} {title}" +h3 = "{h2}.{h3} {title}" +h4 = "{h2}.{h3}.{h4} {title}" +h5 = "{h2}.{h3}.{h4}.{h5} {title}" +h6 = "{h2}.{h3}.{h4}.{h5}.{h6} {title}" + +# mathematical formulas configuration +# See http://fixit.lruihao.cn/documentation/content-management/markdown-syntax/extended/#formula +[params.math] +enable = true +# mathematical formulas rendering engines, optional values: ["katex", "mathjax"] +type = "katex" + +# KaTeX server-side rendering (https://katex.org) +# KaTeX partial config: https://gohugo.io/functions/transform/tomath/#options +[params.math.katex] +# KaTeX extension copy-tex +copy_tex = true +throw_on_error = false +error_color = "#ff4949" + +# custom macros map +# syntax: = +[params.math.katex.macros] +# "\\f" = "#1f(#2)" # usage: $\f{a}{b}$ + +# MathJax server-side rendering (https://www.mathjax.org) +# MathJax config: https://docs.mathjax.org/en/latest/options/index.html +[params.math.mathjax] +cdn = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" + +[params.math.mathjax.packages] +# "[+]" = ["configmacros"] + +# custom macros map +# syntax: = +[params.math.mathjax.macros] +# bold = ["{\\bf #1}", 1] # usage: $\bold{math}$ + +[params.math.mathjax.loader] +load = [ "ui/safe" ] + +[params.math.mathjax.loader.paths] +# custom = "https://cdn.jsdelivr.net/gh/sonoisa/XyJax-v3@3.0.1/build/" + +# more loader config e.g source, dependencies, provides etc. + +[params.math.mathjax.options] +enable_menu = true +# HTML tags that won't be searched for math +skip_html_tags = [ + "script", + "noscript", + "style", + "textarea", + "pre", + "code", + "math", + "select", + "option", + "mjx-container" +] +# class that marks tags not to search +ignore_html_class = "mathjax_ignore" + +# HTML tags that can appear within math +[params.math.mathjax.options.include_html_tags] +# "#comment" = "" +# br = "\n" +# wbr = "" + +# Mapbox GL JS config (https://docs.mapbox.com/mapbox-gl-js) +[params.mapbox] +# access token of Mapbox GL JS +access_token = "" +# style for the light theme +light_style = "mapbox://styles/mapbox/light-v11" +# style for the dark theme +dark_style = "mapbox://styles/mapbox/dark-v11" +# whether to add NavigationControl +navigation = true +# whether to add GeolocateControl +geolocate = true +# whether to add ScaleControl +scale = true +# whether to add FullscreenControl +fullscreen = true + +# PostChat AI config +# based on your posts to build a knowledge base, support AI summary, AI search, and AI Chatbot. +# get PostChat Key from my invitation link, thanks for your support! +# https://ai.zhheo.com/console/login?InviteID=85041330 +[params.post_chat] +enable = false +key = "" +# how users initiate chats: ["iframe", "magic"] +user_mode = "iframe" +add_button = true +default_input = false +left = "" +bottom = "" +width = "" +height = "" +fill = "" +background_color = "" +upload_web = true +show_invite_link = true +user_title = "" +user_desc = "" +# dom container to be blacked out, e.g. [".aplayer"] +black_dom = [] +# only for iframe mode +frame_width = "" # e.g. "375px" +frame_height = "" # e.g. "600px" +# only for magic mode +user_icon = "" +default_chat_questions = [] +default_search_questions = [] +hot_words = true + +# Summary AI config +# See https://ai.zhheo.com/docs/summary.html +[params.post_summary] +enable = false +# if you set `params.post_chat.key`, you don't need to set `params.post_summary.key` +key = "" +title = "" +# themes options: ["", "simple", "yanzhi", "menghuan"] +theme = "" +post_url = "" +blacklist = "" +word_limit = 1000 +typing_animate = true +beginning_text = "" +loading_text = true + +# Podcast AI config +# See https://ai.zhheo.com/docs/podcast.html +[params.podcast] +enable = false + +# Related content config (https://gohugo.io/content-management/related/) +[params.related] +enable = false +count = 5 +# position of related content, optional values: ["aside", "footer"] +position = [ + "aside", + "footer" +] + +# Donate (Sponsor) settings +[params.reward] +enable = false +animation = false +# position relative to post footer, optional values: ["before", "after"] +position = "after" +# comment = "Buy me a coffee" +# display mode of QR code images, optional values: ["static", "fixed"], default: `static` +mode = "static" + +[params.reward.ways] +# wechatpay = "/images/wechatpay.png" +# alipay = "/images/alipay.png" +# paypal = "/images/paypal.png" +# bitcoin = "/images/bitcoin.png" + +# Post footer link config +[params.post_link] +# whether to show link to Raw Markdown content +markdown = true +# whether to show link to view source code (requires git_info.repo) +source = true +# whether to show link to edit the post (requires git_info.repo) +edit = true +# whether to show link to report issue (requires git_info.repo) +report = true +# open in editor protocol (e.g. "vscode", "trae" etc.), empty to disable +editor = "vscode" + +# Social share links in post page +[params.share] +enable = true +Twitter = true +Facebook = true +Linkedin = false +Whatsapp = false +Pinterest = false +Tumblr = false +HackerNews = false +Reddit = false +VK = false +Buffer = false +Xing = false +Line = false +Instapaper = false +Pocket = false +Flipboard = false +Weibo = true +Myspace = false +Blogger = false +Baidu = false +Odnoklassniki = false +Evernote = false +Skype = false +Trello = false +Mix = false + +# Comment config +[params.comment] +enable = false + +# Artalk comment config (https://artalk.js.org/) +[params.comment.artalk] +enable = false +server = "https://yourdomain" +site = "默认站点" +# prefer remote (backend) configuration over local +# If true, remote config takes priority; if false (default), local config overrides remote +prefer_remote_conf = false +placeholder = "" +no_comment = "" +send_btn = "" +editor_travel = true +flat_mode = "auto" +# enable lightgallery support +lightgallery = false +locale = "" +emoticons = "" +nest_max = 2 +nest_sort = "DATE_ASC" # ["DATE_ASC", "DATE_DESC", "VOTE_UP_DESC"] +vote = true +vote_down = false +ua_badge = true +list_sort = true +list_unread_highlight = false +img_upload = true +img_lazy_load = false # false | "native" | "data-src" +preview = true +version_check = true +# request timeout in milliseconds +req_timeout = 15000 +# page view increment on comment list load +pv_add = true + +# pagination config +[params.comment.artalk.pagination] +page_size = 20 +read_more = true +auto_load = true + +# height limit config +[params.comment.artalk.height_limit] +content = 300 +children = 400 +scrollable = false + +# Disqus comment config (https://disqus.com) +[params.comment.disqus] +enable = false +# Disqus shortname to use Disqus in posts +shortname = "" + +# Gitalk comment config (https://github.com/gitalk/gitalk) +[params.comment.gitalk] +enable = false +owner = "" +repo = "" +client_id = "" +client_secret = "" + +# Valine comment config (https://github.com/xCss/Valine) +[params.comment.valine] +enable = false +app_id = "" +app_key = "" +placeholder = "" +avatar = "mp" +meta = [ + 'nick', + 'mail', + 'link' +] +required_fields = [] +page_size = 10 +lang = "" +visitor = true +record_ip = true +highlight = true +enable_qq = false +server_urls = "" +# emoji data file name, default is "google.yml" +# ["apple.yml", "google.yml", "facebook.yml", "twitter.yml"] +# located in "themes/FixIt/assets/lib/valine/emoji/" directory +# you can store your own data files in the same path under your project: +# "assets/lib/valine/emoji/" +emoji = "" +comment_count = true + +# Waline comment config (https://waline.js.org) +[params.comment.waline] +enable = false +server_url = "" +pageview = false +emoji = [ "//unpkg.com/@waline/emojis@1.1.0/weibo" ] +meta = [ + "nick", + "mail", + "link" +] +required_meta = [] +login = "enable" +word_limit = 0 +page_size = 10 +image_uploader = false +highlighter = false +comment = false +tex_renderer = false +search = false +recaptcha_v3_key = "" +turnstile_key = "" +reaction = false + +# Facebook comment config (https://developers.facebook.com/docs/plugins/comments) +[params.comment.facebook] +enable = false +width = "100%" +num_posts = 10 +app_id = "" +language_code = "" + +# Telegram comments config (https://comments.app) +[params.comment.telegram] +enable = false +site_id = "" +limit = 5 +height = "" +color = "" +colorful = true +dislikes = false +outlined = false + +# Commento comment config (https://commento.io) +[params.comment.commento] +enable = false + +# Utterances comment config (https://utteranc.es) +[params.comment.utterances] +enable = false +# owner/repo +repo = "" +issue_term = "pathname" +label = "" +light_theme = "github-light" +dark_theme = "github-dark" + +# Twikoo comment config (https://twikoo.js.org/) +[params.comment.twikoo] +enable = false +env_id = "" +region = "" +path = "" +visitor = true +comment_count = true +lang = "" +# enable lightgallery support +lightgallery = false +# enable Katex support +katex = false + +# Giscus comments config +[params.comment.giscus] +enable = false +repo = "" +repo_id = "" +category = "" +category_id = "" +mapping = "" +# Or set it to your self-hosted domain +origin = "https://giscus.app" +strict = "0" +term = "" +reactions_enabled = "1" +emit_metadata = "0" +input_position = "bottom" # ["top", "bottom"] +lang = "" +light_theme = "light" +dark_theme = "dark" +lazy_load = true + +# Third-party library config +[params.library] + +[params.library.css] +# someCSS = "some.css" +# located in "assets/" +# Or +# someCSS = "https://cdn.example.com/some.css" + +[params.library.js] +# someJavascript = "some.js" +# located in "assets/" +# Or +# someJavascript = "https://cdn.example.com/some.js" +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +# public Git repository information only then enableGitInfo is true +[params.git_info] # e.g. "https://github.com/hugo-fixit/docs" repo = "" branch = "main" @@ -492,9 +1124,9 @@ branch = "main" dir = "content" # the issue template for reporting issue of the posts # available template params: {title} {URL} {sourceURL} -issueTpl = "title=[BUG]%20{title}&body=|Field|Value|%0A|-|-|%0A|Title|{title}|%0A|URL|{URL}|%0A|Filename|{sourceURL}|" +issue_tpl = "title=[BUG]%20{title}&body=|Field|Value|%0A|-|-|%0A|Title|{title}|%0A|URL|{URL}|%0A|Filename|{sourceURL}|" -# FixIt 1.0.0 | CHANGED App and PWA config +# App and PWA config [params.app] # whether to enable PWA support pwa = false @@ -539,56 +1171,56 @@ enable = true # type of search engine ["fuse", "algolia", "pagefind", "cse"] type = "fuse" # max index length of the chunked content -contentLength = 4000 +content_length = 4000 # placeholder of the search bar placeholder = "" # max number of results length -maxResultLength = 10 +max_result_length = 10 # snippet length of the result -snippetLength = 30 +snippet_length = 30 # HTML tag name of the highlight part in results -highlightTag = "em" +highlight_tag = "em" # whether to use the absolute URL based on the baseURL in search index -absoluteURL = false -# FixIt 0.4.0 | NEW whether to enable anchorify for headings in search results +absolute_url = false +# whether to enable anchorify for headings in search results anchorify = true [params.search.algolia] index = "" -appID = "" -searchKey = "" +app_id = "" +search_key = "" -# FixIt 0.2.17 | NEW https://fusejs.io/api/options.html +# https://fusejs.io/api/options.html [params.search.fuse] -isCaseSensitive = false -minMatchCharLength = 2 -findAllMatches = false +is_case_sensitive = false +min_match_char_length = 2 +find_all_matches = false location = 0 threshold = 0.3 distance = 100 -ignoreLocation = false -useExtendedSearch = false -ignoreFieldNorm = false +ignore_location = false +use_extended_search = false +ignore_field_norm = false # Pagefind search config (http://pagefind.app/) [params.search.pagefind] # Pagefind bundle and index directory -bundlePath = "pagefind/" +bundle_path = "pagefind/" # debounce timeout in milliseconds, set to 0 to disable debounce -debounceTimeoutMs = 300 +debounce_timeout_ms = 300 # whether to respect FixIt built-in search visibility rules -useBuiltInFilters = true +use_built_in_filters = true # optional sort field: ["date", "title"] -sortBy = "" -# sort order for sortBy: ["asc", "desc"] -sortOrder = "desc" +sort_by = "" +# sort order for sort_by: ["asc", "desc"] +sort_order = "desc" -# FixIt 0.3.16 | NEW Custom Search Engine (CSE) +# Custom Search Engine (CSE) [params.cse] # search engine: ["google", "bing"] engine = "google" # search results page URL (layout: search) -resultsPage = "/search/" +results_page = "/search/" # Google Custom Search Engine Context # See: https://programmablesearchengine.google.com/ @@ -602,11 +1234,11 @@ cx = "" # Header config [params.header] -# FixIt 0.2.13 | CHANGED desktop header mode ["sticky", "normal", "auto"] -desktopMode = "sticky" -# FixIt 0.2.13 | CHANGED mobile header mode ["sticky", "normal", "auto"] -mobileMode = "auto" -# FixIt 1.0.0 | NEW whether to enable header blur effect +# desktop header mode ["sticky", "normal", "auto"] +desktop_mode = "sticky" +# mobile header mode ["sticky", "normal", "auto"] +mobile_mode = "auto" +# whether to enable header blur effect blur = false # Header title config @@ -622,26 +1254,25 @@ post = "" # whether to use typeit animation for title name typeit = false -# FixIt 0.2.12 | NEW Header subtitle config +# Header subtitle config [params.header.subtitle] # subtitle name name = "" # whether to use typeit animation for subtitle name typeit = false -# FixIt 0.2.18 | NEW Breadcrumb config +# Breadcrumb config [params.breadcrumb] enable = false sticky = false -showHome = false -# FixIt 0.3.13 | NEW +show_home = false separator = "/" capitalize = true -# FixIt 0.3.10 | NEW Post navigation config +# Post navigation config [params.navigation] # whether to show the post navigation in section pages scope -inSection = false +in_section = false # whether to reverse the next/previous post navigation order reverse = false @@ -654,21 +1285,21 @@ copyright = true author = true # site creation year since = "" -# FixIt 0.2.12 | NEW Public network security only in China (HTML format is supported) +# Public network security only in China (HTML format is supported) gov = "" # ICP info only in China (HTML format is supported) icp = "" # license info (HTML format is supported) license = "" -# FixIt 1.0.0 | CHANGED whether to show Hugo and theme info +# whether to show Hugo and theme info [params.footer.powered] enable = true -hugoLogo = false -themeLogo = false +hugo_logo = false +theme_logo = false -# FixIt 0.2.17 | CHANGED Site creation time -[params.footer.siteTime] +# Site creation time +[params.footer.site_time] enable = false animate = true icon = "fa-solid fa-heartbeat" @@ -676,7 +1307,7 @@ pre = "" # e.g. "2021-12-18T16:15:22+08:00" value = "" -# FixIt 0.2.17 | NEW footer lines order, optional values: ["first", 0-5, "last"] +# footer lines order, optional values: ["first", 0-5, "last"] [params.footer.order] powered = 0 copyright = 0 @@ -684,55 +1315,55 @@ statistics = 0 visitor = 0 beian = 0 -# FixIt 0.3.0 | NEW Archives page config (all pages of posts type) +# Archives page config (all pages of posts type) [params.archives] # special amount of posts in archives page paginate = 20 # date format (month and day) -dateFormat = "01-02" +date_format = "01-02" # Section page config (all pages in section) [params.section] # special amount of pages in each section page paginate = 20 # date format (month and day) -dateFormat = "01-02" +date_format = "01-02" -# FixIt 0.3.10 | NEW Section feed config for RSS, Atom and JSON feed. +# Section feed config for RSS, Atom and JSON feed. [params.section.feed] # the number of posts to include in the feed. If set to -1, all posts. limit = -1 # whether to show the full text content in feed. -fullText = false +full_text = false # Term list (category or tag) page config [params.list] # special amount of posts in each list page paginate = 20 # date format (month and day) -dateFormat = "01-02" +date_format = "01-02" -# FixIt 0.3.10 | NEW Term list feed config for RSS, Atom and JSON feed. +# Term list feed config for RSS, Atom and JSON feed. [params.list.feed] # the number of posts to include in the feed. If set to -1, all posts. limit = -1 # whether to show the full text content in feed. -fullText = false +full_text = false -# FixIt 0.3.13 | NEW recently updated pages config for archives, section and term list -[params.recentlyUpdated] +# recently updated pages config for archives, section and term list +[params.recently_updated] archives = true section = true list = true days = 30 -maxCount = 10 +max_count = 10 -# FixIt 0.2.17 | NEW TagCloud config for tags page -[params.tagcloud] +# TagCloud config for tags page +[params.tag_cloud] enable = false min = 14 # Minimum font size in px max = 32 # Maximum font size in px -peakCount = 10 # Maximum count of posts per tag +peak_count = 10 # Maximum count of posts per tag orderby = "name" # Order of tags, optional values: ["name", "count"] # Home page config @@ -741,14 +1372,14 @@ orderby = "name" # Order of tags, optional values: ["name", "count"] # Home page profile [params.home.profile] enable = false -# FixIt 0.4.0 | NEW whether to show profile and content only in the first home page -onlyFirstPage = false +# whether to show profile and content only in the first home page +only_first_page = false # Gravatar email for preferred avatar in home page -gravatarEmail = "" +gravatar_email = "" # URL of avatar shown in home page, default is author's avatar -avatarURL = "" -# FixIt 0.2.17 | NEW identifier of avatar menu link -avatarMenu = "" +avatar_url = "" +# identifier of avatar menu link +avatar_menu = "" # title shown in home page (HTML format is supported) title = "" # subtitle shown in home page (HTML format is supported) @@ -766,9 +1397,9 @@ enable = true # special amount of posts in each home posts page paginate = 6 # whether to show featured image preview in home page post list -imagePreview = true +image_preview = true -# FixIt 0.2.16 | CHANGED Social config about the author +# Social config about the author [params.social] GitHub = "" Linkedin = "" @@ -875,79 +1506,41 @@ RSS = true # typing speed between each step (measured in milliseconds) speed = 100 # blinking speed of the cursor (measured in milliseconds) -cursorSpeed = 1000 +cursor_speed = 1000 # character used for the cursor (HTML format is supported) -cursorChar = "|" +cursor_char = "|" # cursor duration after typing finishing (measured in milliseconds, "-1" means unlimited) duration = -1 -# FixIt 0.2.18 | NEW whether your strings will continuously loop after completing +# whether your strings will continuously loop after completing # [fixme] There is a bug when printing in groups loop = false -# FixIt 0.2.15 | NEW Mermaid config -# See http://fixit.lruihao.cn/documentation/content-management/diagrams-support/mermaid/ -[params.mermaid] -# FixIt 1.0.0 | NEW whether to enable the Mermaid wrapper -# When enabled, Mermaid diagrams are wrapped with diagram tabs and actions: -# - pan/zoom (drag & ctrl+wheel) -# - reset view -# - download as SVG -wrapper = true -# FixIt 0.4.0 | NEW Mermaid ESM module CDN source -# default is https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs -cdn = "" -# FixIt 0.4.0 | NEW ZenUML ESM module CDN source -# default is empty, you can set it to a CDN source to enable ZenUML support -# e.g. https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.min.mjs -zenuml = "" -# for values, see https://mermaid.js.org/config/theming.html#available-themes -themes = [ - "default", - "dark" -] -# FixIt 0.4.0 | NEW The security level for Mermaid diagrams -# optional values: ["strict", "loose", "antiscript", "sandbox"] -securityLevel = "loose" -# FixIt 0.4.0 | NEW The appearance style for Mermaid diagrams -# optional values: ["classic", "handDrawn"] -look = "handDrawn" -# FixIt 0.4.0 | NEW Specifies the font to be used in the rendered diagrams -fontFamily = "" -# FixIt 0.4.0 | NEW Layout loaders from ESM module CDN sources (e.g., ELK layout engine) -# Example: ["https://cdn.jsdelivr.net/npm/@mermaid-js/layout-elk/dist/mermaid-layout-elk.esm.min.mjs"] -# this will enable additional layout options: ["elk", "elk.layered", "elk.stress", "elk.force", "elk.mrtree"] -layoutLoaders = [] -# default layout algorithm for rendering diagrams -# available options: "dagre" (default), "elk", "elk.layered", "elk.stress", "elk.force", "elk.mrtree" -# note: ELK layouts require layoutLoaders to be configured first -layout = "dagre" - -# FixIt 0.3.13 | NEW Admonitions custom config +# Admonitions custom config # See https://fixit.lruihao.cn/documentation/content-management/shortcodes/extended/admonition/#custom-admonitions # syntax: = [params.admonition] # ban = "fa-solid fa-ban" -# FixIt 0.3.14 | NEW Task lists custom config +# Task lists custom config # See https://fixit.lruihao.cn/documentation/content-management/advanced/#custom-task-lists # syntax: = -[params.taskList] +[params.task_list] # tip = "fa-regular fa-lightbulb" -# FixIt 0.3.15 | NEW version shortcode config -[params.repoVersion] -# url prefix for the release tag -url = "https://github.com/hugo-fixit/FixIt/releases/tag/v" +# version shortcode config +[params.repo_version] # project name name = "FixIt" +# url prefix for the release tag +url = "https://github.com/hugo-fixit/FixIt/releases/tag/v" -# FixIt 0.2.12 | NEW PanguJS config +# PanguJS config [params.pangu] # for Chinese writing enable = false -selector = "article" # FixIt 0.2.17 | NEW +selector = "article" -# FixIt 0.2.12 | NEW Watermark config +# Watermark config # detail config see https://github.com/Lruihao/watermark#readme [params.watermark] enable = false @@ -960,26 +1553,26 @@ width = 150 # watermark's height. unit: px height = 20 # row spacing of watermarks. unit: px -rowSpacing = 60 +row_spacing = 60 # col spacing of watermarks. unit: px -colSpacing = 30 +col_spacing = 30 # watermark's tangent angle. unit: deg rotate = 15 # watermark's fontSize. unit: rem -fontSize = 0.85 -# FixIt 0.2.13 | NEW watermark's fontFamily -fontFamily = "inherit" +font_size = 0.85 +# watermark's fontFamily +font_family = "inherit" -# FixIt 0.3.10 | NEW Busuanzi count +# Busuanzi count [params.busuanzi] # whether to enable busuanzi count enable = false # busuanzi count core script source. Default is https://vercount.one/js source = "https://vercount.one/js" # whether to show the site views -siteViews = true +site_views = true # whether to show the page views -pageViews = true +page_views = true # Site verification code config for Google/Bing/Yandex/Pinterest/Baidu/360/Sogou [params.verification] @@ -993,10 +1586,17 @@ sogou = "" # Site SEO config [params.seo] -# image URL -image = "" +# default cover image for the site +cover = "" # thumbnail URL -thumbnailUrl = "" +thumbnail_url = "" +# Page SEO images (frontmatter-overridable) +images = [] + +# Publisher info (frontmatter-overridable) +[params.seo.publisher] +name = "" +logo_url = "" # Analytics config [params.analytics] @@ -1006,7 +1606,7 @@ enable = false [params.analytics.google] id = "" # whether to anonymize IP -anonymizeIP = true +anonymize_ip = true # Fathom Analytics [params.analytics.fathom] @@ -1014,27 +1614,27 @@ id = "" # server url for your tracker if you're self hosting server = "" -# FixIt 0.3.16 | NEW Baidu Analytics +# Baidu Analytics [params.analytics.baidu] id = "" -# FixIt 0.3.16 | NEW Umami Analytics +# Umami Analytics [params.analytics.umami] data_website_id = "" src = "" data_host_url = "" data_domains = "" -# FixIt 0.3.16 | NEW Plausible Analytics +# Plausible Analytics [params.analytics.plausible] data_domain = "" src = "" -# FixIt 0.3.16 | NEW Cloudflare Analytics +# Cloudflare Analytics [params.analytics.cloudflare] token = "" -# FixIt 0.3.16 | NEW Splitbee Analytics +# Splitbee Analytics [params.analytics.splitbee] enable = false # no cookie mode @@ -1067,31 +1667,31 @@ data = "" # https://cdnjs.cloudflare.com/polyfill polyfill = false # whether to use object-fit-images to be compatible with older browsers -objectFit = false +object_fit = false -# FixIt 0.2.14 | NEW GitHub banner in the top-right or top-left corner -[params.githubCorner] +# GitHub banner in the top-right or top-left corner +[params.github_corner] enable = false permalink = "https://github.com/hugo-fixit/FixIt" title = "View source on GitHub" position = "right" # ["left", "right"] -# FixIt 0.2.14 | NEW Gravatar config +# Gravatar config [params.gravatar] -# FixIt 0.2.18 | NEW Depends on the author's email, if the author's email is not set, the local avatar will be used +# Depends on the author's email, if the author's email is not set, the local avatar will be used enable = false # Gravatar host, default: "www.gravatar.com" host = "www.gravatar.com" # ["cravatar.cn", "gravatar.loli.net", ...] style = "" # ["", "mp", "identicon", "monsterid", "wavatar", "retro", "blank", "robohash"] -# FixIt 0.2.16 | NEW Back to top -[params.backToTop] +# Back to top +[params.back_to_top] enable = true -# FixIt 0.4.0 | CHANGED whether to show the scroll percent indicator around the back to top button +# whether to show the scroll percent indicator around the back to top button scrollpercent = false -# FixIt 0.2.16 | NEW Reading progress bar -[params.readingProgress] +# Reading progress bar +[params.reading_progress] enable = false # available values: ["left", "right"] start = "left" @@ -1102,7 +1702,7 @@ light = "" dark = "" height = "2px" -# FixIt 0.2.17 | NEW Progress bar in the top during page loading. +# Progress bar in the top during page loading. # for more information: https://github.com/CodeByZach/pace [params.pace] enable = false @@ -1114,151 +1714,19 @@ color = "blue" # "corner-indicator", "fill-left", "flash", "flat-top", "loading-bar", "mac-osx", "material", "minimal"] theme = "minimal" -# FixIt 0.3.17 | NEW PostChat AI config -# based on your posts to build a knowledge base, support AI summary, AI search, and AI Chatbot. -# get PostChat Key from my invitation link, thanks for your support! -# https://ai.zhheo.com/console/login?InviteID=85041330 -[params.postChat] -enable = false -key = "" -# how users initiate chats: ["iframe", "magic"] -userMode = "iframe" -addButton = true -defaultInput = false -left = "" -bottom = "" -width = "" -height = "" -fill = "" -backgroundColor = "" -upLoadWeb = true -showInviteLink = true -userTitle = "" -userDesc = "" -# dom container to be blacked out, e.g. [".aplayer"] -blackDom = [] -# only for iframe mode -frameWidth = "" # e.g. "375px" -frameHeight = "" # e.g. "600px" -# only for magic mode -userIcon = "" -defaultChatQuestions = [] -defaultSearchQuestions = [] -# FixIt 0.4.0 | NEW -hotWords = true - -# FixIt 0.3.17 | NEW Summary AI config -# See https://ai.zhheo.com/docs/summary.html -[params.postSummary] -enable = false -# if you set `params.postChat.key`, you don't need to set `params.postSummary.key` -key = "" -title = "" -# themes options: ["", "simple", "yanzhi", "menghuan"] -theme = "" -postURL = "" -blacklist = "" -wordLimit = 1000 -typingAnimate = true -beginningText = "" -loadingText = true - -# FixIt 0.4.0 | NEW Podcast AI config -# See https://ai.zhheo.com/docs/podcast.html -[params.podcast] -enable = false - -# FixIt 0.3.10 | NEW Global Feed config for RSS, Atom and JSON feed. +# Global Feed config for RSS, Atom and JSON feed. [params.feed] # the number of posts to include in the feed. If set to -1, all posts. limit = 10 # whether to show the full text content in feed. -fullText = true +full_text = true # Site Challenge for Follow: https://follow.is/ [params.feed.follow] -feedId = "" -userId = "" +feed_id = "" +user_id = "" -# FixIt 0.3.17 | NEW Image config -# combined with Hugo's image processing option `imaging` for image optimisation -[params.image] -# cache remote images for better optimisations -cacheRemote = false -# Image resizing and optimisation (may slow builds) -optimise = false -# FixIt 0.4.0 | NEW A list of image file names or patterns to exclude from optimisation -# e.g. ["no-optimize.jpg", "*.tiff", "images/exclude-*.webp"] -blackList = [] - -# FixIt 1.0.0 | NEW Link config -[params.link] -# whether to add external Icon for external links automatically -external_icon = true - -# External link guard config -# per-page override via front matter: link_guard (bool/object) -[params.link.guard] -enable = false -# external link guard mode, available modes: ["modal", "redirect"] -# in "modal" mode, a dialog will pop up to ask for confirmation when users click external links -# in "redirect" mode, users will be redirected to an intermediate page before visiting external links -mode = "modal" -# allowed domains (exact host or parent domain) will skip confirmation -allow_domains = [] - -# FixIt 0.4.0 | NEW Code block wrapper config -# you can override the global config via Markdown attributes, for example: -# ```lang {mode="mac", maxShownLines=5} -# code here -# ``` -[params.codeblock] -# whether to enable the code block wrapper -wrapper = true -# code block mode -# available modes: ["classic", "mac", "simple", ...] -# if you set to custom value, you need to create a custom CSS for data-mode attribute -mode = "classic" -# additional classes for the code block wrapper -# e.g. "is-collapsed is-expanded line-nos-hidden line-wrapping" -wrapperClass = "" -# the maximum number of lines to show in the code block preview -maxShownLines = 10 -# whether to show shadow effect for code blocks, available values: ["always", "hover", "never"] -shadow = "never" -# whether to enable code copy button -copyable = true -# [classic] whether to enable code download button in the code block header -downloadable = false -# [classic] whether to enable code fullscreen button in the code block header -fullscreen = false -# [classic] whether to enable line numbers toggle button in the code block header -lineNosToggler = true -# [classic] whether to enable toggle line wrapping button in the code block header -lineWrapToggler = true -# [classic][Experimental] whether to enable code edit button in the code block header -editable = false - -# FixIt 0.4.0 | NEW JSON Viewer config -# See https://github.com/Lruihao/json-viewer-element -[params.jsonViewer] -enable = true -expandDepth = 1 -copyable = true -sort = false -boxed = true - -# FixIt 0.4.2 | NEW File tree config -# See https://fixit.lruihao.cn/documentation/content-management/shortcodes/extended/file-tree/ -[params.filetree] -# the expand level of the tree (expand all: -1, collapse all: 0) -level = 1 -# whether to append a trailing "/" to folder names -folderSlash = false -# list of file or folder names to ignore -ignoreList = [] - -# FixIt 1.0.0 | NEW Taxonomy icons config +# Taxonomy icons config # works with [taxonomies]. Configure [taxonomies] first, otherwise taxonomy icons will not take effect. [params.taxonomy_icons] # syntax: = [, <card icon>, <term title icon>] @@ -1269,7 +1737,7 @@ ignoreList = [] # "fa-solid fa-book-open" # ] -# FixIt 0.4.5 | NEW Print config +# Print config [params.print] # whether to expand all admonitions before printing expand_admonition = true @@ -1280,27 +1748,27 @@ expand_details = true # whether to expand all file trees before printing expand_file_tree = false -# FixIt 0.3.12 | NEW Custom partials config +# Custom partials config # custom partials must be stored in the /layouts/_partials/ directory. # depends on open custom blocks https://fixit.lruihao.cn/references/blocks/ -[params.customPartials] +[params.custom_partials] head = [] -menuDesktop = [] -menuMobile = [] +menu_desktop = [] +menu_mobile = [] profile = [] aside = [] comment = [] footer = [] widgets = [] assets = [] -postTocBefore = [] -postTocAfter = [] -postContentBefore = [] -postContentAfter = [] -postFooterBefore = [] -postFooterAfter = [] +post_toc_before = [] +post_toc_after = [] +post_content_before = [] +post_content_after = [] +post_footer_before = [] +post_footer_after = [] -# FixIt 1.0.0 | NEW SCSS variables customization via config +# SCSS variables customization via config # Leave empty to use the theme default value (defined in scss-vars.html). # Note: Color values must use hex format (e.g. "#ff0000"), CSS named colors (e.g. "red") are not supported. [params.appearance] @@ -1396,466 +1864,10 @@ github_corner_color_dark = "" github_corner_fill = "" github_corner_fill_dark = "" -# FixIt 0.2.15 | NEW Developer options +# Developer options # select the scope named `public_repo` to generate personal access token, # configure with environment variable `HUGO_PARAMS_GHTOKEN=xxx`, see https://gohugo.io/functions/os/getenv/#examples [params.dev] enable = false # check for updates c4u = false - -# Page config -# TODO migrate mapping key to `params` layer in the future -[params.page] -# FixIt 0.2.18 | NEW whether to enable the author's avatar of the post -authorAvatar = true -# whether to hide a page from home page -hiddenFromHomePage = false -# whether to hide a page from search results -hiddenFromSearch = false -# FixIt 0.3.0 | NEW whether to hide a page from related posts -hiddenFromRelated = false -# FixIt 0.3.10 | NEW whether to hide a page from RSS, Atom and JSON feed -hiddenFromFeed = false -# whether to enable twemoji -twemoji = false -# FixIt 0.2.18 | CHANGED whether to enable lightgallery -# set to true, images in the content will be shown as the gallery if the image has a title, e.g. ![alt](src "title") -# set to "force", images in the content will be forced to shown as the gallery regardless of the image has a title or not, e.g. ![alt](src) -# TODO change gallery engine in the future -lightgallery = false -# whether to enable the ruby extended syntax -ruby = true -# whether to enable the fraction extended syntax -fraction = true -# whether to enable the fontawesome extended syntax -fontawesome = true -# license info (HTML format is supported) -license = '<a rel="license external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a>' -# whether to show link to Raw Markdown content of the post -linkToMarkdown = true -# FixIt 0.3.0 | NEW whether to show link to view source code of the post -linkToSource = true -# FixIt 0.3.0 | NEW whether to show link to edit the post -linkToEdit = true -# FixIt 0.3.0 | NEW whether to show link to report issue for the post -linkToReport = true -# FixIt 0.3.20 | NEW whether to show link to view the post in VSCode -# [todo] (string) migrate to link_to_editor config in the future -# to support more editors (vscode://, trae://, etc.) -linkToVscode = true -# FixIt 0.3.10 | CHANGED Page style ["narrow", "normal", "wide", ...] -pageStyle = "normal" -# FixIt 0.2.17 | CHANGED Auto Bookmark Support -# if true, save the reading progress when closing the page. -autoBookmark = false -# FixIt 0.4.0 | NEW whether to show the last modified time -showLastmod = true -# FixIt 0.2.17 | NEW whether to enable wordCount -wordCount = true -# FixIt 0.2.17 | NEW whether to enable readingTime -readingTime = true -# FixIt 0.2.17 | NEW end of post flag -endFlag = "" -# FixIt 0.2.18 | NEW whether to enable instant.page -instantPage = false -# FixIt 0.3.0 | NEW whether to enable collection list at the sidebar -collectionList = false -# FixIt 0.3.0 | NEW whether to enable collection navigation at the end of the post -collectionNavigation = false - -# FixIt 0.2.15 | NEW Repost config -[params.page.repost] -enable = false -url = "" - -# Table of the contents config -[params.page.toc] -# whether to enable the table of the contents -enable = true -# whether to keep the static table of the contents in front of the post -keepStatic = false -# whether to make the table of the contents in the sidebar automatically collapsed -auto = true -# FixIt 0.2.13 | NEW position of TOC ["left", "right"] -position = "right" -# FixIt 0.3.12 | NEW supersede `markup.tableOfContents` settings -ordered = false -startLevel = 2 -endLevel = 6 -# FixIt 0.4.0 | NEW whether to decrease the H1 heading level in content -decreaseH1 = false - -# FixIt 0.2.13 | NEW Display a message at the beginning of an article to warn the reader that its content might be expired -[params.page.expirationReminder] -enable = false -# display the reminder if the last modified time is more than 90 days ago -reminder = 90 -# display warning if the last modified time is more than 180 days ago -warning = 180 -# if the article expires, close the comment or not -closeComment = false - -# FixIt 0.3.0 | NEW page heading config -[params.page.heading] -# FixIt 0.3.3 | NEW whether to capitalize automatic text of headings -capitalize = false - -# FixIt 0.3.12 | CHANGED must set `params.page.toc.ordered` to true -[params.page.heading.number] -# whether to enable auto heading numbering -enable = false -# FixIt 0.3.3 | NEW only enable in main section pages (default is posts) -onlyMainSection = true - -[params.page.heading.number.format] -h1 = "{title}" -h2 = "{h2} {title}" -h3 = "{h2}.{h3} {title}" -h4 = "{h2}.{h3}.{h4} {title}" -h5 = "{h2}.{h3}.{h4}.{h5} {title}" -h6 = "{h2}.{h3}.{h4}.{h5}.{h6} {title}" - -# FixIt 0.4.0 | CHANGED mathematical formulas configuration -# See http://fixit.lruihao.cn/documentation/content-management/markdown-syntax/extended/#formula -[params.page.math] -enable = true -# mathematical formulas rendering engines, optional values: ["katex", "mathjax"] -type = "katex" - -# KaTeX server-side rendering (https://katex.org) -# KaTeX partial config: https://gohugo.io/functions/transform/tomath/#options -[params.page.math.katex] -# KaTeX extension copy-tex -copyTex = true -throwOnError = false -errorColor = "#ff4949" - -# custom macros map -# syntax: <macro> = <definition> -[params.page.math.katex.macros] -# "\\f" = "#1f(#2)" # usage: $\f{a}{b}$ - -# MathJax server-side rendering (https://www.mathjax.org) -# MathJax config: https://docs.mathjax.org/en/latest/options/index.html -[params.page.math.mathjax] -cdn = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" - -[params.page.math.mathjax.packages] -# "[+]" = ["configmacros"] - -# custom macros map -# syntax: <macro> = <definition> -[params.page.math.mathjax.macros] -# bold = ["{\\bf #1}", 1] # usage: $\bold{math}$ - -[params.page.math.mathjax.loader] -load = [ "ui/safe" ] - -[params.page.math.mathjax.loader.paths] -# custom = "https://cdn.jsdelivr.net/gh/sonoisa/XyJax-v3@3.0.1/build/" - -# more loader config e.g source, dependencies, provides etc. - -[params.page.math.mathjax.options] -enableMenu = true -# HTML tags that won't be searched for math -skipHtmlTags = [ - "script", - "noscript", - "style", - "textarea", - "pre", - "code", - "math", - "select", - "option", - "mjx-container" -] -# class that marks tags not to search -ignoreHtmlClass = "mathjax_ignore" - -# HTML tags that can appear within math -[params.page.math.mathjax.options.includeHtmlTags] -# "#comment" = "" -# br = "\n" -# wbr = "" - -# Mapbox GL JS config (https://docs.mapbox.com/mapbox-gl-js) -[params.page.mapbox] -# access token of Mapbox GL JS -accessToken = "" -# style for the light theme -lightStyle = "mapbox://styles/mapbox/light-v11" -# style for the dark theme -darkStyle = "mapbox://styles/mapbox/dark-v11" -# whether to add NavigationControl -navigation = true -# whether to add GeolocateControl -geolocate = true -# whether to add ScaleControl -scale = true -# whether to add FullscreenControl -fullscreen = true - -# FixIt 0.3.0 | NEW Related content config (https://gohugo.io/content-management/related/) -[params.page.related] -enable = false -count = 5 -# FixIt 0.3.20 | NEW position of related content, optional values: ["aside", "footer"] -position = [ - "aside", - "footer" -] - -# FixIt 0.2.17 | NEW Donate (Sponsor) settings -[params.page.reward] -enable = false -animation = false -# position relative to post footer, optional values: ["before", "after"] -position = "after" -# comment = "Buy me a coffee" -# FixIt 0.2.18 | NEW display mode of QR code images, optional values: ["static", "fixed"], default: `static` -mode = "static" - -[params.page.reward.ways] -# wechatpay = "/images/wechatpay.png" -# alipay = "/images/alipay.png" -# paypal = "/images/paypal.png" -# bitcoin = "/images/bitcoin.png" - -# Social share links in post page -[params.page.share] -enable = true -Twitter = true -Facebook = true -Linkedin = false -Whatsapp = false -Pinterest = false -Tumblr = false -HackerNews = false -Reddit = false -VK = false -Buffer = false -Xing = false -Line = false -Instapaper = false -Pocket = false -Flipboard = false -Weibo = true -Myspace = false -Blogger = false -Baidu = false -Odnoklassniki = false -Evernote = false -Skype = false -Trello = false -Mix = false - -# FixIt 0.2.15 | CHANGED Comment config -[params.page.comment] -enable = false - -# FixIt 0.2.13 | NEW Artalk comment config (https://artalk.js.org/) -[params.page.comment.artalk] -enable = false -server = "https://yourdomain" -site = "默认站点" -# FixIt 1.0.0 | NEW prefer remote (backend) configuration over local -# If true, remote config takes priority; if false (default), local config overrides remote -preferRemoteConf = false -placeholder = "" -noComment = "" -sendBtn = "" -editorTravel = true -flatMode = "auto" -# FixIt 0.2.17 | CHANGED enable lightgallery support -lightgallery = false -locale = "" -emoticons = "" -nestMax = 2 -nestSort = "DATE_ASC" # ["DATE_ASC", "DATE_DESC", "VOTE_UP_DESC"] -vote = true -voteDown = false -uaBadge = true -listSort = true -listUnreadHighlight = false -imgUpload = true -imgLazyLoad = false # false | "native" | "data-src" -preview = true -versionCheck = true -# request timeout in milliseconds -reqTimeout = 15000 -# page view increment on comment list load -pvAdd = true - -# FixIt 1.0.0 | NEW pagination config -[params.page.comment.artalk.pagination] -pageSize = 20 -readMore = true -autoLoad = true - -# FixIt 1.0.0 | NEW height limit config -[params.page.comment.artalk.heightLimit] -content = 300 -children = 400 -scrollable = false - -# Disqus comment config (https://disqus.com) -[params.page.comment.disqus] -enable = false -# Disqus shortname to use Disqus in posts -shortname = "" - -# Gitalk comment config (https://github.com/gitalk/gitalk) -[params.page.comment.gitalk] -enable = false -owner = "" -repo = "" -clientId = "" -clientSecret = "" - -# Valine comment config (https://github.com/xCss/Valine) -[params.page.comment.valine] -enable = false -appId = "" -appKey = "" -placeholder = "" -avatar = "mp" -meta = [ - 'nick', - 'mail', - 'link' -] -requiredFields = [] -pageSize = 10 -lang = "" -visitor = true -recordIP = true -highlight = true -enableQQ = false -serverURLs = "" -# emoji data file name, default is "google.yml" -# ["apple.yml", "google.yml", "facebook.yml", "twitter.yml"] -# located in "themes/FixIt/assets/lib/valine/emoji/" directory -# you can store your own data files in the same path under your project: -# "assets/lib/valine/emoji/" -emoji = "" -commentCount = true - -# FixIt 0.2.13 | NEW -# FixIt 0.2.16 | CHANGED Waline comment config (https://waline.js.org) -[params.page.comment.waline] -enable = false -serverURL = "" -pageview = false # FixIt 0.2.15 | NEW -emoji = [ "//unpkg.com/@waline/emojis@1.1.0/weibo" ] -meta = [ - "nick", - "mail", - "link" -] -requiredMeta = [] -login = "enable" -wordLimit = 0 -pageSize = 10 -imageUploader = false # FixIt 0.2.15 | NEW -highlighter = false # FixIt 0.2.15 | NEW -comment = false # FixIt 0.2.15 | NEW -texRenderer = false # FixIt 0.2.16 | NEW -search = false # FixIt 0.2.16 | NEW -recaptchaV3Key = "" # FixIt 0.2.16 | NEW -turnstileKey = "" # FixIt 0.3.8 | NEW -reaction = false - -# FixIt 0.2.18 | NEW -# Facebook comment config (https://developers.facebook.com/docs/plugins/comments) -[params.page.comment.facebook] -enable = false -width = "100%" -numPosts = 10 -appId = "" -languageCode = "" - -# Telegram comments config (https://comments.app) -[params.page.comment.telegram] -enable = false -siteID = "" -limit = 5 -height = "" -color = "" -colorful = true -dislikes = false -outlined = false - -# Commento comment config (https://commento.io) -[params.page.comment.commento] -enable = false - -# Utterances comment config (https://utteranc.es) -[params.page.comment.utterances] -enable = false -# owner/repo -repo = "" -issueTerm = "pathname" -label = "" -lightTheme = "github-light" -darkTheme = "github-dark" - -# FixIt 0.2.13 | NEW Twikoo comment config (https://twikoo.js.org/) -[params.page.comment.twikoo] -enable = false -envId = "" -region = "" -path = "" -visitor = true -commentCount = true -lang = "" -# FixIt 0.2.17 | CHANGED enable lightgallery support -lightgallery = false -# FixIt 0.2.17 | NEW enable Katex support -katex = false - -# FixIt 0.2.14 | NEW Giscus comments config -[params.page.comment.giscus] -enable = false -repo = "" -repoId = "" -category = "" -categoryId = "" -mapping = "" -origin = "https://giscus.app" # FixIt NEW | 0.3.7 Or set it to your self-hosted domain -strict = "0" # FixIt NEW | 0.2.18 -term = "" -reactionsEnabled = "1" -emitMetadata = "0" -inputPosition = "bottom" # ["top", "bottom"] -lang = "" -lightTheme = "light" -darkTheme = "dark" -lazyLoad = true - -# Third-party library config -[params.page.library] - -[params.page.library.css] -# someCSS = "some.css" -# located in "assets/" -# Or -# someCSS = "https://cdn.example.com/some.css" - -[params.page.library.js] -# someJavascript = "some.js" -# located in "assets/" -# Or -# someJavascript = "https://cdn.example.com/some.js" - -# Page SEO config -[params.page.seo] -# image URL -images = [] - -# Publisher info -[params.page.seo.publisher] -name = "" -logoUrl = "" diff --git a/layouts/404.html b/layouts/404.html index a9cbfd57..7edd1e5e 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,6 +1,6 @@ {{- define "title" -}} {{- T "pageNotFound" | printf "404 %v" -}} - {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} + {{- if .Site.Params.with_site_title }} {{ .Site.Params.title_delimiter }} {{ .Site.Title }}{{- end -}} {{- end -}} {{- define "content" -}} diff --git a/layouts/_markup/render-codeblock-file-tree.html b/layouts/_markup/render-codeblock-file-tree.html index cc2f844c..5992a037 100644 --- a/layouts/_markup/render-codeblock-file-tree.html +++ b/layouts/_markup/render-codeblock-file-tree.html @@ -1,20 +1,20 @@ {{- /* Render hook for file-tree code blocks Alternative to file-tree shortcode's inner content rendering. - + Supported attributes: - level: The expand level of the tree (expand all: -1, collapse all: 0, default: 1) - - folderSlash: Whether to append a trailing "/" to folder names (default: false) - - ignoreList: List of file or folder names to ignore, separated by commas - - highlightList: List of file or folder names to highlight, separated by commas - + - folder_slash: Whether to append a trailing "/" to folder names (default: false) + - ignore_list: List of file or folder names to ignore, separated by commas + - highlight_list: List of file or folder names to highlight, separated by commas + Content format: YAML/JSON/TOML with the following item structure: name: string - The name of the file or folder type: string - Type of item, either "dir" (directory) or "file" children?: array - (Optional) Array of child items, only valid for directories - + Example usage: - ```file-tree {level=2 folderSlash=true} + ```file-tree {level=2 folder_slash=true} - name: my-project type: dir children: @@ -25,12 +25,22 @@ ``` */ -}} -{{- $pageConfig := dict | merge .Page.Params.filetree | merge .Page.Site.Params.filetree -}} +{{- $pageConfig := dict "Page" .Page "Key" "filetree" | partial "function/param.html" -}} {{- $config := .Attributes | merge $pageConfig -}} {{- $level := cond (isset $config "level") ($config.level | int) 1 -}} -{{- $folderSlash := $config.folderslash | default false -}} -{{- $ignoreList := union (apply (split (.Attributes.ignorelist | default "") ",") "trim" "." " ") $pageConfig.ignorelist -}} -{{- $highlightList := apply (split (.Attributes.highlightlist | default "") ",") "trim" "." " " -}} +{{- $folderSlash := $config.folder_slash | default .Attributes.folderslash | default false -}} +{{- $ignoreList := union (apply (split (.Attributes.ignore_list | default .Attributes.ignorelist | default "") ",") "trim" "." " ") $pageConfig.ignore_list -}} +{{- $highlightList := union (apply (split (.Attributes.highlight_list | default .Attributes.highlightlist | default "") ",") "trim" "." " ") $pageConfig.highlight_list -}} +{{- /* Deprecated camelCase attribute support */ -}} +{{- if isset .Attributes "folderslash" -}} + {{- warnidf "v1-deprecated-file-tree-attr" "The attribute `folderSlash` is deprecated since v1.0.0, use `folder_slash` instead. See %s" .Position -}} +{{- end -}} +{{- if isset .Attributes "ignorelist" | and (not (isset .Attributes "ignore_list")) -}} + {{- warnidf "v1-deprecated-file-tree-attr" "The attribute `ignoreList` is deprecated since v1.0.0, use `ignore_list` instead. See %s" .Position -}} +{{- end -}} +{{- if isset .Attributes "highlightlist" | and (not (isset .Attributes "highlight_list")) -}} + {{- warnidf "v1-deprecated-file-tree-attr" "The attribute `highlightList` is deprecated since v1.0.0, use `highlight_list` instead. See %s" .Position -}} +{{- end -}} {{- $content := strings.TrimSpace .Inner | default "" -}} {{- $treeData := slice -}} @@ -44,8 +54,8 @@ {{- $options := dict "items" $treeData "level" $level - "folderSlash" $folderSlash - "ignoreList" $ignoreList - "highlightList" $highlightList + "folder_slash" $folderSlash + "ignore_list" $ignoreList + "highlight_list" $highlightList -}} {{- partial "plugin/file-tree.html" $options -}} diff --git a/layouts/_markup/render-codeblock-json.html b/layouts/_markup/render-codeblock-json.html index 64bac373..dce69b3e 100644 --- a/layouts/_markup/render-codeblock-json.html +++ b/layouts/_markup/render-codeblock-json.html @@ -1,6 +1,11 @@ -{{- $jsonViewer := .Attributes | merge .Page.Params.jsonViewer | merge .Page.Site.Params.jsonViewer -}} +{{- $jsonViewer := .Attributes | merge (dict "Page" .Page "Key" "json_viewer" | partial "function/param.html") -}} {{- if $jsonViewer.enable | and (ne hugo.Context.MarkupScope "home") -}} - {{- $attrs := printf `expand-depth="%v"` $jsonViewer.expanddepth -}} + {{- /* Deprecated camelCase attribute support: Hugo lowercases Markdown attributes, so expandDepth → expanddepth */ -}} + {{- if isset .Attributes "expanddepth" | and (not (isset .Attributes "expand_depth")) -}} + {{- warnidf "v1-deprecated-json-viewer-attr" "The attribute `expandDepth` is deprecated since v1.0.0, use `expand_depth` instead. See %s" .Position -}} + {{- $jsonViewer = dict "expand_depth" .Attributes.expanddepth | merge $jsonViewer -}} + {{- end -}} + {{- $attrs := printf `expand-depth="%v"` $jsonViewer.expand_depth -}} {{- $copyable := false -}} {{- with $jsonViewer.copyable -}} {{- $copyable = dict "copyText" (T "assets.copyText") "copiedText" (T "assets.copiedText") -}} diff --git a/layouts/_markup/render-codeblock-toggle.html b/layouts/_markup/render-codeblock-toggle.html index 570a4bdd..4116f77a 100644 --- a/layouts/_markup/render-codeblock-toggle.html +++ b/layouts/_markup/render-codeblock-toggle.html @@ -32,11 +32,17 @@ {{- if ne .Attributes.fullscreen nil -}} {{- $commonAttrsStr = printf "%s, fullscreen=%v" $commonAttrsStr .Attributes.fullscreen -}} {{- end -}} - {{- if ne .Attributes.linenostoggler nil -}} - {{- $commonAttrsStr = printf "%s, lineNosToggler=%v" $commonAttrsStr .Attributes.linenostoggler -}} + {{- if ne (.Attributes.line_nos_toggler | default .Attributes.linenostoggler) nil -}} + {{- $commonAttrsStr = printf "%s, line_nos_toggler=%v" $commonAttrsStr (.Attributes.line_nos_toggler | default .Attributes.linenostoggler) -}} + {{- if isset .Attributes "linenostoggler" | and (not (isset .Attributes "line_nos_toggler")) -}} + {{- warnidf "v1-deprecated-toggle-attr" "The attribute `lineNosToggler` is deprecated since v1.0.0, use `line_nos_toggler` instead. See %s" $.Position -}} + {{- end -}} {{- end -}} - {{- if ne .Attributes.linewraptoggler nil -}} - {{- $commonAttrsStr = printf "%s, lineWrapToggler=%v" $commonAttrsStr .Attributes.linewraptoggler -}} + {{- if ne (.Attributes.line_wrap_toggler | default .Attributes.linewraptoggler) nil -}} + {{- $commonAttrsStr = printf "%s, line_wrap_toggler=%v" $commonAttrsStr (.Attributes.line_wrap_toggler | default .Attributes.linewraptoggler) -}} + {{- if isset .Attributes "linewraptoggler" | and (not (isset .Attributes "line_wrap_toggler")) -}} + {{- warnidf "v1-deprecated-toggle-attr" "The attribute `lineWrapToggler` is deprecated since v1.0.0, use `line_wrap_toggler` instead. See %s" $.Position -}} + {{- end -}} {{- end -}} {{- if ne .Attributes.editable nil -}} {{- $commonAttrsStr = printf "%s, editable=%v" $commonAttrsStr .Attributes.editable -}} diff --git a/layouts/_markup/render-heading.html b/layouts/_markup/render-heading.html index 5f65ca69..0fd70fbc 100644 --- a/layouts/_markup/render-heading.html +++ b/layouts/_markup/render-heading.html @@ -1,14 +1,9 @@ {{- /* Read the config and format */ -}} -{{- $params := .Page.Params | merge site.Params.page -}} -{{- /* Toc data patch */ -}} -{{- $toc := $params.toc -}} -{{- if not (reflect.IsMap $toc) -}} - {{- $toc = dict "enable" $toc | merge site.Params.page.toc -}} -{{- end -}} -{{- $headingConfig := $params.heading -}} +{{- $toc := dict "Page" .Page "Key" "toc" | partial "function/param.html" -}} +{{- $headingConfig := dict "Page" .Page "Key" "heading" | partial "function/param.html" -}} {{- /* Only enable in main section pages */ -}} {{- $intersect := (slice .Page.Section .Page.Type) | intersect site.MainSections -}} -{{- $onlyMainSection := cond $headingConfig.number.onlyMainSection ((gt (len $intersect) 0) | and (eq .Page.Kind "page")) true -}} +{{- $onlyMainSection := cond $headingConfig.number.only_main_section ((gt (len $intersect) 0) | and (eq .Page.Kind "page")) true -}} {{- $ordered := $toc.ordered | and $headingConfig.number.enable | and $onlyMainSection -}} {{- $h1Format := $headingConfig.number.format.h1 | default "{title}" -}} {{- $h2Format := $headingConfig.number.format.h2 | default "{h2} {title}" -}} @@ -17,7 +12,7 @@ {{- $h5Format := $headingConfig.number.format.h5 | default "{h2}.{h3}.{h4}.{h5} {title}" -}} {{- $h6Format := $headingConfig.number.format.h6 | default "{h2}.{h3}.{h4}.{h5}.{h6} {title}" -}} {{- $level := .Level -}} -{{- $maxMarkupLevel := cond $toc.decreaseH1 2 1 -}} +{{- $maxMarkupLevel := cond $toc.decrease_h1 2 1 -}} {{- /* Disable ordered headings on home page */ -}} {{- if eq hugo.Context.MarkupScope "home" -}} diff --git a/layouts/_markup/render-image.html b/layouts/_markup/render-image.html index 63a4663b..69d81a49 100644 --- a/layouts/_markup/render-image.html +++ b/layouts/_markup/render-image.html @@ -7,21 +7,21 @@ A Markdown image has three components: the image description, the image destinat ------------ ------------------ --------- .Text .Destination .Title */ -}} -{{- $params := .Page.Params | merge site.Params.page -}} -{{- $optim := slice +{{- $optim := slice (dict "Process" "resize 800x webp" "descriptor" "800w") (dict "Process" "resize 1200x webp" "descriptor" "1200w") (dict "Process" "resize 1600x webp" "descriptor" "1600w") -}} +{{- $lightgallery := .Page.Param "lightgallery" -}} {{- if .Title -}} - {{- $linked := ne $params.lightgallery false -}} + {{- $linked := ne $lightgallery false -}} <figure> - {{- dict "Src" .Destination "Alt" .PlainText "Title" .Title "Caption" .Text "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}} + {{- dict "Page" .Page "Src" .Destination "Alt" .PlainText "Title" .Title "Caption" .Text "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}} <figcaption class="image-caption"> {{- .Title | safeHTML -}} </figcaption> </figure> {{- else -}} - {{- $linked := (eq $params.lightgallery "force") | or ($params.lightgallery | and (ne .Title "")) -}} - {{- dict "Src" .Destination "Alt" .PlainText "Title" .Title "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}} + {{- $linked := (eq $lightgallery "force") | or ($lightgallery | and (ne .Title "")) -}} + {{- dict "Page" .Page "Src" .Destination "Alt" .PlainText "Title" .Title "Linked" $linked "Loading" "lazy" "Resources" .Page.Resources "OptimConfig" $optim | partial "plugin/image.html" -}} {{- end -}} diff --git a/layouts/_markup/render-passthrough.html b/layouts/_markup/render-passthrough.html index 025b911c..767a47ff 100644 --- a/layouts/_markup/render-passthrough.html +++ b/layouts/_markup/render-passthrough.html @@ -1,10 +1,4 @@ -{{- $params := .Page.Params | merge site.Params.page -}} -{{- $math := $params.math -}} -{{- if eq $math true -}} - {{- $math = dict "enable" true | merge site.Params.page.math -}} -{{- else if eq $math false -}} - {{- $math = dict "enable" false -}} -{{- end -}} +{{- $math := dict "Page" .Page "Key" "math" "ToCamel" true | partial "function/param.html" -}} {{- /* Mathematical formulas rendering: @@ -15,13 +9,7 @@ */ -}} {{- if $math.enable | and (ne hugo.Context.MarkupScope "home") -}} {{- if eq $math.type "katex" -}} - {{- $katex := $math.katex -}} - {{- $opts := dict "output" "htmlAndMathml" "displayMode" (eq $.Type "block") }} - {{- $opts = dict "throwOnError" $katex.throwOnError "errorColor" $katex.errorColor | merge $opts }} - {{- $macros := $katex.macros | default dict -}} - {{- if $macros -}} - {{- $opts = dict "macros" $macros | merge $opts -}} - {{- end -}} + {{- $opts := $math.katex | merge (dict "output" "htmlAndMathml" "displayMode" (eq $.Type "block")) }} {{- /* render mathematical markup to HTML */ -}} {{- with try (transform.ToMath .Inner $opts) }} {{- with .Err }} diff --git a/layouts/_partials/base/assets.html b/layouts/_partials/base/assets.html index 719b93a4..a0392ac3 100644 --- a/layouts/_partials/base/assets.html +++ b/layouts/_partials/base/assets.html @@ -14,7 +14,6 @@ */ -}} {{- $noop := .WordCount -}} -{{- $params := partial "function/params.html" -}} {{- $cdn := .Site.Store.Get "cdn" | default dict -}} {{- $fingerprint := .Site.Store.Get "fingerprint" -}} {{- $config := (.Store.Get "this").config -}} @@ -33,36 +32,36 @@ {{- $source := $cdn.autocompleteJS | default "lib/autocomplete-js/index.production.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- $placeholder := $search.placeholder | default (T "assets.searchPlaceholder") -}} - {{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "assets.noResultsFound") "placeholder" $placeholder "clearText" (T "assets.clear") | dict "search" | merge $config -}} + {{- $config = dict "maxResultLength" $search.max_result_length "snippetLength" $search.snippet_length "highlightTag" $search.highlight_tag "noResultsFound" (T "assets.noResultsFound") "placeholder" $placeholder "clearText" (T "assets.clear") | dict "search" | merge $config -}} {{- if eq $search.type "algolia" -}} {{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/browser.umd.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} - {{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}} + {{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.app_id "algoliaSearchKey" $search.algolia.search_key | dict "search" | merge $config -}} {{- else if eq $search.type "fuse" -}} {{- with .Site.Home.OutputFormats.Get "search" -}} {{- $config = dict "type" "fuse" "fuseIndexURL" .RelPermalink | dict "search" | merge $config -}} {{- end -}} {{- dict "Source" "js/lib/fuse.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} - {{- $config = dict "isCaseSensitive" $search.fuse.isCaseSensitive "minMatchCharLength" $search.fuse.minMatchCharLength "findAllMatches" $search.fuse.findAllMatches "location" $search.fuse.location "threshold" $search.fuse.threshold "distance" $search.fuse.distance "ignoreLocation" $search.fuse.ignoreLocation "useExtendedSearch" $search.fuse.useExtendedSearch "ignoreFieldNorm" $search.fuse.ignoreFieldNorm | dict "search" | merge $config -}} + {{- $config = dict "isCaseSensitive" $search.fuse.is_case_sensitive "minMatchCharLength" $search.fuse.min_match_char_length "findAllMatches" $search.fuse.find_all_matches "location" $search.fuse.location "threshold" $search.fuse.threshold "distance" $search.fuse.distance "ignoreLocation" $search.fuse.ignore_location "useExtendedSearch" $search.fuse.use_extended_search "ignoreFieldNorm" $search.fuse.ignore_field_norm | dict "search" | merge $config -}} {{- else if eq $search.type "pagefind" -}} {{- $config = dict "type" "pagefind" | dict "search" | merge $config -}} {{- $pagefind := $search.pagefind | default dict -}} - {{- $bundlePath := relURL ($pagefind.bundlePath | default "pagefind/") -}} + {{- $bundlePath := relURL ($pagefind.bundle_path | default "pagefind/") -}} {{- if not (hasSuffix $bundlePath "/") -}} {{- $bundlePath = printf "%v/" $bundlePath -}} {{- end -}} {{- $config = dict "bundlePath" $bundlePath - "debounceTimeoutMs" ($pagefind.debounceTimeoutMs | default 300) - "useBuiltInFilters" ($pagefind.useBuiltInFilters | default true) - "sortBy" ($pagefind.sortBy | default "") - "sortOrder" ($pagefind.sortOrder | default "desc") + "debounceTimeoutMs" ($pagefind.debounce_timeout_ms | default 300) + "useBuiltInFilters" ($pagefind.use_built_in_filters | default true) + "sortBy" ($pagefind.sort_by | default "") + "sortOrder" ($pagefind.sort_order | default "desc") | dict "pagefind" | merge $config -}} {{- else if eq $search.type "cse" -}} {{- $config = dict "type" "cse" | dict "search" | merge $config -}} {{- $cse := .Site.Params.cse -}} - {{- $resultsPage := $cse.resultsPage -}} + {{- $resultsPage := $cse.results_page -}} {{- if not (hasPrefix $resultsPage (relURL "")) -}} {{- $resultsPage = path.Join (relURL "") $resultsPage -}} {{- end -}} @@ -77,7 +76,7 @@ {{- end -}} {{- /* instant.page */ -}} -{{- if $params.instantPage -}} +{{- if .Param "instant_page" -}} {{- $source := $cdn.instantPage | default "lib/instant-page/instantpage.min.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- end -}} @@ -89,8 +88,18 @@ {{- dict "Source" "js/lib/json-viewer.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- end -}} +{{- /* Mermaid */ -}} +{{- if .Store.Get "hasMermaid" | and (not $isArchivesOrOffline) -}} + {{- if .Store.Get "hasPanzoom" -}} + {{- $source := $cdn.panzoomJS | default "lib/panzoom/panzoom.min.js" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}} + {{- end -}} + {{- $mermaid := dict "Page" . "Key" "mermaid" "ToCamel" true | partial "function/param.html" -}} + {{- $config = dict "mermaid" $mermaid | merge $config -}} +{{- end -}} + {{- /* twemoji */ -}} -{{- if $params.twemoji -}} +{{- if .Param "twemoji" -}} {{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- $config = dict "twemoji" true | merge $config -}} @@ -98,7 +107,7 @@ {{- end -}} {{- /* lightgallery */ -}} -{{- if $params.lightgallery | or (eq $params.lightgallery "force") -}} +{{- if (.Param "lightgallery") | or (eq (.Param "lightgallery") "force") -}} {{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}} {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} {{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}} @@ -119,15 +128,15 @@ {{- /* TypeIt */ -}} {{- if .Store.Get "hasTyped" -}} - {{- $typeit := .Site.Params.typeit -}} + {{- $typeit := partial "function/camel-case-keys.html" .Site.Params.typeit -}} {{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} - {{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "loop" $typeit.loop | dict "typeit" | merge $config -}} + {{- $config = dict "typeit" $typeit | merge $config -}} {{- dict "Source" "js/lib/typeit.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- end -}} {{- /* KaTeX */ -}} -{{- $math := .Store.Get "math" -}} +{{- $math := dict "Page" . "Key" "math" "ToCamel" true | partial "function/param.html" -}} {{- if .Store.Get "hasKaTeX" | and (not $isArchivesOrOffline) -}} {{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}} {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} @@ -185,7 +194,8 @@ {{- $source = $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.js" -}} {{- dict "Source" $source "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} - {{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}} + {{- $mapbox := dict "Page" . "Key" "mapbox" | partial "function/param.html" -}} + {{- $config = dict "accessToken" $mapbox.access_token "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}} {{- dict "Source" "js/lib/mapbox.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- end -}} @@ -244,17 +254,13 @@ {{- end -}} {{- /* Watermark */ -}} -{{- if eq .Site.Params.watermark.enable true -}} +{{- $watermarkConfig := partial "function/camel-case-keys.html" .Site.Params.watermark | default dict -}} +{{- if $watermarkConfig.enable -}} {{- $source := $cdn.cellWatermarkJS | default "lib/cell-watermark/watermark.js" -}} {{- dict "Source" $source "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} - {{- $watermarkConfig := .Site.Params.watermark | default dict -}} {{- $watermarkConfig = dict "appendTo" ".widgets" "content" ($watermarkConfig.content | default $author.name | default .Site.Title) - "rowSpacing" $watermarkConfig.rowSpacing - "colSpacing" $watermarkConfig.colSpacing - "fontSize" $watermarkConfig.fontSize - "fontFamily" $watermarkConfig.fontFamily | merge $watermarkConfig -}} {{- $config = dict "watermark" $watermarkConfig | merge $config -}} @@ -263,7 +269,7 @@ {{- /* Content Decryption */ -}} {{- $encryptPartial := .Store.Get "hasEncryptor" -}} -{{- if $params.password | or $encryptPartial -}} +{{- if .Params.password | or $encryptPartial -}} {{- $cryptoCoreJS := $cdn.cryptoCoreJS | default "lib/crypto-js/core.js" -}} {{- $cryptoEncBase64JS := $cdn.cryptoEncBase64JS | default "lib/crypto-js/enc-base64.js" -}} {{- $cryptoSha256JS := $cdn.cryptoSha256JS | default "lib/crypto-js/sha256.js" -}} @@ -274,7 +280,7 @@ {{- dict "Source" $xxhashWasmJS "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- /* Decryption script */ -}} {{- dict "Source" "js/lib/fixit-decryptor.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} - {{- $config = dict "all" (isset $params "password") "shortcode" ($encryptPartial | default false) | dict "encryption" | merge $config -}} + {{- $config = dict "all" (.Params.password | not | not) "shortcode" ($encryptPartial | default false) | dict "encryption" | merge $config -}} {{- end -}} {{- /* Busuanzi visitor counter */ -}} @@ -284,7 +290,7 @@ {{- end -}} {{- /* Site creation time */ -}} -{{- $siteTime := .Site.Store.Get "siteTime" -}} +{{- $siteTime := .Site.Params.footer.site_time -}} {{- if $siteTime.enable -}} {{- with $siteTime.value -}} {{- $config = dict "siteTime" . | merge $config -}} @@ -307,7 +313,7 @@ {{- /* Auto Bookmark */ -}} {{- if eq .Kind "page" -}} - {{- with $params.autoBookmark -}} + {{- with .Param "auto_bookmark" -}} {{- $config = dict "autoBookmark" . | merge $config -}} {{- end -}} {{- end -}} @@ -333,56 +339,38 @@ {{- end -}} {{- /* Print */ -}} -{{- $config = partial "function/snake2camel.html" .Site.Params.print | dict "print" | merge $config -}} +{{- $config = partial "function/camel-case-keys.html" .Site.Params.print | dict "print" | merge $config -}} {{- /* PostChat */ -}} {{- partial "plugin/post-chat-ai.html" . -}} -{{- range $params.library.css -}} +{{- $library := dict "Page" . "Key" "library" | partial "function/param.html" -}} +{{- range $library.css -}} {{- dict "Source" . "Fingerprint" $fingerprint | dict "Page" $ "Data" | partial "store/style.html" -}} {{- end -}} -{{- range $params.library.js -}} +{{- range $library.js -}} {{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}} {{- end -}} -{{- /* Runtime config script (window.config) */ -}} -{{- $configJS := $config | jsonify | printf "window.config=%s;" -}} -{{- if hugo.IsServer -}} - {{- $configJS = add $configJS "console.log('Page config:', window.config);" -}} -{{- end -}} -{{- $targetPath := "" -}} +{{- /* Runtime config script */ -}} +{{- $configJS := dict "Config" $config | partial "gen/config.html" -}} +{{- $configPath := "" -}} {{- if $uniqueFileId | and (not .IsHome) -}} - {{- $targetPath = printf "%s/js/config/%s.js" $languagePrefix $uniqueFileId -}} + {{- $configPath = printf "%s/js/config/%s.js" $languagePrefix $uniqueFileId -}} {{- end -}} -{{- dict "Content" $configJS "Path" $targetPath "Minify" hugo.IsProduction "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} +{{- dict "Content" $configJS "Path" $configPath "Minify" hugo.IsProduction "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} {{- /* File-tree plugin */ -}} {{- dict "Source" "js/lib/file-tree.ts" "Build" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} -{{- /* Mermaid plugin */ -}} +{{- /* Mermaid module */ -}} {{- if .Store.Get "hasMermaid" | and (not $isArchivesOrOffline) -}} - {{- if .Store.Get "hasPanzoom" -}} - {{- $source := $cdn.panzoomJS | default "lib/panzoom/panzoom.min.js" -}} - {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}} - {{- end -}} - - {{- $mermaid := .Site.Params.mermaid -}} - {{- $mermaidCDN := $mermaid.cdn | default "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs" -}} - {{- $zenumlCDN := $mermaid.zenuml | default "" -}} - {{- $layoutLoaders := $mermaid.layoutloaders | default slice -}} - {{- $options := dict "format" "esm" -}} {{- $mermaidModule := dict "Resource" (resources.Get "js/lib/mermaid.ts") "Build" $options "Fingerprint" $fingerprint | partial "function/js-build.html" -}} - {{- $mermaidModuleURL := $mermaidModule.RelPermalink -}} - {{- $bootstrapJS := dict - "MermaidModuleURL" $mermaidModuleURL - "MermaidCDN" $mermaidCDN - "ZenumlCDN" $zenumlCDN - "LayoutLoaders" $layoutLoaders - "Mermaid" $mermaid - | partial "plugin/mermaid-bootstrap.html" + "MermaidModuleURL" $mermaidModule.RelPermalink + | partial "gen/mermaid-bootstrap.html" | htmlUnescape -}} {{- dict "Content" $bootstrapJS "Path" "js/lib/mermaid-bootstrap.js" "Minify" hugo.IsProduction "Attr" `type="module"` "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}} diff --git a/layouts/_partials/base/breadcrumb.html b/layouts/_partials/base/breadcrumb.html index 67cfda95..d2249142 100644 --- a/layouts/_partials/base/breadcrumb.html +++ b/layouts/_partials/base/breadcrumb.html @@ -3,12 +3,12 @@ <nav aria-label="breadcrumb" class="breadcrumb-container{{ if .Site.Params.breadcrumb.sticky }} sticky{{ end }}"> <ol class="breadcrumb"> {{- range .Ancestors.Reverse -}} - {{- if .IsHome | and (not .Site.Params.breadcrumb.showHome) -}} + {{- if .IsHome | and (not .Site.Params.breadcrumb.show_home) -}} {{- continue -}} {{- end -}} {{- $title := "" -}} - {{- $capitalizeTitles := .Param "capitalizeTitles" -}} + {{- $capitalizeTitles := .Param "capitalize_titles" -}} {{- with .Description -}} {{- $title = . -}} {{- else -}} @@ -23,14 +23,14 @@ {{- $innerText = T "single.home" -}} {{- else -}} {{- $innerText = .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}} - {{- $innerText = cond ((.Param "breadcrumb.capitalize") | and $capitalizeTitles) (title $innerText) $innerText -}} + {{- $innerText = cond (.Site.Params.breadcrumb.capitalize | and $capitalizeTitles) (title $innerText) $innerText -}} {{- end -}} <li class="breadcrumb-item" data-separator="{{ $separator }}"><a href="{{ .RelPermalink }}" title="{{ $title }}">{{ $innerText }}</a></li> {{- end -}} {{- $currentText := .Page.Params.shortTitle | default (lower .LinkTitle | T) | default .LinkTitle -}} - {{- $currentText = cond ((.Param "breadcrumb.capitalize") | and (.Param "capitalizeTitles")) (title $currentText) $currentText -}} + {{- $currentText = cond (.Site.Params.breadcrumb.capitalize | and (.Param "capitalize_titles")) (title $currentText) $currentText -}} <li class="breadcrumb-item active" data-separator="{{ $separator }}" aria-current="page">{{ $currentText }}</li> </ol> </nav> diff --git a/layouts/_partials/base/comment.html b/layouts/_partials/base/comment.html index 09ceddd4..5ab498e9 100644 --- a/layouts/_partials/base/comment.html +++ b/layouts/_partials/base/comment.html @@ -386,8 +386,7 @@ {{- block "custom-comment" . }}{{ end -}} </div> {{- /* lightgallery for Artalk and Twikoo */ -}} - {{- $params := partial "function/params.html" -}} - {{- if not $params.lightgallery | and (($artalk.enable | and $artalk.lightgallery) | or ($twikoo.enable | and $twikoo.lightgallery)) -}} + {{- if not (.Param "lightgallery") | and (($artalk.enable | and $artalk.lightgallery) | or ($twikoo.enable | and $twikoo.lightgallery)) -}} {{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}} {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}} {{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}} diff --git a/layouts/_partials/base/footer.html b/layouts/_partials/base/footer.html index fb8896aa..d72ab573 100644 --- a/layouts/_partials/base/footer.html +++ b/layouts/_partials/base/footer.html @@ -11,11 +11,11 @@ <div class="footer-line powered{{ with $footerConfig.order.powered }} order-{{ . }}{{ end }}"> {{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreferrer" title="Hugo %v">{hugoLogo}Hugo</a>` hugo.Version -}} {{- $theme := printf `<a href="https://github.com/hugo-fixit/FixIt" target="_blank" rel="external" title="FixIt %v">{themeLogo}FixIt</a>` (hugo.Store.Get "version") -}} - {{- if $footerConfig.powered.hugoLogo -}} + {{- if $footerConfig.powered.hugo_logo -}} {{- $hugoLogo := printf `<img class="hugo-icon" src="%v" alt="Hugo logo" /> ` (resources.Get "images/hugo.svg" | minify).RelPermalink -}} {{- $hugo = replace $hugo "{hugoLogo}" $hugoLogo -}} {{- end -}} - {{- if $footerConfig.powered.themeLogo -}} + {{- if $footerConfig.powered.theme_logo -}} {{- $themeLogo := printf `<img class="fixit-icon" src="%v" alt="FixIt logo" /> ` (resources.Get "images/fixit.svg" | minify).RelPermalink -}} {{- $theme = replace $theme "{themeLogo}" $themeLogo -}} {{- end -}} @@ -53,7 +53,7 @@ </div> {{- end -}} - {{- $siteTime := .Site.Store.Get "siteTime" -}} + {{- $siteTime := .Site.Params.footer.site_time -}} {{- if $siteTime.enable -}} <div class="footer-line statistics{{ with $footerConfig.order.statistics }} order-{{ . }}{{ end }}"> {{- if $siteTime.enable | and $siteTime.value -}} diff --git a/layouts/_partials/base/head/index.html b/layouts/_partials/base/head/index.html index 04ed514d..3e363d9f 100644 --- a/layouts/_partials/base/head/index.html +++ b/layouts/_partials/base/head/index.html @@ -50,7 +50,7 @@ {{- end -}} {{- /* Mastodon Verification */ -}} -{{- with .Site.Params.social.Mastodon -}} +{{- with .Site.Params.social.mastodon -}} {{- $id := "" -}} {{- $prefix := "https://mastodon.social/" -}} {{- if reflect.IsMap . -}} @@ -66,7 +66,7 @@ {{- end -}} {{- /* ========== LINK: Favicon, Canonical, Feeds, Stylesheets ========== */ -}} -{{- $title := printf "%s %s %s" .Title .Site.Params.titleDelimiter .Site.Title -}} +{{- $title := printf "%s %s %s" .Title .Site.Params.title_delimiter .Site.Title -}} {{- if .IsHome -}} {{- $title = .Site.Title -}} {{- end -}} @@ -123,8 +123,6 @@ <link rel="preload" href="{{ $mainResource.RelPermalink }}" as="script"> {{- /* ========== SEO: Structured Data (Schema.org) ========== */ -}} -{{- $params := partial "function/params.html" -}} - {{- /* Search Engine Verification */ -}} {{- with .Site.Params.verification.google -}} <meta name="google-site-verification" content="{{ . }}" /> @@ -167,7 +165,7 @@ {{- with .Site.Params.description -}} "description": {{ . | safeHTML }}, {{- end -}} - {{- $image := .Site.Params.seo.image -}} + {{- $image := .Site.Params.seo.cover -}} {{- with dict "Path" $image | partial "function/resource.html" -}} "image": { "@type": "ImageObject", @@ -180,7 +178,7 @@ "image": "{{ . | absURL }}", {{- end -}} {{- end -}} - {{- with .Site.Params.seo.thumbnailUrl -}} + {{- with .Site.Params.seo.thumbnail_url -}} {{- with dict "Path" . | partial "function/resource.html" -}} "thumbnailUrl": "{{ .Permalink }}", {{- else -}} @@ -204,6 +202,7 @@ {{- $authorName = . -}} {{- end -}} {{- end -}} + {{- $seo := dict "Page" . "Key" "seo" | partial "function/param.html" -}} <script type="application/ld+json"> { "@context": "http://schema.org", @@ -214,7 +213,7 @@ "@type": "WebPage", "@id": "{{ .Permalink }}" }, - {{- $images := $params.seo.images | default slice -}} + {{- $images := $seo.images | default slice -}} {{- if not $images -}} {{- with .Resources.GetMatch "featured-image-preview" -}} {{- $images = slice "featured-image-preview" -}} @@ -223,7 +222,7 @@ {{- $images = slice "featured-image" -}} {{- end -}} {{- end -}} - {{- with .Site.Params.seo.image -}} + {{- with .Site.Params.seo.cover -}} {{- $images = $images | default (slice .) -}} {{- end -}} {{- with $images -}} @@ -263,11 +262,11 @@ "license": {{ . | safeHTML }}, {{- end -}} {{- $publisher := $authorName | dict "name" -}} - {{- $publisher = $params.seo.publisher | default dict | merge $publisher -}} + {{- $publisher = $seo.publisher | default dict | merge $publisher -}} "publisher": { "@type": "Organization", "name": {{ $publisher.name | safeHTML }} - {{- $logo := $publisher.logoUrl -}} + {{- $logo := $publisher.logo_url -}} {{- with dict "Path" $logo | partial "function/resource.html" -}} ,"logo": { "@type": "ImageObject", @@ -296,7 +295,7 @@ {{- /* Theme Color Scheme & Platform Detection (runs before page render) */ -}} {{- $options := dict "targetPath" "js/head.js" -}} -{{- $options = dict "defaultTheme" .Site.Params.defaulttheme | dict "params" | merge $options -}} +{{- $options = dict "defaultTheme" .Site.Params.default_theme | dict "params" | merge $options -}} {{- dict "Source" "js/head/index.ts" "Build" $options "Fingerprint" $fingerprint | partial "plugin/script.html" -}} {{- /* Custom head */ -}} diff --git a/layouts/_partials/base/header.html b/layouts/_partials/base/header.html index 554ffbec..b3d2074f 100644 --- a/layouts/_partials/base/header.html +++ b/layouts/_partials/base/header.html @@ -3,7 +3,7 @@ {{- /* Desktop header */ -}} <header class="desktop animate__faster{{ if .Site.Params.header.blur }} is-blur{{ end }}" id="header-desktop"> - <div class="header-wrapper"{{ if .Site.Params.githubCorner.enable }} data-github-corner="{{ .Site.Params.githubCorner.position }}"{{ end }}> + <div class="header-wrapper"{{ if .Site.Params.github_corner.enable }} data-github-corner="{{ .Site.Params.github_corner.position }}"{{ end }}> <div class="header-title"> <a href="{{ $relLangURL }}" title="{{ .Site.Title }}" class="header-title-link"> {{- with .Site.Params.header.title -}} diff --git a/layouts/_partials/base/widgets.html b/layouts/_partials/base/widgets.html index d5905a87..24ead078 100644 --- a/layouts/_partials/base/widgets.html +++ b/layouts/_partials/base/widgets.html @@ -1,6 +1,5 @@ <div class="widgets"> - {{- $backToTop := .Site.Params.backToTop -}} - {{- $params := partial "function/params.html" -}} + {{- $backToTop := .Site.Params.back_to_top -}} {{- $comment := .Store.Get "comment" -}} {{- if $backToTop.enable | or $comment.enable -}} <div class="fixed-buttons"> @@ -18,7 +17,7 @@ {{- end -}} {{- /* toc dialog button */ -}} {{- if .Store.Get "showToc" -}} - <button type="button" id="toc-drawer-button" class="fixed-button toc-drawer-button hidden{{ with $params.password }} encrypted-hidden{{ end }}" aria-label="{{ T `single.contents` }}" aria-controls="toc-dialog" aria-expanded="false"> + <button type="button" id="toc-drawer-button" class="fixed-button toc-drawer-button hidden{{ with .Params.password }} encrypted-hidden{{ end }}" aria-label="{{ T `single.contents` }}" aria-controls="toc-dialog" aria-expanded="false"> {{- dict "Class" "fa-solid fa-bars" | partial "plugin/icon.html" -}} </button> {{- end -}} @@ -32,7 +31,7 @@ {{- end -}} {{- /* GitHub Corners */ -}} - {{- $githubCorner := .Site.Params.githubCorner -}} + {{- $githubCorner := .Site.Params.github_corner -}} {{- if $githubCorner.enable -}} {{- with $githubCorner -}} {{- $githubImage := `<svg viewBox="0 0 250 250" aria-hidden="true" width="56" height="56"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg>` -}} @@ -88,7 +87,7 @@ {{- end -}} {{- /* Reading progress bar */ -}} - {{- $readingProgress := .Site.Params.readingProgress -}} + {{- $readingProgress := .Site.Params.reading_progress -}} {{- if $readingProgress.enable -}} {{- with $readingProgress -}} {{- $style := printf "%v: 0;%v: 0;" (.Start | default "left") (.Position | default "top") -}} @@ -109,10 +108,7 @@ {{- end -}} {{- /* Link Guard Dialog */ -}} - {{- $linkGuard := .Site.Params.link.guard -}} - {{- with .Params.link_guard -}} - {{- $linkGuard = (cond (reflect.IsMap .) . (dict "enable" .)) | merge $linkGuard -}} - {{- end -}} + {{- $linkGuard := (dict "Page" . "Key" "link" | partial "function/param.html").guard | default dict -}} {{- if $linkGuard.enable | and (eq $linkGuard.mode "modal") -}} <dialog id="link-guard-dialog" aria-labelledby="link-guard-dialog-title" closedby="any"> <div class="guard-content"> @@ -132,9 +128,6 @@ </dialog> {{- end -}} - {{- /* Custom widgets */ -}} - {{- block "custom-widgets" . }}{{ end -}} - {{- /* Service Worker Update Notification */ -}} {{- if .Site.Params.app.pwa -}} <div class="sw-update-notification"> @@ -146,6 +139,9 @@ </div> {{- end -}} + {{- /* Custom widgets */ -}} + {{- block "custom-widgets" . }}{{ end -}} + <noscript> <div class="noscript-warning bg-danger text-white text-base font-bold fixed text-center inset-x-0 bottom-0 w-full z-fixed">{{ T "baseof.noscript" }}</div> </noscript> diff --git a/layouts/_partials/custom.html b/layouts/_partials/custom.html index 74141f2f..b4637e19 100644 --- a/layouts/_partials/custom.html +++ b/layouts/_partials/custom.html @@ -1,104 +1,104 @@ {{- define "custom-head" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.head -}} + {{- range .Site.Params.custom_partials.head -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-menu:desktop" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.menuDesktop -}} + {{- range .Site.Params.custom_partials.menu_desktop -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-menu:mobile" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.menuMobile -}} + {{- range .Site.Params.custom_partials.menu_mobile -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-profile" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.profile -}} + {{- range .Site.Params.custom_partials.profile -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-aside" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.aside -}} + {{- range .Site.Params.custom_partials.aside -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-comment" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.comment -}} + {{- range .Site.Params.custom_partials.comment -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-footer" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.footer -}} + {{- range .Site.Params.custom_partials.footer -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-widgets" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.widgets -}} + {{- range .Site.Params.custom_partials.widgets -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-assets" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.assets -}} + {{- range .Site.Params.custom_partials.assets -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-post__toc:before" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.postTocBefore -}} + {{- range .Site.Params.custom_partials.post_toc_before -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-post__toc:after" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.postTocAfter -}} + {{- range .Site.Params.custom_partials.post_toc_after -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-post__content:before" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.postContentBefore -}} + {{- range .Site.Params.custom_partials.post_content_before -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-post__content:after" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.postContentAfter -}} + {{- range .Site.Params.custom_partials.post_content_after -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-post__footer:before" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.postFooterBefore -}} + {{- range .Site.Params.custom_partials.post_footer_before -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} {{- define "custom-post__footer:after" -}} {{- $ctx := . -}} - {{- range .Site.Params.customPartials.postFooterAfter -}} + {{- range .Site.Params.custom_partials.post_footer_after -}} {{- partial . $ctx -}} {{- end -}} {{- end -}} diff --git a/layouts/_partials/feed/rss.html b/layouts/_partials/feed/rss.html index 3f3f34f9..3d6effc8 100644 --- a/layouts/_partials/feed/rss.html +++ b/layouts/_partials/feed/rss.html @@ -1,8 +1,12 @@ {{- $pages := .Pages -}} {{- /* Front matter: password */ -}} {{- $pages = where $pages "Params.password" "eq" nil -}} -{{- /* Front matter: hiddenFromFeed */ -}} -{{- $pages = where $pages "Params.hiddenFromFeed" "ne" true -}} +{{- /* Front matter: hidden_from_feed */ -}} +{{- if .Site.Params.hidden_from_feed -}} + {{- $pages = where $pages "Params.hidden_from_feed" false -}} +{{- else -}} + {{- $pages = where $pages "Params.hidden_from_feed" "!=" true -}} +{{- end -}} {{- if ge .Config.limit 1 -}} {{- $pages = $pages | first .Config.limit -}} {{- end -}} @@ -13,10 +17,10 @@ <title>{{ .Title }} {{ .Permalink }} {{ .Site.Params.description | default .Site.Title }} - {{- 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) }} - {{ .Site.Params.feed.follow.feedId }} - {{ .Site.Params.feed.follow.userId }} + {{ .Site.Params.feed.follow.feed_id }} + {{ .Site.Params.feed.follow.user_id }} {{- end }} Hugo {{ hugo.Version }} & FixIt {{ hugo.Store.Get "version" }} @@ -29,19 +33,9 @@ {{ printf "" .Permalink .MediaType | safeHTML }} {{- end }} {{- range $page := $pages }} - {{- $params := .Params | merge .Site.Params.Page }} - {{- $fullText := ((.Params.feed | default dict) | merge $.Config ).fulltext }} + {{- $fullText := ((.Params.feed | default dict) | merge $.Config ).full_text }} {{- $author := partial "function/get-author-map.html" .Params.author }} - {{- $image := $params.featuredimagepreview | default $params.featuredimage }} - {{- with dict "Path" $image "Resources" .Resources | partial "function/resource.html" }} - {{- $image = .Permalink }} - {{- end }} - {{- with .Resources.GetMatch "featured-image" }} - {{- $image = .Permalink }} - {{- end }} - {{- with .Resources.GetMatch "featured-image-preview" }} - {{- $image = .Permalink }} - {{- end }} + {{- $cover := dict "Page" . "Preview" true "Build" true | partial "function/get-cover.html" -}} {{ .Title }} {{ .Permalink }} @@ -55,7 +49,7 @@ {{- end }} {{- if $fullText }} - {{- 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" -}} {{- else }} {{ (.Summary | default .Description | default .Title) | transform.XMLEscape | safeHTML }} diff --git a/layouts/_partials/function/snake2camel.html b/layouts/_partials/function/camel-case-keys.html similarity index 62% rename from layouts/_partials/function/snake2camel.html rename to layouts/_partials/function/camel-case-keys.html index 5ba4959b..549b9c97 100644 --- a/layouts/_partials/function/snake2camel.html +++ b/layouts/_partials/function/camel-case-keys.html @@ -4,8 +4,8 @@ This is mainly used to avoid problems caused by Hugo's case-insensitive config key parsing. Keep config keys in snake_case, then convert them here for stable access in templates and JS. - @param {map} . - The input map/object with snake_case keys - @return {map} A new map with camelCase keys, or the input if it's not a map + @param {Map|Slice} . - The input with snake_case keys + @return {Map|Slice} A new value with camelCase keys @example // Simple Map conversion @@ -24,9 +24,7 @@ @example // Practical usage in templates - {{- $siteParams := partial "function/snake2camel.html" .Site.Params }} - // Now access parameters with camelCase: $siteParams.codeBlock.enableWrapper - // [todo] refactor all config to use snake_case in Hugo config files, and camelCase in templates and JS (v1.0 breaking change) + {{- $siteParams := partial "function/camel-case-keys.html" .Site.Params }} */ -}} {{- $input := . -}} {{- $output := dict -}} @@ -34,23 +32,8 @@ {{- if reflect.IsMap $input -}} {{- /* Process map: iterate through all key-value pairs */ -}} {{- range $key, $value := $input -}} - {{- /* - Convert key from snake_case to camelCase - Example: "max_shown_lines" -> "maxShownLines" - Strategy: split by "_", capitalize first letter of each part (except first), then concatenate - */ -}} - {{- $parts := split $key "_" -}} - {{- $newKey := index $parts 0 -}} - {{- range $i, $part := $parts -}} - {{- if gt $i 0 -}} - {{- /* Capitalize first letter, preserve the rest */ -}} - {{- $first := upper (substr $part 0 1) -}} - {{- $rest := substr $part 1 -}} - {{- $newKey = printf "%s%s%s" $newKey $first $rest -}} - {{- end -}} - {{- end -}} - - {{- /* + {{- $newKey := partial "function/camel-case.html" $key -}} + {{- /* Recursively process value based on its type - For nested maps: recursively convert all nested keys - For arrays: process each map element in the array @@ -58,18 +41,18 @@ */ -}} {{- $newValue := $value -}} {{- if reflect.IsMap $value -}} - {{- $newValue = partial "function/snake2camel.html" $value -}} + {{- $newValue = partial "function/camel-case-keys.html" $value -}} {{- else if reflect.IsSlice $value -}} {{- $newValue = slice -}} {{- range $item := $value -}} {{- if reflect.IsMap $item -}} - {{- $newValue = $newValue | append (partial "function/snake2camel.html" $item) -}} + {{- $newValue = $newValue | append (partial "function/camel-case-keys.html" $item) -}} {{- else -}} {{- $newValue = $newValue | append $item -}} {{- end -}} {{- end -}} {{- end -}} - + {{- /* Add the converted key-value pair to output */ -}} {{- $output = merge $output (dict $newKey $newValue) -}} {{- end -}} @@ -79,13 +62,12 @@ {{- $output := slice -}} {{- range $item := $input -}} {{- if reflect.IsMap $item -}} - {{- $output = $output | append (partial "function/snake2camel.html" $item) -}} + {{- $output = $output | append (partial "function/camel-case-keys.html" $item) -}} {{- else -}} {{- $output = $output | append $item -}} {{- end -}} {{- end -}} {{- return $output -}} {{- else -}} - {{- /* Return scalar values unchanged */ -}} {{- return $input -}} {{- end -}} diff --git a/layouts/_partials/function/camel-case.html b/layouts/_partials/function/camel-case.html new file mode 100644 index 00000000..bda38357 --- /dev/null +++ b/layouts/_partials/function/camel-case.html @@ -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 -}} diff --git a/layouts/_partials/function/code-header.html b/layouts/_partials/function/code-header.html index a41c6d59..4174055e 100644 --- a/layouts/_partials/function/code-header.html +++ b/layouts/_partials/function/code-header.html @@ -16,11 +16,11 @@ {{- if $config.title -}} {{- $titleEl = printf `%s%s` $foldIcon $config.title -}} {{- end -}} -{{- if $config.linenostoggler -}} +{{- if $config.line_nos_toggler -}} {{- $lineNosIcon := dict "Class" "fa-solid fa-list-ol" | partial "plugin/icon.html" -}} {{- $lineNosBtn = printf `` (T "assets.toggleLineNumbers") (T "assets.toggleLineNumbers") $lineNosIcon -}} {{- end -}} -{{- if $config.linewraptoggler -}} +{{- if $config.line_wrap_toggler -}} {{- $lineWrapIcon := dict "Class" "fa-solid fa-right-left" | partial "plugin/icon.html" -}} {{- $lineWrapBtn = printf `` (T "assets.toggleLineWrap") (T "assets.toggleLineWrap") $lineWrapIcon -}} {{- end -}} diff --git a/layouts/_partials/function/get-author-map.html b/layouts/_partials/function/get-author-map.html index d8c45835..a8b12d97 100644 --- a/layouts/_partials/function/get-author-map.html +++ b/layouts/_partials/function/get-author-map.html @@ -1,6 +1,6 @@ {{- /* Get author in map format. - @param {String|Map} . the author name or map + @param {String|Map} . - The author name or map @returns {Map} @example {{- $author := partial "function/get-author-map.html" .Params.author -}} */ -}} diff --git a/layouts/_partials/function/get-cover.html b/layouts/_partials/function/get-cover.html new file mode 100644 index 00000000..85dc5c84 --- /dev/null +++ b/layouts/_partials/function/get-cover.html @@ -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 }}{{ 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) -}} diff --git a/layouts/_partials/function/get-file-tree.html b/layouts/_partials/function/get-file-tree.html index 53ea3f2e..1205b4d3 100644 --- a/layouts/_partials/function/get-file-tree.html +++ b/layouts/_partials/function/get-file-tree.html @@ -7,24 +7,24 @@ NOTE: For performance reasons, the recursion depth is limited to 10 levels by default. - @param {string} root - The root path to scan (relative to project root or contentDir) - @param {string} [path] - The directory path for recursive calls - @param {int} [level=10] - Descend only level directories deep - @param {int} [deep=0] - Current depth level for recursive calls - @param {array} [ignoreList] - List of file or folder names to ignore - @param {boolean} [isRecursive=false] - Internal flag for recursive calls - @param {string} [name] - Project name for the root node, if set to `{path}`, uses the full root path - @param {string} [lang] - Page language for multilingual sites - @param {boolean} [log=false] - Whether to log warnings - @return {array} Array of tree items with structure: {name, type, children?}, or empty array if root doesn't exist + @param {String} root - The root path to scan (relative to project root or contentDir) + @param {String} [path] - The directory path for recursive calls + @param {Int} [level=10] - Descend only level directories deep + @param {Int} [deep=0] - Current depth level for recursive calls + @param {Array} [ignore_list] - List of file or folder names to ignore + @param {Boolean} [is_recursive=false] - Internal flag for recursive calls + @param {String} [name] - Project name for the root node, if set to `{path}`, uses the full root path + @param {String} [lang] - Page language for multilingual sites + @param {Boolean} [log=false] - Whether to log warnings + @return {Array} Array of tree items with structure: {name, type, children?}, or empty array if root doesn't exist */ -}} {{- $result := slice -}} {{- $level := .level | default 10 -}} {{- $deep := .deep | default 0 -}} -{{- $isRecursive := .isRecursive | default false -}} +{{- $isRecursive := .is_recursive | default false -}} {{- $_ignoreList := slice ".DS_Store" "Thumbs.db" ".directory" ".git" "node_modules" "public" -}} -{{- $ignoreList := .ignoreList | default slice | union $_ignoreList -}} +{{- $ignoreList := .ignore_list | default slice | union $_ignoreList -}} {{- $_debug := eq hugo.Environment "debug" | and hugo.IsServer -}} {{- if $isRecursive -}} @@ -41,7 +41,7 @@ {{- $item := dict "name" .Name "type" (cond .IsDir "dir" "file") -}} {{- if .IsDir -}} {{- $fullPath := path.Clean (path.Join $path .Name) -}} - {{- $childOptions := dict "path" $fullPath "deep" (add $deep 1) "ignoreList" $ignoreList "isRecursive" true -}} + {{- $childOptions := dict "path" $fullPath "deep" (add $deep 1) "ignore_list" $ignoreList "is_recursive" true -}} {{- $children := partial "function/get-file-tree.html" $childOptions -}} {{- $item = merge $item (dict "children" $children) -}} {{- end -}} @@ -85,7 +85,7 @@ {{- /* Build children recursively */ -}} {{- if $_debug -}}{{- warnf "[file-tree]> %v:" $rootLabel -}}{{- end -}} - {{- $childOptions := dict "path" $root "deep" (add $deep 1) "level" $level "ignoreList" $ignoreList "isRecursive" true -}} + {{- $childOptions := dict "path" $root "deep" (add $deep 1) "level" $level "ignore_list" $ignoreList "is_recursive" true -}} {{- $children := partial "function/get-file-tree.html" $childOptions -}} {{- /* Return root item with children */ -}} diff --git a/layouts/_partials/function/get-gravatar.html b/layouts/_partials/function/get-gravatar.html index 1a6d2fb0..8c575c9b 100644 --- a/layouts/_partials/function/get-gravatar.html +++ b/layouts/_partials/function/get-gravatar.html @@ -1,8 +1,8 @@ {{- /* Get Gravatar URL. - @param {String} Email the email address - @param {String} Size the size in pixels (optional, default: 200) - @returns {String} the Gravatar URL + @param {String} Email - The email address + @param {String} Size - The size in pixels (optional, default: 200) + @returns {String} The Gravatar URL @example {{- $gravatar := dict "Email" "user@example.com" "Size" "32" | partial "function/get-gravatar.html" -}} */ -}} diff --git a/layouts/_partials/function/get-taxonomy-icon.html b/layouts/_partials/function/get-taxonomy-icon.html index 386ee79c..6072b3be 100644 --- a/layouts/_partials/function/get-taxonomy-icon.html +++ b/layouts/_partials/function/get-taxonomy-icon.html @@ -1,9 +1,9 @@ {{- /* Resolve taxonomy icon by slot with site-level overrides. - @param {String} .Taxonomy taxonomy singular key, e.g. "tag", "category" - @param {String} .Slot icon slot: "title", "card", "term" - @return {String} icon class + @param {String} .Taxonomy - Taxonomy singular key, e.g. "tag", "category" + @param {String} .Slot - Icon slot: "title", "card", "term" + @return {String} Icon class */ -}} {{- $taxonomy := .Taxonomy | default "category" -}} {{- $slot := .Slot | default "title" -}} diff --git a/layouts/_partials/function/js-build.html b/layouts/_partials/function/js-build.html index 7fb1e532..17f13ce0 100644 --- a/layouts/_partials/function/js-build.html +++ b/layouts/_partials/function/js-build.html @@ -1,9 +1,9 @@ {{- /* Build and minify a JS resource with unified behavior. - @param {resource.Resource} .Resource Hugo resource to process - @param {Object|Boolean} [.Build] true for defaults, dict for custom options, false/omit to skip js.Build - @param {Boolean} [.Minify] extra minify flag; final minify is Minify OR Build.minify - @param {String} [.Fingerprint] fingerprint algorithm (e.g. "sha256") + @param {resource.Resource} .Resource - Hugo resource to process + @param {Object|Boolean} [.Build] - True for defaults, dict for custom options, false/omit to skip js.Build + @param {Boolean} [.Minify] - Extra minify flag; final minify is Minify OR Build.minify + @param {String} [.Fingerprint] - Fingerprint algorithm (e.g. "sha256") @return {resource.Resource} */ -}} diff --git a/layouts/_partials/function/param.html b/layouts/_partials/function/param.html new file mode 100644 index 00000000..d942aedb --- /dev/null +++ b/layouts/_partials/function/param.html @@ -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 -}} diff --git a/layouts/_partials/function/params.html b/layouts/_partials/function/params.html deleted file mode 100644 index 8ba6a0e8..00000000 --- a/layouts/_partials/function/params.html +++ /dev/null @@ -1,2 +0,0 @@ -{{- $params := page.Params | merge site.Params.page -}} -{{- return $params -}} \ No newline at end of file diff --git a/layouts/_partials/function/task-lists.html b/layouts/_partials/function/task-lists.html index 99d54202..ab7120a8 100644 --- a/layouts/_partials/function/task-lists.html +++ b/layouts/_partials/function/task-lists.html @@ -13,7 +13,7 @@ "\\?" "fa-regular fa-circle-question" -}} {{- /* Custom Task lists */ -}} -{{- $iconMap = site.Params.taskList | merge $iconMap -}} +{{- $iconMap = site.Params.task_list | merge $iconMap -}} {{- /* Get the extended signs */ -}} {{- $extendedSigns := slice -}} diff --git a/layouts/_partials/function/to-css.html b/layouts/_partials/function/to-css.html index b30a9bdf..356965ee 100644 --- a/layouts/_partials/function/to-css.html +++ b/layouts/_partials/function/to-css.html @@ -1,9 +1,9 @@ {{- /* Compile SCSS to CSS via dartsass, optionally minify and fingerprint. - @param {resource.Resource} .Resource SCSS resource - @param {Object|Boolean} [.ToCSS] true for defaults, dict for custom toCSS options, false/omit to skip - @param {Boolean} [.Minify] whether to minify; defaults to hugo.IsProduction when ToCSS is used - @param {String} [.Fingerprint] fingerprint algorithm (e.g. "sha256") + @param {resource.Resource} .Resource - SCSS resource + @param {Object|Boolean} [.ToCSS] - True for defaults, dict for custom toCSS options, false/omit to skip + @param {Boolean} [.Minify] - Whether to minify; defaults to hugo.IsProduction when ToCSS is used + @param {String} [.Fingerprint] - Fingerprint algorithm (e.g. "sha256") @return {resource.Resource} */ -}} diff --git a/layouts/_partials/gen/config.html b/layouts/_partials/gen/config.html new file mode 100644 index 00000000..f2deaa47 --- /dev/null +++ b/layouts/_partials/gen/config.html @@ -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=;) +*/ -}} + +{{- $content := .Config | jsonify | printf "window.config=%s;" -}} +{{- if hugo.IsServer -}} + {{- $content = add $content "console.log('Page config:', window.config);" -}} +{{- end -}} +{{- return $content -}} diff --git a/layouts/_partials/gen/mermaid-bootstrap.html b/layouts/_partials/gen/mermaid-bootstrap.html new file mode 100644 index 00000000..7262a05a --- /dev/null +++ b/layouts/_partials/gen/mermaid-bootstrap.html @@ -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) +-}} diff --git a/layouts/_partials/home/profile.html b/layouts/_partials/home/profile.html index 5e7c8596..a3de2cb9 100644 --- a/layouts/_partials/home/profile.html +++ b/layouts/_partials/home/profile.html @@ -2,7 +2,7 @@ {{- $author := partial "function/get-author-map.html" .Params.author -}}
- {{- $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 -}}
{{- $menus := $.Site.Menus.main | default slice -}} @@ -12,9 +12,9 @@ (dict "Process" "fill center 192x192 webp" "descriptor" "192w") -}} {{- $avatarMenuIndex := 0 -}} - {{- if $profile.avatarMenu -}} + {{- if $profile.avatar_menu -}} {{- range $index, $menu := $menus -}} - {{- if eq $menu.Identifier $profile.avatarMenu -}} + {{- if eq $menu.Identifier $profile.avatar_menu -}} {{- $avatarMenuIndex = $index -}} {{- end -}} {{- end -}} diff --git a/layouts/_partials/init/compatibility.html b/layouts/_partials/init/compatibility.html index e6917fdb..eb4ceb9c 100644 --- a/layouts/_partials/init/compatibility.html +++ b/layouts/_partials/init/compatibility.html @@ -16,7 +16,7 @@ {{- end -}} {{- /* object-fit-images */ -}} -{{- if $compatibility.objectFit -}} +{{- if $compatibility.object_fit -}} {{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}} {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/script.html" -}} {{- end -}} diff --git a/layouts/_partials/init/detection-deprecated.html b/layouts/_partials/init/detection-deprecated.html index d9f32636..56acd27b 100644 --- a/layouts/_partials/init/detection-deprecated.html +++ b/layouts/_partials/init/detection-deprecated.html @@ -6,6 +6,113 @@ {{- $warns = $warns | append "The parameter `params.externalIcon` is deprecated since v1.0.0, use `params.link.external_icon` instead." -}} {{- end -}} +{{- /* params.page structural migration warnings */ -}} +{{- $deprecatedPageKeys := slice + "capitalize_titles" "summary_plainify" "author_avatar" + "hidden_from_home_page" "hidden_from_search" "hidden_from_related" "hidden_from_feed" + "twemoji" "lightgallery" "ruby" "fraction" "fontawesome" "license" + "page_style" "auto_bookmark" "show_lastmod" "word_count" "reading_time" "end_flag" + "instant_page" "collection_list" "collection_navigation" "edit_url" "source_url" + "featured_image" "featured_image_preview" + "toc" "expiration_reminder" "heading" "math" "mapbox" + "related" "reward" "share" "comment" "library" "seo" +-}} +{{- $onlyFrontMatters := slice "subtitle" "featured_image" "featured_image_preview" "repost" -}} +{{- range $deprecatedPageKeys -}} + {{- $newKey := . -}} + {{- $oldKey := replace . "_" "" -}} + {{- $oldDisplay := partial "function/camel-case.html" $newKey -}} + {{- if (in $.Site.Params.page $oldKey) | and (not (in $onlyFrontMatters $newKey)) -}} + {{- $warns = $warns | append (printf "The parameter `params.page.%s` has been removed since v1.0.0, use `params.%s` instead." $oldDisplay $newKey) -}} + {{- end -}} + {{- if (in $.Site.Params.page $oldKey) | and (in $onlyFrontMatters $newKey) -}} + {{- $warns = $warns | append (printf "The parameter `params.page.%s` has been removed since v1.0.0, use front matter parameter `%s` instead." $oldDisplay $newKey) -}} + {{- end -}} + {{- if (in $.Page.Params $oldKey) | and (in $newKey "_") -}} + {{- $warns = $warns | append (printf "Front matter parameter `%s` is deprecated since v1.0.0, use `%s` instead." $oldDisplay $newKey) -}} + {{- end -}} +{{- end -}} + +{{- /* camelCase → snake_case param/section rename warnings */ -}} +{{- $deprecatedKeys := slice + "default_theme" + "date_format" + "with_site_title" + "disable_theme_inject" + "title_delimiter" + "index_with_subtitle" + "enable_translation_merge" + "tag_cloud" + "post_chat" + "post_summary" + "git_info" + "back_to_top" + "reading_progress" + "github_corner" + "recently_updated" + "json_viewer" + "custom_partials" + "task_list" + "repo_version" +-}} +{{- range $deprecatedKeys -}} + {{- $newKey := . -}} + {{- $oldKey := replace . "_" "" -}} + {{- $oldDisplay := partial "function/camel-case.html" $newKey -}} + {{- with index $.Site.Params $oldKey -}} + {{- $warns = $warns | append (printf "The parameter `params.%s` has been removed since v1.0.0, use `params.%s` instead." $oldDisplay $newKey) -}} + {{- end -}} +{{- end -}} + +{{- /* Nested camelCase key rename warnings */ -}} +{{- $deprecatedNestedKeys := dict + "search" (slice "content_length" "absolute_url" "max_result_length" "snippet_length" "highlight_tag") + "search.algolia" (slice "app_id" "search_key") + "header" (slice "desktop_mode" "mobile_mode") + "breadcrumb" (slice "show_home") + "navigation" (slice "in_section") + "footer.powered" (slice "hugo_logo" "theme_logo") + "footer" (slice "site_time") + "home.profile" (slice "only_first_page" "gravatar_email" "avatar_url" "avatar_menu") + "home.posts" (slice "image_preview") + "watermark" (slice "row_spacing" "col_spacing" "font_size" "font_family") + "busuanzi" (slice "site_views" "page_views") + "image" (slice "cache_remote" "black_list") + "mermaid" (slice "security_level" "font_family" "layout_loaders") + "codeblock" (slice "wrapper_class" "max_shown_lines" "line_nos_toggler" "line_wrap_toggler") + "filetree" (slice "folder_slash" "ignore_list") + "math.katex" (slice "copy_tex" "throw_on_error" "error_color") + "math.mathjax.options" (slice "enable_menu" "skip_html_tags" "ignore_html_class") + "post_summary" (slice "post_url" "word_limit" "typing_animate" "beginning_text" "loading_text") +-}} +{{- range $sectionPath, $keys := $deprecatedNestedKeys -}} + {{- $parts := split $sectionPath "." -}} + {{- $section := $.Site.Params -}} + {{- $valid := true -}} + {{- range $parts -}} + {{- if reflect.IsMap $section -}} + {{- $section = index $section . -}} + {{- else -}} + {{- $valid = false -}} + {{- end -}} + {{- end -}} + {{- if $valid | and (reflect.IsMap $section) -}} + {{- range $keys -}} + {{- $newKey := . -}} + {{- $oldKey := replace . "_" "" -}} + {{- $oldDisplay := partial "function/camel-case.html" $newKey -}} + {{- with index $section $oldKey -}} + {{- $warns = $warns | append (printf "The parameter `params.%s.%s` has been removed since v1.0.0, use `params.%s.%s` instead." $sectionPath $oldDisplay $sectionPath $newKey) -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{- /* Front matter key migration warnings */ -}} +{{- with $.Page.Params.link_guard -}} + {{- $warns = $warns | append "Front matter parameter `link_guard` has been removed since v1.0.0, use `link.guard` instead." -}} +{{- end -}} + {{- if fileExists "assets/css/_custom.scss" -}} {{- $warns = $warns | append "The file `assets/css/_custom.scss` is deprecated. Please move your custom styles to `assets/scss/custom.scss`." -}} {{- end -}} diff --git a/layouts/_partials/init/detection-env.html b/layouts/_partials/init/detection-env.html index 69e0285d..37dae512 100644 --- a/layouts/_partials/init/detection-env.html +++ b/layouts/_partials/init/detection-env.html @@ -1,5 +1,4 @@ {{- /* FixIt theme environment detection */ -}} -{{- $params := partial "function/params.html" -}} {{- if hugo.IsProduction -}} {{- $cdn := .Site.Params.cdn -}} @@ -14,12 +13,7 @@ {{- .Site.Store.Set "cdn" $cdn -}} {{- .Site.Store.Set "fingerprint" .Site.Params.fingerprint -}} {{- .Site.Store.Set "analytics" .Site.Params.analytics -}} - {{- .Store.Set "comment" $params.comment -}} - {{- if eq .Params.comment true -}} - {{- .Store.Set "comment" .Site.Params.page.comment -}} - {{- else if eq .Params.comment false -}} - {{- .Store.Set "comment" (dict "enable" false) -}} - {{- end -}} + {{- .Store.Set "comment" (dict "Page" . "Key" "comment" | partial "function/param.html") -}} {{- else -}} {{- .Site.Store.Set "devOpts" .Site.Params.dev -}} {{- if ne .Site.Params.dev.enable true -}} diff --git a/layouts/_partials/init/global.html b/layouts/_partials/init/global.html index fee6816a..8012b3d9 100644 --- a/layouts/_partials/init/global.html +++ b/layouts/_partials/init/global.html @@ -1,7 +1,7 @@ {{- $pages := .Site.RegularPages }} {{- /* Merge missing translations from other languages */ -}} -{{- if .Site.Params.enableTranslationMerge -}} +{{- if .Site.Params.enable_translation_merge -}} {{- range .Site.Home.Translations -}} {{- $pages = $pages | lang.Merge .Site.RegularPages -}} {{- end -}} diff --git a/layouts/_partials/init/index.html b/layouts/_partials/init/index.html index dd102f9d..79df345e 100644 --- a/layouts/_partials/init/index.html +++ b/layouts/_partials/init/index.html @@ -6,5 +6,4 @@ {{- partial "init/detection-deprecated.html" . -}} {{- partial "init/detection-pagefind.html" . -}} {{- partial "init/global.html" . -}} -{{- partial "init/patch.html" . -}} {{- partial "init/compatibility.html" . -}} diff --git a/layouts/_partials/init/patch.html b/layouts/_partials/init/patch.html deleted file mode 100644 index ca4a1da4..00000000 --- a/layouts/_partials/init/patch.html +++ /dev/null @@ -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 -}} diff --git a/layouts/_partials/plugin/admonition.html b/layouts/_partials/plugin/admonition.html index a7156473..aa6adc71 100644 --- a/layouts/_partials/plugin/admonition.html +++ b/layouts/_partials/plugin/admonition.html @@ -1,11 +1,11 @@ {{- /* The extended syntax of alert is compatible with Obsidian and FixIt admonition shortcode. - @param {String} .Text the content of the admonition box - @param {String} [.Type] the type of the admonition box - @param {String} [.Title] the title of the admonition box - @param {Boolean} [.Open] whether the admonition box is open, default is true - @param {Boolean} [.Foldable] whether the admonition box is foldable, default is true + @param {String} .Text - The content of the admonition box + @param {String} [.Type] - The type of the admonition box + @param {String} [.Title] - The title of the admonition box + @param {Boolean} [.Open] - Whether the admonition box is open, default is true + @param {Boolean} [.Foldable] - Whether the admonition box is foldable, default is true For custom admonitions, see https://fixit.lruihao.cn/documentation/content-management/shortcodes/extended/admonition/#customize-admonitions */ -}} diff --git a/layouts/_partials/plugin/alert.html b/layouts/_partials/plugin/alert.html index 467c60b8..364f1089 100644 --- a/layouts/_partials/plugin/alert.html +++ b/layouts/_partials/plugin/alert.html @@ -1,8 +1,8 @@ {{- /* The basic syntax of alert is compatible with GitHub, Obsidian, and Typora. - @param {String} .Type the type of the alert box - @param {String} .Text the content of the alert box - @param {Map} [.Attributes] the attributes of the alert box + @param {String} .Type - The type of the alert box + @param {String} .Text - The content of the alert box + @param {Map} [.Attributes] - The attributes of the alert box @example {{- dict "Text" .Text "Type" .AlertType "Attributes" .Attributes | partial "plugin/alert.html" -}} */ -}} diff --git a/layouts/_partials/plugin/analytics.html b/layouts/_partials/plugin/analytics.html index f16ee090..1b06e4fe 100644 --- a/layouts/_partials/plugin/analytics.html +++ b/layouts/_partials/plugin/analytics.html @@ -3,7 +3,7 @@ - Reads analytics config from Site Store. - Conditionally renders provider snippets when enabled. - Supported providers include Google, Fathom, Baidu, Umami, and others. - @param {Object} .Site Hugo site object + @param {Object} .Site - Hugo site object */ -}} {{- $analytics := .Site.Store.Get "analytics" | default dict -}} diff --git a/layouts/_partials/plugin/code-block-wrapper.html b/layouts/_partials/plugin/code-block-wrapper.html index b9d9e6dd..02e0926f 100644 --- a/layouts/_partials/plugin/code-block-wrapper.html +++ b/layouts/_partials/plugin/code-block-wrapper.html @@ -2,14 +2,29 @@ Code block wrapper hook for highlight output. - Applies wrapper UI features based on codeblock config. - Supports classic/modern modes, copy button, expand button, and line-number states. - @param {Object} .Attributes code block attributes - @param {Object} .Options code fence options - @param {String} .Inner raw code content - @param {Object} .Page current page context - @param {String} .Type language/type for current block + @param {Object} .Attributes - Code block attributes + @param {Object} .Options - Code fence options + @param {String} .Inner - Raw code content + @param {Object} .Page - Current page context + @param {String} .Type - Language/type for current block */ -}} -{{- $config := .Attributes | merge .Page.Params.codeblock | merge .Page.Site.Params.codeblock -}} +{{- $config := .Attributes | merge (dict "Page" .Page "Key" "codeblock" | partial "function/param.html") -}} + +{{- /* Deprecated camelCase attribute support: Hugo lowercases Markdown attributes */ -}} +{{- if isset .Attributes "wrapperclass" | and (not (isset .Attributes "wrapper_class")) -}} + {{- warnidf "v1-deprecated-codeblock-attr" "The attribute `wrapperClass` is deprecated since v1.0.0, use `wrapper_class` instead. See %s" .Position -}} +{{- end -}} +{{- if isset .Attributes "maxshownlines" | and (not (isset .Attributes "max_shown_lines")) -}} + {{- warnidf "v1-deprecated-codeblock-attr" "The attribute `maxShownLines` is deprecated since v1.0.0, use `max_shown_lines` instead. See %s" .Position -}} +{{- end -}} +{{- if isset .Attributes "linenostoggler" | and (not (isset .Attributes "line_nos_toggler")) -}} + {{- warnidf "v1-deprecated-codeblock-attr" "The attribute `lineNosToggler` is deprecated since v1.0.0, use `line_nos_toggler` instead. See %s" .Position -}} +{{- end -}} +{{- if isset .Attributes "linewraptoggler" | and (not (isset .Attributes "line_wrap_toggler")) -}} + {{- warnidf "v1-deprecated-codeblock-attr" "The attribute `lineWrapToggler` is deprecated since v1.0.0, use `line_wrap_toggler` instead. See %s" .Position -}} +{{- end -}} + {{- $result := transform.HighlightCodeBlock . -}} {{- $wrapper := $result.Wrapped -}} @@ -17,13 +32,13 @@ {{- if $config.wrapper -}} {{- $mode := $config.mode | default "classic" -}} {{- $lines := cond .Inner (len (split .Inner "\n")) 0 -}} - {{- $maxShownLines := $config.maxshownlines -}} + {{- $maxShownLines := $config.max_shown_lines | default .Attributes.maxshownlines -}} {{- $lineNoStart := cond (ne .Options.linenostart nil) .Options.linenostart 1 -}} {{- $lineNosDigit := strings.RuneCount (sub (add $lines $lineNoStart) 1) -}} {{- $class := "highlight" -}} {{- with $config.class -}}{{ $class = add $class " " . }}{{- end -}} {{- $targetClass := add "code-block " $class -}} - {{- with $config.wrapperclass -}}{{ $targetClass = add $targetClass " " . }}{{- end -}} + {{- with ($config.wrapper_class | default .Attributes.wrapperclass) -}}{{ $targetClass = add $targetClass " " . }}{{- end -}} {{- /* Add code wrapper around the table or pre */ -}} {{- $REin := cond (strings.Contains $wrapper ``) @@ -49,7 +64,7 @@ {{- $wrapper = dict "Wrapper" $wrapper "Config" $config | partial "function/code-copy-btn.html" -}} {{- end -}} - {{- /* + {{- /* Add data attributes and class Directly set CSS variables to ensure compatibility with non-Chromium-based browsers See https://caniuse.com/css3-attr for attr() support status diff --git a/layouts/_partials/plugin/diagram-copy-btn.html b/layouts/_partials/plugin/diagram-copy-btn.html index eb530237..07e2d796 100644 --- a/layouts/_partials/plugin/diagram-copy-btn.html +++ b/layouts/_partials/plugin/diagram-copy-btn.html @@ -1,6 +1,6 @@ {{- /* Copy button for diagram-like plugins. - @param {String} [.Label] aria label text for copy action + @param {String} [.Label] - Aria label text for copy action */ -}} {{- $label := .Label | default "Copy Diagram code" -}} diff --git a/layouts/_partials/plugin/echarts.html b/layouts/_partials/plugin/echarts.html index 15320d74..2170c57a 100644 --- a/layouts/_partials/plugin/echarts.html +++ b/layouts/_partials/plugin/echarts.html @@ -3,15 +3,15 @@ - Skips rendering when MarkupScope is home. - Supports chart options from inline content, data key, or resource file. - Supports JavaScript template mode via js/file options. - @param {Object} [.Options] render options from shortcode or code fence attributes - @param {String} [.Options.width] chart container width (default: 100%) - @param {String} [.Options.height] chart container height (default: 30rem) - @param {Boolean} [.Options.js] whether to treat content as JS option builder - @param {Boolean} [.Options.async] whether JS template executes asynchronously - @param {String} [.Options.data] key of data source under data/echarts - @param {String} [.Options.file] local resource path for js/json/yaml/toml source - @param {String} [.Inner] inline chart option content - @param {Object} [.Page] current page context + @param {Object} [.Options] - Render options from shortcode or code fence attributes + @param {String} [.Options.width] - Chart container width (default: 100%) + @param {String} [.Options.height] - Chart container height (default: 30rem) + @param {Boolean} [.Options.js] - Whether to treat content as JS option builder + @param {Boolean} [.Options.async] - Whether JS template executes asynchronously + @param {String} [.Options.data] - Key of data source under data/echarts + @param {String} [.Options.file] - Local resource path for js/json/yaml/toml source + @param {String} [.Inner] - Inline chart option content + @param {Object} [.Page] - Current page context */ -}} {{- if ne hugo.Context.MarkupScope "home" -}} diff --git a/layouts/_partials/plugin/file-tree.html b/layouts/_partials/plugin/file-tree.html index f4d1ea4c..83a3de92 100644 --- a/layouts/_partials/plugin/file-tree.html +++ b/layouts/_partials/plugin/file-tree.html @@ -1,11 +1,11 @@ {{- /* Recursive function to render tree from structured data - @param {array} items - Array of tree items - @param {int} level - The expand level of the tree (expand all: -1, collapse all: 0) - @param {int} [depth=0] - Current depth level - @param {bool} [folderSlash=false] - Whether to append a trailing "/" to folder names - @param {array} [ignoreList] - List of file or folder names to ignore - @param {array} [highlightList] - List of file or folder names to highlight + @param {Array} items - Array of tree items + @param {Int} level - The expand level of the tree (expand all: -1, collapse all: 0) + @param {Int} [depth=0] - Current depth level + @param {Boolean} [folder_slash=false] - Whether to append a trailing "/" to folder names + @param {Array} [ignore_list] - List of file or folder names to ignore + @param {Array} [highlight_list] - List of file or folder names to highlight File tree item structure: name: string - The name of the file or folder @@ -16,9 +16,9 @@ {{- $items := .items -}} {{- $level := .level -}} {{- $depth := .depth | default 0 -}} - {{- $folderSlash := .folderSlash | default false -}} - {{- $ignoreList := .ignoreList | default slice -}} - {{- $highlightList := .highlightList | default slice -}} + {{- $folderSlash := .folder_slash | default false -}} + {{- $ignoreList := .ignore_list | default slice -}} + {{- $highlightList := .highlight_list | default slice -}}
    {{- /* Sort items: directories first, then files */ -}} @@ -34,7 +34,7 @@ {{- $fileItems = $fileItems | append . -}} {{- end -}} {{- end -}} - + {{- range (append $fileItems $dirItems) -}} {{- $isDir := eq .type "dir" -}} {{- $isCollapsed := $isDir | and (ge $depth $level) | and (ge $level 0) -}} @@ -43,7 +43,7 @@ {{- if and $isDir $folderSlash -}} {{- $label = printf "%s/" $label -}} {{- end -}} - +
  • {{- $icon := "file-tree-icon fa-regular " -}} @@ -55,15 +55,15 @@ {{- dict "Class" $icon | partial "plugin/icon.html" -}} {{ $label }} - + {{- if and $isDir .children -}} {{- $options := dict "items" .children "depth" (add $depth 1) "level" $level - "folderSlash" $folderSlash - "ignoreList" $ignoreList - "highlightList" $highlightList + "folder_slash" $folderSlash + "ignore_list" $ignoreList + "highlight_list" $highlightList -}} {{- template "render-file-tree" $options -}} {{- end -}} @@ -73,7 +73,7 @@ {{- end -}} {{- if .items -}} - {{- $ignoreList := .ignoreList | default slice -}} + {{- $ignoreList := .ignore_list | default slice -}} {{- $notEmpty := false -}} {{- range .items -}} {{- if not (in $ignoreList .name) -}} diff --git a/layouts/_partials/plugin/fixit-encryptor.html b/layouts/_partials/plugin/fixit-encryptor.html index dc57a34d..d0429437 100644 --- a/layouts/_partials/plugin/fixit-encryptor.html +++ b/layouts/_partials/plugin/fixit-encryptor.html @@ -2,11 +2,11 @@ Encrypted content renderer. - Encrypts content payload and renders decryptor UI. - Supports full-page mode and partial mode with isolated target container. - @param {String} .Password encryption password - @param {String} .Content content to encrypt and render - @param {String} [.Message] custom input placeholder message - @param {Boolean} [.IsPartial] whether current render is partial mode - @param {Object} [.Page] current page context (required when IsPartial is true) + @param {String} .Password - Encryption password + @param {String} .Content - Content to encrypt and render + @param {String} [.Message] - Custom input placeholder message + @param {Boolean} [.IsPartial] - Whether current render is partial mode + @param {Object} [.Page] - Current page context (required when IsPartial is true) */ -}} {{- if .Password -}} diff --git a/layouts/_partials/plugin/icon.html b/layouts/_partials/plugin/icon.html index a57c96df..cb5c7d5f 100644 --- a/layouts/_partials/plugin/icon.html +++ b/layouts/_partials/plugin/icon.html @@ -3,10 +3,10 @@ - Renders element when Class is provided. - Resolves local SVG resources or external SVG URL fallback. - Supports Simple Icons shorthand by icon name. - @param {String} [.Class] icon class name for - @param {String} [.Src] svg source path or URL - @param {String} [.Simpleicons] simple-icons icon name - @param {String} [.Prefix] custom prefix for simple-icons source path + @param {String} [.Class] - Icon class name for + @param {String} [.Src] - SVG source path or URL + @param {String} [.Simpleicons] - Simple-icons icon name + @param {String} [.Prefix] - Custom prefix for simple-icons source path */ -}} {{- with .Class -}} diff --git a/layouts/_partials/plugin/image.html b/layouts/_partials/plugin/image.html index fe0a1eee..3d43b76f 100644 --- a/layouts/_partials/plugin/image.html +++ b/layouts/_partials/plugin/image.html @@ -1,35 +1,45 @@ -{{- /* -The image plugin is a partial that handles image resources. +{{- /* + Image resource plugin. + Handles page resources, global resources, and remote images. + Supports optimisation, srcset generation, black list filtering, and remote caching. -Parameters: -- Src: The path to the image. - It can be a page resource (inside a page bundle) https://gohugo.io/methods/page/resources/ - or a global resource (inside the assets directory) https://gohugo.io/functions/resources/get/ - or a link to a remote resource, which can be cached if the site parameter is set https://gohugo.io/functions/resources/getremote/ -- Resources: If the image is a page resource, this parameter is required. It is the .Resources of the page. -- OptimConfig: optimisation parameter, defined like - {{- $optim := slice - (dict "Process" "resize 800x Center webp q75" "descriptor" "800w") - (dict "Process" "resize 1200x Center webp q75" "descriptor" "1200w") - (dict "Process" "resize 1600x Center webp q75" "descriptor" "1600w") - -}} - See https://gohugo.io/content-management/image-processing/ for more information. -- Alt: alt text for the image. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#alt -- Height: The intrinsic height of the image, in pixels. Must be an integer without a unit. - We try to generate this value automatically if possible. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#height -- Width: The intrinsic width of the image, in pixels. Must be an integer without a unit. - We try to generate this value automatically if possible. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#width -- Loading: Indicates how the browser should load the image: eager or lazy. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#loading -- Optimise: Override the site parameter to optimise the image. -- CacheRemote: Override the site parameter to cache remote images. -- BlackList: A list of image file names or patterns to exclude from optimisation, default is from site parameter. -- Matches: If the image is a page resource, this parameter can help to find the resource by names. e.g. ["featured-image", "featured-image-preview"]. + Pass .Page when the caller needs page-level config override (e.g., content images). + Omit .Page for decorative/site-level images (e.g., logos, avatars, badges). -Thanks @HEIGE-PCloud for the original code in the DoIt theme. -https://github.com/HEIGE-PCloud/DoIt/blob/main/layouts/_partials/plugin/image.html + @param {String} .Src - Image path (page resource, global resource, or remote URL) + @param {Object} [.Resources] - Page resources (.Resources), required for page resources + @param {Array} [.OptimConfig] - srcset processing config, e.g.: + slice (dict "Process" "resize 800x webp" "descriptor" "800w") + See https://gohugo.io/content-management/image-processing/ + @param {String} [.Alt] - Alt text + @param {String} [.Title] - Title attribute + @param {String} [.Caption] - Caption for lightgallery + @param {Int} [.Width] - Intrinsic width in pixels + @param {Int} [.Height] - Intrinsic height in pixels + @param {String} [.Loading] - "eager" or "lazy" (default: "lazy") + @param {String} [.Class] - CSS classes + @param {String} [.Sizes] - srcset sizes attribute + @param {Array} [.Matches] - Resource match names, e.g. ["featured-image-preview", "featured-image"] + @param {Boolean} [.Linked] - Wrap in lightgallery link + @param {Object} [.Rel] - rel attribute + @param {String} [.Decoding] - decoding attribute + @param {String} [.Referrerpolicy] - referrerpolicy attribute + @param {Boolean} [.Optimise] - Override site param to enable optimisation + @param {Boolean} [.CacheRemote] - Override site param to enable remote caching + @param {Array} [.BlackList] - Override site param black list + @param {Object} [.Page] - Page context for page-level image config override + + @example + {{- dict "Src" "cover.jpg" "Resources" .Resources | partial "plugin/image.html" -}} + {{- dict "Src" "logo.png" "Class" "logo" "Width" 32 "Height" 32 | partial "plugin/image.html" -}} + + Thanks @HEIGE-PCloud for the original code in the DoIt theme. */ -}} -{{- $config := site.Params.image -}} +{{- $config := partial "function/camel-case-keys.html" site.Params.image -}} +{{- with .Page -}} + {{- $config = dict "Page" . "Key" "image" "ToCamel" true | partial "function/param.html" -}} +{{- end -}} {{- $Resources := .Resources | default page.Resources -}} {{- $isInline := strings.HasPrefix .Src "data:image" -}} {{- $isRemote := urls.Parse .Src | partial "function/is-url-remote.html" -}} @@ -47,14 +57,6 @@ https://github.com/HEIGE-PCloud/DoIt/blob/main/layouts/_partials/plugin/image.ht {{- $resource = $resource | default ($Resources.Get .Src) | default (resources.Get .Src) -}} {{- end -}} -{{- /* Get remote image resource */ -}} -{{- $cacheRemote := .CacheRemote | default $config.cacheRemote | default false -}} -{{- if not $resource | and $cacheRemote -}} - {{- with partial "function/get-remote-image.html" (dict "Src" .Src) -}} - {{- $resource = . -}} - {{- end -}} -{{- end -}} - {{- /* Check if the image is blocked from optimisation */ -}} {{- $blackList := .BlackList | default $config.blackList | default slice -}} {{- $isBlocked := false -}} @@ -63,12 +65,22 @@ https://github.com/HEIGE-PCloud/DoIt/blob/main/layouts/_partials/plugin/image.ht {{- with $blackList -}} {{- $regex = replace (delimit . "|") "." "\\." -}} {{- $regex = replace $regex "*" ".*" -}} + {{- $isBlocked = gt (findRE $regex $.Src | len) 0 -}} {{- end -}} + +{{- /* Get remote image resource (skip if blocked by black_list) */ -}} +{{- $cacheRemote := .CacheRemote | default $config.cacheRemote | default false -}} +{{- if not $resource | and $cacheRemote | and (not $isBlocked) -}} + {{- with partial "function/get-remote-image.html" (dict "Src" .Src) -}} + {{- $resource = . -}} + {{- end -}} +{{- end -}} + {{- /* raster graphics */ -}} {{- $rasterTypes := slice "svg" "avif" -}} {{- $isRaster := false -}} {{- if $resource -}} - {{- if $regex -}} + {{- if $regex | and (not $isBlocked) -}} {{- $isBlocked = gt (findRE $regex $resource.Name | len) 0 -}} {{- end -}} {{- if not $isBlocked -}} diff --git a/layouts/_partials/plugin/link.html b/layouts/_partials/plugin/link.html index 9685175d..2799e0cd 100644 --- a/layouts/_partials/plugin/link.html +++ b/layouts/_partials/plugin/link.html @@ -3,20 +3,20 @@ - Auto-detects external links and applies target/rel policies. - Supports optional icon, download hint, and external icon display. - Supports card mode with URL meta and favicon fallback. - @param {String} .Destination target URL - @param {String} [.Content] link label HTML - @param {String} [.Title] title attribute - @param {String} [.Class] custom CSS classes - @param {String} [.Rel] rel attribute value - @param {Boolean} [.Newtab] force external behavior - @param {Boolean} [.Noreferrer] whether to include noreferrer (default: true) - @param {Boolean} [.ExternalIcon] whether to show external-link icon - @param {Object} [.Icon] icon params for plugin/icon.html - @param {Boolean} [.Card] whether to render card link layout - @param {String} [.CardIcon] card icon URL or icon class - @param {String} [.Download] download attribute value - @param {Boolean} [.IsGuarded] explicitly enable or disable link guard - @param {Object} [.Page] current page context + @param {String} .Destination - Target URL + @param {String} [.Content] - Link label HTML + @param {String} [.Title] - Title attribute + @param {String} [.Class] - Custom CSS classes + @param {String} [.Rel] - Rel attribute value + @param {Boolean} [.Newtab] - Force external behavior + @param {Boolean} [.Noreferrer] - Whether to include noreferrer (default: true) + @param {Boolean} [.ExternalIcon] - Whether to show external-link icon + @param {Object} [.Icon] - Icon params for plugin/icon.html + @param {Boolean} [.Card] - Whether to render card link layout + @param {String} [.CardIcon] - Card icon URL or icon class + @param {String} [.Download] - Download attribute value + @param {Boolean} [.IsGuarded] - Explicitly enable or disable link guard + @param {Object} [.Page] - Page context for page-level link config override */ -}} {{- /* Regular link rendering */ -}} @@ -102,7 +102,10 @@ {{- end -}} {{- $blockSchemes := slice "javascript" "mailto" "tel" "file" "data" "vscode" "trae" -}} -{{- $config := partial "function/snake2camel.html" site.Params.link -}} +{{- $config := partial "function/camel-case-keys.html" site.Params.link -}} +{{- with .Page -}} + {{- $config = dict "Page" . "Key" "link" "ToCamel" true | partial "function/param.html" -}} +{{- end -}} {{- $rel := .Rel | default "" -}} {{- $isExternal := false -}} {{- $noreferrer := true -}} @@ -126,18 +129,10 @@ {{- /* External link guard */ -}} {{- $isGuarded := false -}} -{{- $guardConfig := $config.guard -}} -{{- with .Page.Params.link_guard -}} - {{- if reflect.IsMap . -}} - {{- $guardConfig = (partial "function/snake2camel.html" .) | merge $guardConfig -}} - {{- else -}} - {{- $guardConfig = (dict "enable" .) | merge $guardConfig -}} - {{- end -}} -{{- end -}} {{- if - $guardConfig.enable + $config.guard.enable | and $isExternal - | and (not (in $guardConfig.allowDomains $url.Host)) + | and (not (in $config.guard.allowDomains $url.Host)) -}} {{- $isGuarded = .IsGuarded | default true -}} {{- end -}} @@ -159,7 +154,7 @@ {{- with .Download -}} {{- $attrs = printf ` download="%s"` . | add $attrs -}} {{- end -}} -{{- if $isGuarded | and (eq $guardConfig.mode "modal") -}} +{{- if $isGuarded | and (eq $config.guard.mode "modal") -}} {{- $attrs = add $attrs ` data-guard="modal"` -}} {{- end -}} diff --git a/layouts/_partials/plugin/mermaid-bootstrap.html b/layouts/_partials/plugin/mermaid-bootstrap.html deleted file mode 100644 index 1ab1f133..00000000 --- a/layouts/_partials/plugin/mermaid-bootstrap.html +++ /dev/null @@ -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) --}} diff --git a/layouts/_partials/plugin/mermaid.html b/layouts/_partials/plugin/mermaid.html index ecd66ad8..8bf574aa 100644 --- a/layouts/_partials/plugin/mermaid.html +++ b/layouts/_partials/plugin/mermaid.html @@ -3,17 +3,18 @@ - Skips rendering when MarkupScope is home. - Supports wrapped view with tabs/actions and plain diagram mode. - Supports per-diagram filename for code/download actions. - @param {Object} [.Options] render options from shortcode or code fence attributes - @param {Boolean} [.Options.wrapper] whether to enable wrapped diagram UI - @param {String} [.Options.filename] filename used by diagram/code actions - @param {String} [.Inner] inline Mermaid source content - @param {Object} [.Page] current page context + @param {Object} [.Options] - Render options from shortcode or code fence attributes + @param {Boolean} [.Options.wrapper] - Whether to enable wrapped diagram UI + @param {String} [.Options.filename] - Filename used by diagram/code actions + @param {String} [.Inner] - Inline Mermaid source content + @param {Object} [.Page] - Current page context */ -}} {{- if ne hugo.Context.MarkupScope "home" -}} {{- $code := strings.TrimSpace .Inner -}} -{{- $wrapped := .Options.wrapper | default site.Params.mermaid.wrapper -}} +{{- $mermaidConfig := dict "Page" .Page "Key" "mermaid" | partial "function/param.html" -}} +{{- $wrapped := .Options.wrapper | default $mermaidConfig.wrapper -}} {{- if $wrapped -}} {{- $labelDiagram := T "tabs.diagram" -}} diff --git a/layouts/_partials/plugin/pagefind-metadata.html b/layouts/_partials/plugin/pagefind-metadata.html index fb07a9f1..dcf2b3e6 100644 --- a/layouts/_partials/plugin/pagefind-metadata.html +++ b/layouts/_partials/plugin/pagefind-metadata.html @@ -1,11 +1,8 @@ {{- if and .Site.Params.search.enable (eq .Site.Params.search.type "pagefind") .IsPage -}} - {{- $params := partial "function/params.html" -}} - {{- $hidden := cond (eq $params.hiddenFromSearch true) "true" "false" -}} - {{- $encrypted := cond (and (isset $params "password") (ne (printf "%v" $params.password) "")) "true" "false" -}} {{- $pageDate := (.PublishDate | default .Date) -}} - {{- $dateLabel := $pageDate | dateFormat (.Site.Params.dateFormat | default "2006-01-02") -}} - - + {{- $dateLabel := $pageDate | dateFormat (.Site.Params.date_format | default "2006-01-02") -}} + + diff --git a/layouts/_partials/plugin/post-chat-ai.html b/layouts/_partials/plugin/post-chat-ai.html index 76fc232c..21a69c5f 100644 --- a/layouts/_partials/plugin/post-chat-ai.html +++ b/layouts/_partials/plugin/post-chat-ai.html @@ -5,7 +5,7 @@ Podcast: https://ai.zhheo.com/docs/podcast.html TODO refactor and migrate to theme component */ -}} -{{- $params := .Params | merge .Site.Params -}} +{{- $params := .Params | merge .Site.Params | partial "function/camel-case-keys.html" -}} {{- $chatConfig := $params.postChat -}} {{- $summaryConfig := $params.postSummary -}} {{- $podcastConfig := $params.podcast -}} @@ -17,7 +17,7 @@ "both" "postChatUser_summary.min.js" -}} {{- /* PostSummary only for public posts */ -}} -{{- $password := .Params.password | default .Site.Params.page.password -}} +{{- $password := .Params.password -}} {{- $isPost := (eq .Kind "page") | and (eq .Type "posts") | and (not $password) -}} {{- $summaryEnable := cond $isPost $summaryConfig.enable false -}} {{- $enable := $chatConfig.enable | or $summaryEnable -}} @@ -81,28 +81,7 @@ {{- $blackDom = $blackDom | append . -}} {{- end -}} {{- $upLoadWeb := cond (.IsHome | or $password | or (eq .Kind "404")) false $chatConfig.upLoadWeb -}} - {{- $postChatConfig := dict - "userMode" $chatConfig.userMode - "defaultInput" $chatConfig.defaultInput - "left" $chatConfig.left - "bottom" $chatConfig.bottom - "width" $chatConfig.width - "height" $chatConfig.height - "fill" $chatConfig.fill - "backgroundColor" $chatConfig.backgroundColor - "upLoadWeb" $upLoadWeb - "showInviteLink" $chatConfig.showInviteLink - "userTitle" $chatConfig.userTitle - "userDesc" $chatConfig.userDesc - "addButton" $chatConfig.addButton - "blackDom" $blackDom - "frameWidth" $chatConfig.frameWidth - "frameHeight" $chatConfig.frameHeight - "userIcon" $chatConfig.userIcon - "defaultChatQuestions" $chatConfig.defaultChatQuestions - "defaultSearchQuestions" $chatConfig.defaultSearchQuestions - "hotWords" $chatConfig.hotWords - -}} + {{- $postChatConfig := dict "upLoadWeb" $upLoadWeb "blackDom" $blackDom | merge $chatConfig -}} {{- $configJS = add $configJS ($postChatConfig | jsonify | printf "var postChatConfig=%s") -}} {{- end -}} diff --git a/layouts/_partials/plugin/reward.html b/layouts/_partials/plugin/reward.html index 23aaaed2..6a4e01b0 100644 --- a/layouts/_partials/plugin/reward.html +++ b/layouts/_partials/plugin/reward.html @@ -2,9 +2,9 @@ Post reward panel renderer. - Renders reward switch button and reward QR/payment images. - Supports optional author prefix and animation mode. - @param {Object} .Reward reward config object - @param {String} .Id unique input id for reward toggle - @param {String} [.Author] optional author name for image alt text + @param {Object} .Reward - Reward config object + @param {String} .Id - Unique input id for reward toggle + @param {String} [.Author] - Optional author name for image alt text */ -}} {{- $reward := .Reward -}} diff --git a/layouts/_partials/plugin/script.html b/layouts/_partials/plugin/script.html index ea5d5cce..3e1f98d2 100644 --- a/layouts/_partials/plugin/script.html +++ b/layouts/_partials/plugin/script.html @@ -2,20 +2,20 @@ Script tag renderer. - Accepts direct script HTML, a pre-built resource, or builds from source path. - Supports template execution, minify/build/fingerprint pipeline, and extra attrs. - @param {String} [.Source] script source URL/path; if starts with " + {{- dict "Class" "fa-brands fa-pinterest" | partial "plugin/icon.html" -}} {{ end -}} @@ -82,14 +83,14 @@ {{- /* 010: VK */ -}} {{- if $share.VK -}} - + {{- dict "Class" "fa-brands fa-vk" | partial "plugin/icon.html" -}} {{ end -}} {{- /* 011: Buffer */ -}} {{- if $share.Buffer -}} - + {{- dict "Class" "fa-brands fa-buffer" | partial "plugin/icon.html" -}} {{ end -}} @@ -131,7 +132,7 @@ {{- /* 017: 微博 */ -}} {{- if $share.Weibo -}} - + {{- dict "Class" "fa-brands fa-weibo" | partial "plugin/icon.html" -}} {{ end -}} diff --git a/layouts/_partials/plugin/social.html b/layouts/_partials/plugin/social.html index 3b3b0f79..21c975f0 100644 --- a/layouts/_partials/plugin/social.html +++ b/layouts/_partials/plugin/social.html @@ -2,10 +2,10 @@ Social profile link helper. - Builds destination from explicit Url or from Prefix/Template/Id. - Delegates final rendering to plugin/link.html with rel=me. - @param {String} [.Url] explicit target URL - @param {String} [.Template] URL template containing one %%v placeholder - @param {String} [.Prefix] URL prefix used to build Template - @param {String} [.Id] account id used by Template + @param {String} [.Url] - Explicit target URL + @param {String} [.Template] - URL template containing one %%v placeholder + @param {String} [.Prefix] - URL prefix used to build Template + @param {String} [.Id] - Account id used by Template */ -}} {{- $destination := "" -}} diff --git a/layouts/_partials/plugin/style.html b/layouts/_partials/plugin/style.html index 090a6849..3ab6cfe2 100644 --- a/layouts/_partials/plugin/style.html +++ b/layouts/_partials/plugin/style.html @@ -2,19 +2,19 @@ Stylesheet tag renderer. - Accepts direct HTML, a pre-built resource, or builds from source path. - Supports template execution, optional toCSS, minify/fingerprint, and preload mode. - @param {String} [.Source] stylesheet URL/path; if starts with " diff --git a/layouts/_partials/single/collection-list.html b/layouts/_partials/single/collection-list.html index 227c0b2c..6c663255 100644 --- a/layouts/_partials/single/collection-list.html +++ b/layouts/_partials/single/collection-list.html @@ -1,7 +1,5 @@ {{- /* Collection List */ -}} -{{- $params := partial "function/params.html" -}} - -{{- if .Params.collections | and $params.collectionList -}} +{{- if .Params.collections | and (.Param "collection_list") -}} {{- $collectionTerms := .GetTerms "collections" -}} {{- range $collectionTerms -}} {{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}} @@ -19,7 +17,7 @@