转载自: https://adityatelange.github.io/hugo-PaperMod/posts/papermod/papermod-variables/

以下是与此主题一起使用的变量…


Site Variables under Params

name type example Description
env string ‘production’ 将 env 设置为生产
title string ‘My Blog’ 设置标题
description string ‘This is a blog of mine’ 设置站点描述
author string |list ‘Me’ | [‘Me’,‘You’] 显示多作者
images string ‘myimage.png’ opengraph, twitter-cards的图片链接或路径
keywords list [blog, page] 为主页添加关键字
DateFormat string “January 2, 2006” 网站中日期字符串的格式。 Details
languageAltTitle string “English” 多语言模式下的替代标题
ShowReadingTime boolean true | false 显示阅读时间
ShowShareButtons boolean true | false 显示/隐藏帖子下的分享按钮
ShowCodeCopyButtons boolean true | false 显示/隐藏代码复制按钮
ShowFullTextinRSS boolean true | false 在 RSS 提要中显示内容
defaultTheme string light | dark | auto 设置默认主题
disableThemeToggle boolean true | false 禁用标签之外显示的主题切换图标
disableSpecial1stPost boolean true | false 禁用第一个帖子的无卡特殊外观
disableScrollToTop boolean true | false 禁用 返回顶部 按钮
disableAnchoredHeadings boolean true | false 禁用锚定标题
hideMeta boolean true | false 隐藏元元素:页面的日期、阅读时间、作者和可用翻译
hideSummary boolean true | false 隐藏列表页面中显示的摘要
showtoc boolean true | false 显示/隐藏目录
tocopen boolean true | false 在页面加载时默认保持打开 ToC
ShowPostNavLinks boolean true | false 在帖子下方显示上一个和下一个帖子
ShowBreadCrumbs boolean true | false 在单个帖子/页面上方显示面包屑导航
comments boolean true | false 显示/隐藏评论
analytics.google.SiteVerificationTag string “XYZabc” Google Analytics 的网站验证标签
analytics.bing.SiteVerificationTag string “XYZabc” Bing 的站点验证标签
analytics.yandex.SiteVerificationTag string “XYZabc” Yandex 的站点验证标签
schema - - Details
fuseOpts - - Details
socialIcons - - Details
label - - Details
assets - - Details
cover - - Details
profileMode - - Details
editPost - - Details

Site Variables

name type example Description
copyright string **[example.site](https://example.site)** 这是 HUGO’s site variable,也可以渲染markdown内容

label

name type example Description
label.text string ‘Home’ 显示标题以外的不同标签文本
label.icon string ‘/apple-touch-icon.png’ 在标签中显示logo图像
label.iconHeight integer 35 设置标签logo图像的大小

profileMode

name type example Description
profileMode.enabled boolean true | false 要启用 profileMode,需要明确设置
profileMode.title string “Title” 标题
profileMode.subtitle string “subtitle here” 副标题
profileMode.imageUrl string “image.png” | “https://example.com/image.jpg" 图片网址或链接
profileMode.imageWidth string “150” 图像宽度
profileMode.imageHeight string “150” 图像高度
profileMode.imageTitle string “This image is a picture of ..” 图片标题
profileMode.buttons - - Details
profileMode.buttons
profileMode:
    buttons:
        - name: Archive
        url: "/archive"
        - name: Github
        url: "https://github.com/"

assets

name type example Description
assets.favicon string ‘icon.ico’ 设置favicon,可以是路径或者外部链接
assets.disableHLJS boolean true | false 禁用 Highlight.js 加载
assets.disableFingerprinting boolean true | false 禁用assets的Sub-Resource integrity

cover

name type example Description
cover.linkFullImages boolean true | false 点击封面打开全尺寸封面图片
cover.responsiveImages boolean true | false 启用/禁用响应式封面图像的生成
cover.hidden boolean true | false 隐藏在任何地方但不在结构化数据中
cover.hiddenInList boolean true | false 隐藏在列表页面和主页上
cover.hiddenInSingle boolean true | false 隐藏在列表页面和主页上

schema

name type example Description
schema.publisherType string ‘Organization’ https://schema.org/publisher
schema.sameAs list [“URL1”, “URL2”] Set https://schema.org/sameAs

fuseOpts

参考: https://fusejs.io/api/options.html

fuseOpts:
  isCaseSensitive: false
  shouldSort: true
  location: 0
  distance: 1000
  threshold: 0.4
  minMatchCharLength: 0
  keys: ["title", "permalink", "summary", "content"] ##  can be less but not more than shown in list

socialIcons

socialIcons:
    - name: "<platform>"
        url: "<link>"
    - name: "<platform 2>"
        url: "<link2>"

editPost

editPost:
  URL: "https://github.com/<path_to_repo>/content"
  Text: "Suggest Changes" # edit text
  appendFilePath: true # to append file path to Edit link

Note: Same format is being used by Page Variables


Page Variables

Name Type Example Description
showtoc boolean true | false 显示/隐藏目录
tocopen boolean true | false 在页面加载时默认保持打开 ToC
hidemeta boolean true | false 隐藏元元素:页面的日期、阅读时间、作者和可用翻译
comments boolean true | false 显示/隐藏评论
description string ‘description text’ 在标题下显示文章描述
canonicalURL string https://canonical.url/to/page" 将规范 URL(canonical URL)添加到帖子
disableShare boolean true | false 在页面下隐藏/显示分享图标
disableHLJS boolean true | false 禁用 Highlight.js 加载
disableAnchoredHeadings boolean true | false 禁用锚定标题
searchHidden boolean true | false 在搜索中隐藏页面
hideSummary boolean true | false 隐藏列表页面中显示的摘要
ShowReadingTime boolean true | false 在 post meta 中显示阅读时间
ShowBreadCrumbs boolean true | false 在单个帖子/页面上方显示面包屑导航
ShowPostNavLinks boolean true | false 在帖子下方显示上一个和下一个帖子
author string |list ‘Me’ | [‘Me’,‘You’] 显示多个作者
cover.image string ‘featured.jpg’ 添加封面图片
cover.caption string ‘caption for image’ 为封面图片添加标题
cover.alt string ’this is cover image’ 如果图像未加载/显示,则显示替代文本
cover.relative boolean true | false 为封面图片使用相对路径,在hugo Page-bundles中使用
cover.hidden boolean true | false 在当前单页上隐藏
weight integer 5 设置页面顺序或将帖子固定到列表顶部