【问题标题】:Image gallery in Jekyll with dinamic folderJekyll 中带有动态文件夹的图片库
【发布时间】:2021-04-02 18:47:20
【问题描述】:

我想访问页面post-title-1assets/images/post/post-title-1中的图像和页面2中的2。

我正在尝试使用类似的东西,但它没有显示任何内容:

          {% for image in site.static_files %}
              {% if image.path contains '{{page.name}}' %}
                <img src="{{ site.baseurl }}{{ image.path }}"/>
              {% endif %}
            {% endfor %}

你能帮帮我吗?

【问题讨论】:

    标签: jekyll github-pages liquid


    【解决方案1】:

    您在 for 循环中使用了双括号。这是不允许的。试试这个:

     {% for image in site.static_files %}
       {% if image.path contains page.name %}
         <img src="{{ site.baseurl }}{{ image.path }}"/>
       {% endif %}
     {% endfor %}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-26
      • 2012-05-01
      相关资源
      最近更新 更多