图片设置

2021-01-01

该项为可选置项,map类型,可将模板的image(logo, banner,icon)信息提取至配置文件

在主题目录 theme.toml,可配置该项

配置


1[theme.image]
2logo = "/assets/img/logo/fungo.png"
3banner = ""
4icon = ""

Notice:

  • 该项为字典类型,支持配置多个非重名[name]配置项

  • 该项所定义内容,在任意模板页均可使用

  • 该内容仅为使用方法举例,用户可基于toml语法,进行自定义配置

释义


  1. logo

    设置站点logo信息

  2. banner

    设置站点banner信息

  3. icon

    设置站点icon信息

使用

  • 使用 logo

     1{{define you-template-name}}
     2<!DOCTYPE html>
     3<html lang="en">
     4	<head>
     5		<meta charset="UTF-8" />
     6		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
     7		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
     8		<title>Document</title>
     9	</head>
    10	<body>
    11		<header>
    12			<a href="/">
    13				<img class="h-10" src="{{.Theme.image.fungo}}" alt="" />
    14			</a>
    15		</header>
    16		<main>write-you-customize-code-here</main>
    17	</body>
    18</html>
    19{{end}}