hexo-renderer-markojs

Use marko v4 template in Hexo.

Usage no npm install needed!

<script type="module">
  import hexoRendererMarkojs from 'https://cdn.skypack.dev/hexo-renderer-markojs';
</script>

README

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