路由保存站点中使用的所有路径。
¥The router saves all paths used in the site.
获取路径
¥Get a Path
get
方法返回一个 Stream。例如,将路径数据保存到指定的目标:
¥The get
method returns a Stream. For example, to save the path data to a specified destination:
var data = hexo.route.get("index.html"); |
设置路径
¥Set a Path
set
方法接受一个字符串、一个 缓冲区 或一个函数。
¥The set
method takes a string, a Buffer or a function.
// String |
你还可以设置一个布尔值来表示路径是否已被修改。这可以加快文件生成速度,因为它允许忽略未修改的文件。
¥You can also set a boolean for whether a path has been modified or not. This can speed up file generation as it allows for ignoring the unmodified files.
hexo.route.set("index.html", { |
删除路径
¥Remove a Path
hexo.route.remove("index.html"); |
获取路由列表
¥Get the List of Routes
hexo.route.list(); |
格式化路径
¥Format a Path
format
方法将字符串转换为有效路径。
¥The format
method transforms a string to a valid path.
hexo.route.format("archives/"); |