【问题标题】:Is it possible to have nested collections in Jekyll?Jekyll 中可以嵌套集合吗?
【发布时间】:2016-09-28 05:44:50
【问题描述】:

我正在尝试在 Jekyll 中创建一个单页作品集主题,一个部分包含默认的 Jekyll 博客文章,另一个部分包含收藏。

我希望收藏部分成为投资组合部分。在这一点上,我想将所有内容都保留在一个页面上,而不是典型地点击图像并转到帖子网址。相反,我想要 - 单击图像并弹出全屏图像滑块。我还需要将投资组合部分过滤到类别中 - 例如网页设计 - 图形 - 摄影等。

那么在 Jekyll 中可以嵌套集合吗?每个集合都有自己的子集合/类别,所以网页设计会说四个项目,每个项目有四到五张幻灯片?

我的 config.yml

  collections:
    webdesign: webdesign-project-one
    webdesign: webdesign-project-two
    webdesign: webdesign-project-three
    webdesign: webdesign-project-four
    graphics: graphic-project-one
    graphics: graphic-project-two
    graphics: graphic-project-three
    graphics: graphic-project-four  
    photos: photo-project-four 
    photos: photo-project-four 
    photos: photo-project-four 

要显示的代码

        <div id="slide-item01" class="portfolio webDesign">
          <div class="slides">
            {% for work in site.webdesign | where: "webdesign-project-one" %}
            <div class="slide-cell">
            <div class="wrap">
              <img src="{{ work.thumbnail-path }}" alt="{{ work.title }}"/>
                <div>
                  <h2>{{ work.title }}</h2>
                  {{ work.content }}
                </div>
              </div>
            </div>
            {% endfor %}
          </div>
        </div>

发布降价

    ---
    thumbnail-path: assets/img/webdesign/webdesign-project-one_slide-one.jpg
    title: Web Design Project One Slide One
    ---

    content

结构

    portfolio/
    _incliudes/
    --work.html

    _layouts/
    --frontpage.html

    _webdesign/
    --webdesign-project-one/
    ---slide-one.md
    ---slide-two.md
    ---slide-three.md
    ---slide-four.md
    --webdesign-project-two/
    ---slide-one.md
    ---slide-two.md
    ---slide-three.md
    --webdesign-project-three/
    ---slide-one.md
    ---slide-two.md
    --webdesign-project-four/
    ---slide-one.md
    ---slide-two.md
    ---slide-three.md

    _graphics/
    --graphic-project-one/
    ---slide-one.md
    ---slide-two.md
    ---slide-three.md
    ---slide-four.md
    --graphic-project-two/
    ---slide-one.md
    ---slide-two.md
    ---slide-three.md

【问题讨论】:

  • 为什么单页纸很重要?您是否考虑过使用 Ajax 请求获取 url?
  • 可能与这个question有关

标签: jekyll


【解决方案1】:

嵌套集合是不可能的,因为“集合必须在源目录中”。您可以使用前端问题和过滤作为解决方法。见:https://github.com/jekyll/jekyll/issues/2386

【讨论】:

  • 谢谢@JoostS,我不认为您有使用 Ajax 请求获取 url 的示例?
猜你喜欢
  • 2016-09-13
  • 2015-02-07
  • 2011-11-26
  • 2017-03-07
  • 1970-01-01
  • 2015-05-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多