vars

package
v0.0.0-...-323ef38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package vars 代码级别的配置内容。

所有可能需要修改的配置项以及算法都被集中到 vars 包中, 使用者可以根据自己需求随意修改此包以子包的内容。

NOTE: vars 包的修改,可能会涉及到整个项目结构的改变, 比较适合用于一个新的博客内容,若是应用于已有的博客系统, 请确保这些修改不会对现有数据造成影响。

Index

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

func ArchivesURL

func ArchivesURL() string

ArchivesURL 生成归档页面的 URL

func AssetURL

func AssetURL(path string) string

AssetURL 构建一条用于指向资源的 URL

func CommitHash

func CommitHash() string

CommitHash 获取最后一条代码提交记录的 hash 值。

func Etag

func Etag(t time.Time) string

Etag 根据一个时间,生成一段 Etag 字符串

func IndexURL

func IndexURL(page int) string

IndexURL 构建索引首页的 URL 首页为返回 /index.html 其它页面返回 /index.html?page=xx

func LinksURL

func LinksURL() string

LinksURL 生成友情链接的 URL

func PostURL

func PostURL(slug string) string

PostURL 构建文章的 URL

func PostsURL

func PostsURL(page int) string

PostsURL 构建文章列表的 URL 首页为返回 / 其它页面返回 /index.html?page=xx

func SearchURL

func SearchURL(q string, page int) string

SearchURL 构建搜索页面的 URL

func TagURL

func TagURL(slug string, page int) string

TagURL 构建标签的 URL

func TagsURL

func TagsURL() string

TagsURL 生成标签列表的 URL

func ThemeURL

func ThemeURL(path string) string

ThemeURL 构建主题文件 URL

func Version

func Version() string

Version 获取完整的版本号

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL