path

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: 2 Imported by: 0

Documentation

Overview

Package path 处理程序的路径信息

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Path

type Path struct {
	Root string // 项目的根目录

	ConfDir string // 项目下的配置文件所在目录
	DataDir string // 项目下数据文件所在的目录,即 Git 数据所在的目录

	// 数据目录下的子目录
	PostsDir  string
	ThemesDir string
	MetaDir   string
	RawsDir   string

	MetaConfigFile string
	MetaLinksFile  string
	MetaTagsFile   string
}

Path 表示项目的目录结构信息。可以在指定根目录的情况下, 预先生成所有的目录结构路径,方便其它地方调用。

func New

func New(root string) *Path

New 声明一个新的 Path

func (*Path) MetaPath

func (p *Path) MetaPath(file string) string

MetaPath 获取 data/meta/ 下的文件

func (*Path) PostContentPath

func (p *Path) PostContentPath(slug string) string

PostContentPath 返回某一篇文章下的文章内容的文件地址

func (*Path) PostMetaPath

func (p *Path) PostMetaPath(slug string) string

PostMetaPath 返回某一篇文章下的 meta.yaml 文件地址

func (*Path) PostPath

func (p *Path) PostPath(slug, filename string) string

PostPath 返回某一篇文章下的文件名

func (*Path) RawsPath

func (p *Path) RawsPath(file string) string

RawsPath 获取 raws/ 下的文件

func (*Path) ThemeMetaPath

func (p *Path) ThemeMetaPath(theme string) string

ThemeMetaPath 返回指定主题下的描述文件

func (*Path) ThemesPath

func (p *Path) ThemesPath(path ...string) string

ThemesPath 返回指定主题下的指定文件

Jump to

Keyboard shortcuts

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