-->

docpad子目录渲染成一般目录(docpad subdirectory rendered into

2019-10-18 15:36发布

如何移动从文件src/documents/posts/post1.htmlout/post1.html无子posts出现在了目录?

我有一个子目录posts在我documents

src/
    documents/
        index.html
        contact.html
        posts/
            post1.html
            post2.html

我希望的职位是在out/post1.htmlout/posts/post1.html

Answer 1:

事实证明,你可以设定relativePath属性为任何你想要的

@getCollection("html").findAllLive(..).on 'add', (document) ->
    newRelativePath = document.get('relativePath').replace('posts/','')
    document.set('relativePath', newRelativePath)

ImportantNote:

如果您使用的是findAllLive蒙山,其中包括选择relativePath ,然后更改relativePath ,该文件会从集合中删除。 另外,您可以设置其他标志,并用它寻找。

@getCollection("html").findAllLive({$or:{relativeOutDirPath:'posts', isPost: true}}).on 'add', (document) ->
    document.set('relativePath', newRelativePath)
            .setMeta({isPost: true})


文章来源: docpad subdirectory rendered into general directory
标签: docpad