@nakedcreativity/cee-ms-node 0.3.19 → 0.3.20
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 +20 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -105,25 +105,37 @@ function ceems(config) {
|
|
|
105
105
|
},
|
|
106
106
|
render: function(scope, hash){
|
|
107
107
|
// var filepath = Liquid.evalValue(this.match[1]+'.liquid', scope);
|
|
108
|
-
var page = scope.scopes[0]
|
|
109
108
|
|
|
110
|
-
|
|
109
|
+
var path = Liquid.evalValue(this.match[0], scope)
|
|
110
|
+
if(!path){
|
|
111
|
+
path = Liquid.lexical.parseLiteral(this.match[0])
|
|
112
|
+
}
|
|
113
|
+
if(!path){
|
|
114
|
+
path = this.match[0]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
111
118
|
|
|
112
|
-
if(site.pages[
|
|
113
|
-
var page = site.pages[
|
|
114
|
-
|
|
119
|
+
if(site.pages[path]){
|
|
120
|
+
var page = site.pages[path]
|
|
121
|
+
|
|
115
122
|
if(page.redirect){
|
|
116
123
|
res.redirect(parseInt(page.redirect.type), page.redirect.to)
|
|
117
124
|
}
|
|
118
125
|
|
|
119
126
|
var page = JSON.parse(fs.readFileSync('./pages/'+page._id+'.json', 'utf8'));
|
|
120
|
-
page.fullpath = site.pages[
|
|
127
|
+
page.fullpath = site.pages[path].url
|
|
121
128
|
page.path = page.fullpath.split('/')
|
|
122
129
|
|
|
123
|
-
|
|
130
|
+
|
|
124
131
|
scope.push(page)
|
|
125
132
|
|
|
126
|
-
|
|
133
|
+
var template = Liquid.lexical.parseLiteral(this.match[1])
|
|
134
|
+
if(!template){
|
|
135
|
+
template = this.match[1]
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return engine.handleCache(template+'.liquid')
|
|
127
139
|
.then((templates) => {
|
|
128
140
|
return engine.renderer.renderTemplates(templates, scope);
|
|
129
141
|
})
|