Jekyll snippets

Gallery Implementation

{% assign array = page.photo_names | split: ',' %}
{% assign count = 0 %}
{% assign folder = page.category %}

{% assign image_files = site.static_files | where: folder, true %}
{% for image in image_files %}

  {% if image.path contains page.photo %}
    <div class="col-lg-6 col-md-6 project">
      <a href="{{ image.path }}" class="project-item" style="background-image: url({{ page.thumb }}{{ count }}{{ image.extname }})"></a>
      <div class="project-description"><ul><li>{{ count | plus: 1 }}.  {{ array[count] }}</li></ul></div>
    </div>
  {% assign count = count | plus: 1 %}
  {% endif %}

{% endfor %}

Related Post

<ul>
{% capture related_posts %}{{ page.categories }}{% endcapture %}
{% assign collection = site.categories[related_posts] %}
{% for article in collection limit: 6 %}
  % unless page.url == article.url %}
    <li><a href="{{ article.url }}">{{ article.title }}</a></li>
  % endunless %}
{% endfor %}
</ul>

Jekyll Words Limit

{{ post.content | strip_html | truncatewords: 28 }}

Jekyll Category Post List

{% for post in site.categories.[page.category] limit: 8 %}
{% include photo-item.html %}
{% endfor %}