如何从docpad的子文件夹中获取收藏集? [英] How to get collections from sub-folder in docpad?

查看:80
本文介绍了如何从docpad的子文件夹中获取收藏集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的折叠结构是这样的:

my folds structure are something like this:

  • 文档
    • 技术
      • docs
      • documents
        • techs
          • docs

          我想从文档中获取一个集合,我的代码是:

          I want to get a collection from docs, my code is :

          techs: ->
                  @getCollection("html").findAllLive({relativeOutDirPath: /techs/docs/},[{date: -1}]).on "add", (model) ->
                      model.setMetaDefaults({layout: "post"})
          

          那是行不通的...有人可以告诉我怎么回事吗?

          It just won't works... Could somebody tell me what's going on?

          推荐答案

          {relativeOutDirPath: /techs/docs/}中的/techs/docs/被解析为正则表达式,而不是字符串.将其用引号引起来,以代替{relativeOutDirPath: "/techs/docs/"}.我不记得您可能需要或不需要初始斜杠.

          The /techs/docs/ in {relativeOutDirPath: /techs/docs/} is parsed as a regular expression, rather than a string. Wrap it in quotes so you have {relativeOutDirPath: "/techs/docs/"} instead. You may or may not need the initial slash, I can't remember.

          这篇关于如何从docpad的子文件夹中获取收藏集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆