@nakedcreativity/cee-ms-node 0.3.10 → 0.3.11

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 +30 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -66,7 +66,7 @@ function ceems(config) {
66
66
  this.match = tagToken.args.split(' '); // name // path[0] == navigation name
67
67
  },
68
68
  render: function(scope, hash){
69
- var filepath = Liquid.evalValue(this.match[1]+'.liquid', scope);
69
+ //var filepath = Liquid.evalValue(this.match[1]+'.liquid', scope);
70
70
  var page = scope.scopes[0]
71
71
 
72
72
  if(page.path && this.match[0] == 'page.path[0]' && site.navigation[page.path[0]]){
@@ -98,9 +98,7 @@ function ceems(config) {
98
98
  // var filepath = Liquid.evalValue(this.match[1]+'.liquid', scope);
99
99
  var page = scope.scopes[0]
100
100
 
101
- console.log('look for page with handle', this.match[0])
102
- var site = JSON.parse(fs.readFileSync('./pages/site.json', 'utf8'));
103
- console.log(site)
101
+ console.log('look for page with path', this.match[0])
104
102
 
105
103
  if(site.pages[this.match[0]]){
106
104
  var page = site.pages[this.match[0]]
@@ -113,6 +111,7 @@ function ceems(config) {
113
111
  page.fullpath = site.pages[this.match[0]].url
114
112
  page.path = page.fullpath.split('/')
115
113
 
114
+ console.log(page)
116
115
  scope.push(page)
117
116
 
118
117
  return engine.handleCache(this.match[1]+'.liquid')
@@ -133,6 +132,33 @@ function ceems(config) {
133
132
  }
134
133
  })
135
134
 
135
+ this.engine.registerTag('blog', {
136
+ parse: function(tagToken, remainTokens) {
137
+ this.match = tagToken.args.split(' ')
138
+ },
139
+ render: function(scope, hash){
140
+
141
+ console.log('render blog', this.match[0])
142
+ console.log(site.blogs[this.match[0]])
143
+
144
+ if(!site.blogs[this.match[0]]){
145
+ console.log('no match')
146
+ return
147
+ }
148
+ console.log(this.match[1], 'look for liquid template')
149
+ scope.push(site.blogs[this.match[0]])
150
+ return engine.handleCache(this.match[1]+'.liquid')
151
+ .then((templates) => {
152
+ return engine.renderer.renderTemplates(templates, scope);
153
+ })
154
+ .then((html) => {
155
+ scope.pop();
156
+ return html;
157
+ });
158
+ }
159
+
160
+ })
161
+
136
162
 
137
163
  this.app.listen(config.port, function () {});
138
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakedcreativity/cee-ms-node",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Cee.ms for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {