Documentation ¶
Overview ¶
Package vars 代码级别的配置内容。
所有可能需要修改的配置项以及算法都被集中到 vars 包中, 使用者可以根据自己需求随意修改此包以子包的内容。
NOTE: vars 包的修改,可能会涉及到整个项目结构的改变, 比较适合用于一个新的博客内容,若是应用于已有的博客系统, 请确保这些修改不会对现有数据造成影响。
Index ¶
- Constants
- func ArchivesURL() string
- func AssetURL(path string) string
- func CommitHash() string
- func Etag(t time.Time) string
- func IndexURL(page int) string
- func LinksURL() string
- func PostURL(slug string) string
- func PostsURL(page int) string
- func SearchURL(q string, page int) string
- func TagURL(slug string, page int) string
- func TagsURL() string
- func ThemeURL(path string) string
- func Version() string
Constants ¶
View Source
const ( URLQueryPage = "page" // 查询参数 page URLQuerySearch = "q" // 查询参数 q )
查询参数名称的定义
View Source
const ( SearchKeySeparator = ':' SearchKeyTitle = "title" SearchKeyTag = "tag" SearchKeySeries = "series" )
与查询相关的一些自定义参数
上线之后请谨慎修改这些值,可能会让已经分离出去的链接变为无效链接。
用户可以通过查询参数按指定的格式进行精确查找,比如: title:abc 只查找标题中包含 abc 的文章,其中,title 关键字和分隔符 : 都可以自定义。
View Source
const ( // Name 程序名称 Name = "gitype" // URL 项目的地址 URL = "https://github.com/caixw/gitype" // TemplateExtension 模板的扩展名 TemplateExtension = ".html" // XMLIndentWidth XML 每一个 tab 的缩进量 XMLIndentWidth = 4 // ContentPlaceholder 配置文件中的表示当前内容的占位符 ContentPlaceholder = "%content%" // OutdatedFrequency outdated 的更新频率。 // NOTE: 此值过小,有可能会影响服务器性能 OutdatedFrequency = time.Hour * 24 )
View Source
const ( DataFolderName = "data" ConfFolderName = "conf" PostsFolderName = "posts" ThemesFolderName = "themes" MetaFolderName = "meta" RawsFolderName = "raws" )
目录名称的定义
View Source
const ( ConfigFilename = "config.yaml" TagsFilename = "tags.yaml" LinksFilename = "links.yaml" PostMetaFilename = "meta.yaml" PostContentFilename = "content.html" ThemeMetaFilename = "theme.yaml" )
文件名的定义
View Source
const ( PageIndex = "index" // 首页 PagePosts = "posts" // 除首页外的文章列表页,与首页会有细微差别,比如标题 PagePost = "post" PageTags = "tags" PageTag = "tag" PageArchives = "archives" PageLinks = "links" PageSearch = "search" )
页面的类型,除了 PageIndex 其它的同时也是模板名称。
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.