Jekyll 杰基尔:我如何把内容分成两部分? 在我的模板中,我想在内容的中间显示一组图像。所以我想我需要一部分内容,然后是从yaml中拍摄的一些图像,然后是其余的内容,这意味着我必须将内容分成两部分

Jekyll 杰基尔:我如何把内容分成两部分? 在我的模板中,我想在内容的中间显示一组图像。所以我想我需要一部分内容,然后是从yaml中拍摄的一些图像,然后是其余的内容,这意味着我必须将内容分成两部分,jekyll,Jekyll,如何像这样拆分内容?我遇到了完全相同的问题,我没有拆分内容就解决了它。 我会在这里展示简短的版本,但在我的博客上有一个 我在展示画廊的实际工作中使用: 首先,我使用来显示图像,所以我需要先加载一些JS和CSS文件(以及jQuery)。我只想在实际需要Lightbox2的页面上执行此操作,因此我将其放入包含文件,而不是布局文件: /\u包括/galheader.html: 请注意,{%if include.image==null或…行允许我以两种不同的方式使用include: 显示所有图像: {

如何像这样拆分内容?

我遇到了完全相同的问题,我没有拆分内容就解决了它。
我会在这里展示简短的版本,但在我的博客上有一个

我在展示画廊的实际工作中使用:


首先,我使用来显示图像,所以我需要先加载一些JS和CSS文件(以及jQuery)。我只想在实际需要Lightbox2的页面上执行此操作,因此我将其放入包含文件,而不是布局文件:

/\u包括/galheader.html
: 请注意,
{%if include.image==null或…
行允许我以两种不同的方式使用include:

  • 显示所有图像:

    {% include gal.html %}
    
  • 显示单个图像:

    {% include gal.html image="image-1.jpg" %}
    

  • 这两项包括: : :
    
    

    这里有一些文字,然后是两幅图像:

    …还有更多的文字

    更多文本和最后一幅图像:

    最后是一些文字

    {% include gal.html %}
    
    {% include gal.html image="image-1.jpg" %}
    
    ---
    layout: default
    title: Gallery with text (version 1)
    imgfolder: /img/demopage
    images:
      - name: image-1.jpg
        thumb: thumb-1.jpg
        text: The first image
      - name: image-2.jpg
        thumb: thumb-2.jpg
        text: The second image
      - name: image-3.jpg
        thumb: thumb-3.jpg
        text: The third image
    ---
    
    {% include galheader.html %}
    
    Some text here...and then, all the images in one single gallery:
    
    {% include gal.html %}
    
    ...and more text after the gallery
    
    <script src="/js/jquery-1.10.2.min.js"></script>
    <script src="/js/lightbox-2.6.min.js"></script>
    <p><link href="/css/lightbox.css" rel="stylesheet" /></p>
    
    <p>Some text here...and then, all the images in one single gallery:</p>
    
    <p><a href="/img/demopage/image-1.jpg" data-lightbox="1" title="The first image"><img src="/img/demopage/thumb-1.jpg" title="The first image"></a></p>
    
    <p><a href="/img/demopage/image-2.jpg" data-lightbox="1" title="The second image"><img src="/img/demopage/thumb-2.jpg" title="The second image"></a></p>
    
    <p><a href="/img/demopage/image-3.jpg" data-lightbox="1" title="The third image"><img src="/img/demopage/thumb-3.jpg" title="The third image"></a></p>
    
    <p>...and more text after the gallery</p>
    
    ---
    layout: default
    title: Gallery with text (version 2)
    imgfolder: /img/demopage
    images:
      - name: image-4.jpg
        thumb: thumb-4.jpg
        text: The 4th image
      - name: image-5.jpg
        thumb: thumb-5.jpg
        text: The 5th image
      - name: image-6.jpg
        thumb: thumb-6.jpg
        text: The 6th image
    ---
    
    {% include galheader.html %}
    
    Some text here, then two images:
    
    {% include gal.html image="image-4.jpg" %}
    {% include gal.html image="image-5.jpg" %}
    
    ...and more text...
    
    Even more text and the last image:
    
    {% include gal.html image="image-6.jpg" %}
    
    Some text at the end
    
    <script src="/js/jquery-1.10.2.min.js"></script>
    <script src="/js/lightbox-2.6.min.js"></script>
    <p><link href="/css/lightbox.css" rel="stylesheet" /></p>
    
    <p>Some text here, then two images:</p>
    
    <p><a href="/img/demopage/image-4.jpg" data-lightbox="1" title="The 4th image"><img src="/img/demopage/thumb-4.jpg" title="The 4th image"></a></p>
    
    <p><a href="/img/demopage/image-5.jpg" data-lightbox="1" title="The 5th image"><img src="/img/demopage/thumb-5.jpg" title="The 5th image"></a></p>
    
    <p>...and more text...</p>
    
    <p>Even more text and the last image:</p>
    
    <p><a href="/img/demopage/image-6.jpg" data-lightbox="1" title="The 6th image"><img src="/img/demopage/thumb-6.jpg" title="The 6th image"></a></p>
    
    <p>Some text at the end</p>