Which folder should I put my static files in Jekyll?

后端 未结 2 1980
逝去的感伤
逝去的感伤 2021-02-20 05:31

While I am looking the doc. I saw the following document structure,

.
├── _config.yml
├── _drafts
|   ├── begin-with-the-crazy-ideas.textile
|   └── on-simplicit         


        
2条回答
  •  借酒劲吻你
    2021-02-20 06:12

    Assuming you have your gallery images in a structure like

    -img
      -gallery
        -image1.png
        -image2.png
        etc.
    

    you can access them in a collection or page like this:

    {% for image in site.static_files %}
    {% if image.path contains 'img/gallery' %}
        

    {{image.path}} - {{image.modified_time}}

    {% endif %} {% endfor %}

    This goes through all static files and check for a certain path (img/gallery in this example).

    Than you can access the static file metadata for that file. (I named it 'image' in this example but you can name it whatever you want after the for keyword).

    I think it doesn't make too much sense to put something like this in a blog post but rather in a page or a collection.

提交回复
热议问题