hexo-renderer-markojs
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

hexo-renderer-marko

NPM version NPM downloads

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

Package Sidebar

Install

npm i hexo-renderer-markojs

Weekly Downloads

7

Version

1.0.1

License

MIT

Unpacked Size

125 kB

Total Files

8

Last publish

Collaborators

  • lizhooh