@nakedcreativity/cee-ms-node 0.3.12 → 0.3.14

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 +37 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -166,6 +166,40 @@ function ceems(config) {
166
166
  }
167
167
  })
168
168
 
169
+ this.engine.registerTag('breadcrumb', {
170
+ parse: function(tagToken, remainTokens) {
171
+ this.template = tagToken.args
172
+ },
173
+ render: function(scope, hash){
174
+
175
+ var breadcrumbArray = []
176
+ var path = ''
177
+ if(!scope.scopes[0].path){
178
+ return
179
+ }
180
+ scope.scopes[0].path.forEach(handle => {
181
+ path += handle
182
+ if(site.pages[path]){
183
+ breadcrumbArray.push(site.pages[path])
184
+ path += '/'
185
+ }
186
+ })
187
+
188
+ scope.push({
189
+ breadcrumb: breadcrumbArray
190
+ })
191
+
192
+ return engine.handleCache(this.template+'.liquid')
193
+ .then((templates) => {
194
+ return engine.renderer.renderTemplates(templates, scope);
195
+ })
196
+ .then((html) => {
197
+ scope.pop();
198
+ return html;
199
+ });
200
+ }
201
+ })
202
+
169
203
  this.engine.registerTag('blog', {
170
204
  parse: function(tagToken, remainTokens) {
171
205
  this.match = tagToken.args.split(' ')
@@ -220,11 +254,13 @@ function ceems(config) {
220
254
 
221
255
  //console.log(req.body.page)
222
256
  req.query.edit = true;
223
-
257
+ this.site = req.body.site
258
+ site = this.site
224
259
  // if this was sent by the iframe, handle it differently
225
260
  if(req.query.iframe != null){
226
261
  this.render(req, res, JSON.parse(decodeURIComponent(req.body.page)));
227
262
  }else {
263
+
228
264
  this.render(req, res, req.body.page);
229
265
  }
230
266
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakedcreativity/cee-ms-node",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "description": "Cee.ms for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {