@nakedcreativity/cee-ms-node 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +27 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -54,6 +54,32 @@ function ceems(config) {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
this.engine.registerTag('navigation', {
|
|
58
|
+
parse: (tagToken, remainTokens)=> {
|
|
59
|
+
this.match = tagToken.args; // name // path[0] == navigation name
|
|
60
|
+
},
|
|
61
|
+
render: (scope, hash)=> {
|
|
62
|
+
var filepath = Liquid.evalValue('submenu.liquid', scope);
|
|
63
|
+
var page = scope.scopes[0]
|
|
64
|
+
|
|
65
|
+
if(page.path && this.site.navigation[page.path[0]]){
|
|
66
|
+
console.log('navigation exists for ', page.path[0])
|
|
67
|
+
}else {
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
// look for navigation that match the name of any part of the path?
|
|
71
|
+
|
|
72
|
+
return this.engine.handleCache('submenu.liquid')
|
|
73
|
+
.then((templates) => {
|
|
74
|
+
scope.push(this.site.navigation[page.path[0]]);
|
|
75
|
+
return this.engine.renderer.renderTemplates(templates, scope);
|
|
76
|
+
})
|
|
77
|
+
.then((html) => {
|
|
78
|
+
scope.pop();
|
|
79
|
+
return html;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
57
83
|
|
|
58
84
|
this.app.listen(config.port, function () {});
|
|
59
85
|
|
|
@@ -113,7 +139,7 @@ ceems.prototype.load = function(path){
|
|
|
113
139
|
ceems.prototype.render = function(req, res, page=null) {
|
|
114
140
|
|
|
115
141
|
if(!page){
|
|
116
|
-
this.load(req._parsedUrl.pathname)
|
|
142
|
+
page = this.load(req._parsedUrl.pathname)
|
|
117
143
|
}
|
|
118
144
|
|
|
119
145
|
// get any external data, and save this into the page
|