GitbookIO / plugin

Sample plugin for GitBook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I get page.path in Gitbook 2.0

saturngod opened this issue · comments

I am using page.path in "page:after" for loading file.

At version 2.0 , we cannot use "page:after". So, I try to change with block. However, I have no idea , how to get full file path without page.path .

You can use this.ctx.file.path (markdown page can acces it using {{ page.path }})

The path this.ctx.file.path is relative to the book, to get an absolute path use:

path.resolve(this.book.root, this.ctx.file.path)