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

页面中加入自己定义的变量 #23

Open
yanghaowang opened this issue Dec 21, 2020 · 0 comments
Open

页面中加入自己定义的变量 #23

yanghaowang opened this issue Dec 21, 2020 · 0 comments

Comments

@yanghaowang
Copy link
Contributor

yanghaowang commented Dec 21, 2020

看官方说明和介绍视频(https://hexo.io/docs/variables )里提到可以在自己的post上定义一个customized variable。比如在front-matter里面加入如下代码

---
title: test
customvar: abc 
---

在layout的模板里可以直接用<%=page.title%>和<%=page.customvar%>。
我试了,发现官方定义好的变量,比如page.title是可以直接用的,但是自己的定义的变量用不了。

也可以参考这个讨论:hexojs/hexo#3056 (comment)

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

No branches or pull requests

1 participant