【问题标题】:Creating Items for an specific section为特定部分创建项目
【发布时间】:2011-11-13 11:27:37
【问题描述】:

我正在用 nanoc 建立一个网站。我有我的主索引文件,现在我想添加一个包含我写过的文章的文章部分。所以我使用:

nanoc create_item articles

要创建这个新部分,但是如何在我刚刚创建的这个项目中创建新项目?

我想要实现的 url 树是:

index.html
/articles/index.html
/articles/one.html
/articles/two.html

我现在这是非常基本的东西,但我在 nanoc 文档中找不到任何示例。

【问题讨论】:

    标签: nanoc


    【解决方案1】:

    您可以使用nanoc create_item articles/two,也可以简单地手动创建/articles/two.html。 create_item 命令为您提供方便,但您也可以轻松地手动创建项目。

    【讨论】:

    • 谢谢!您将如何创建属于文章目录的所有项目的动态列表?
    • 如果@item 是文章项,那么@item.children 将为您提供/articles/ 项下方的项。否则,使用@items.find { |i| i.identifier == '/articles/' } 查找文章项。
    猜你喜欢
    • 2016-07-16
    • 1970-01-01
    • 1970-01-01
    • 2023-01-11
    • 2021-08-24
    • 1970-01-01
    • 2018-02-26
    • 2018-04-26
    • 2018-07-12
    相关资源
    最近更新 更多