Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何在页面中显示上一篇/下一篇文章的链接? #198

Closed
Dream4ever opened this issue Jun 4, 2013 · 4 comments
Closed

如何在页面中显示上一篇/下一篇文章的链接? #198

Dream4ever opened this issue Jun 4, 2013 · 4 comments
Labels
question Needs help in usage

Comments

@Dream4ever
Copy link

这个功能该如何实现?代码苦手,还请各位多多赐教,谢谢先~

@tommy351
Copy link
Member

tommy351 commented Jun 5, 2013

page.prev和page.next

@Dream4ever
Copy link
Author

多谢回复,不过我是想知道具体的方法,比如在哪个文件中加入page.prev之类的才能实现此功能~

@tommy351
Copy link
Member

tommy351 commented Jun 5, 2013

以預設主題Light為例,在layout/post.ejs使用page.prevpage.next就能存取上/下篇文章的資料,你可透過

<% console.log(page.prev) %>

了解這個變數的所有內容,例如想要取得上篇文章的標題的話,可使用

<%= page.prev.title %>

@Dream4ever
Copy link
Author

非常感谢,明天就去试试,hoho~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Needs help in usage
Projects
None yet
Development

No branches or pull requests

2 participants