@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.
Files changed (2) hide show
  1. package/index.js +20 -8
  2. 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
- console.log('look for page with path', this.match[0])
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[this.match[0]]){
113
- var page = site.pages[this.match[0]]
114
- console.log(page)
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[this.match[0]].url
127
+ page.fullpath = site.pages[path].url
121
128
  page.path = page.fullpath.split('/')
122
129
 
123
- console.log(page)
130
+
124
131
  scope.push(page)
125
132
 
126
- return engine.handleCache(this.match[1]+'.liquid')
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
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakedcreativity/cee-ms-node",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "Cee.ms for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {