hexo-renderer-markojs
v1.0.1
Published
Use marko v4 template in Hexo.
Downloads
5
Maintainers
Readme
hexo-renderer-marko
Use marko template in Hexo.
Install
$ npm install --save hexo-renderer-markojs
Usage
Create a layout file index.marko
.
class {
onCreate() {
this.state = {
name: 'hello',
};
}
}
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>Home</title>
</head>
<body>
<h1>Hello Word</h1>
<p>${data.page.total}</p>
<p>${state.name}</p>
</body>
</html>
All hexo local variables are in the data property.
${data.page} Page specific information and custom variables set in front-matter.
${data.site} Sitewide information.
${data.config} Site configuration.
${data.theme} Theme configuration. Inherits from site configuration.
${data.env} Environment variables
...
Please read the hexo related documentation: https://hexo.io/docs/variables.html