当前位置: 首页 > 文档资料 > GitBook 中文解說 >

書籍首頁的佈景主題

优质
小牛编辑
127浏览
2023-12-01

佈景主題(Themes)是指你在 gitbook.com 上的書籍首頁,並不是指書籍內文的排版樣式。你可以選擇任一種預設主題,或是自訂 HTML 模板。

預設主題

GitBook 的預設主題以開源方式提供,你可以從 GitHub 取得檔案。

格式

GitBook 使用 NunjucksJinga2 的語法。

Variables for book homepage

VariableTypeDescription
book<book>Book to display

Book Representation

VariableTypeDescription
idstringComplete id of the book (ex: Username/Test)
namestringName of the book
titlestringTitle of the book
descriptionstringDescription of the book
publicbooleanFalse if the book is private
pricenumberPrice of the book (0 equals free)
githubIdstringID of the book on GitHub (ex: Username/Test)
categoriesarray[string]List of tags associated with this book
author<user>User that created the book
collaboratorsarray[<user>]Array of collaborators of the book (excluding the author)
cover.smallstringUrl of the cover (size small)
cover.largestringUrl of the cover (size large)
urls.accessstringUrl to access the book homepage
urls.homepagestringUrl of the homepage (using custom domain)
urls.readstringUrl to read the book
urls.reviewsstringUrl to the reviews page
urls.subscribestringUrl to submit email subscriptions
urls.download.epubstringUrl to download ebook (as EPUB)
urls.download.mobistringUrl to download ebook (as Mobi)
urls.download.pdfstringUrl to download ebook (as PDF)

User Representation

VariableTypeDescription
usernamestringUsername of the user
namestringName of the user
urls.profilestringUrl to access the profile homepage
urls.avatarstringUrl of avatar
accounts.twitterstringUsername on Twitter (if linked)
accounts.githubstringUsername on GitHub (if linked)