Hello,
I’m new to Jekyll and I’m testing it since a couple of days and loving it!
I read all the documentation I found but I think I’m missing something about how to pass parameters in inclusions.
I want to generate a image gallery using the files in the subfolder I specify in the parameter “nome”.
For example the image files for the about-me.html page are stored in /photos/test/
I also tried to use capture as explained here Includes | Jekyll • Simple, blog-aware, static sites without any luck.
I think I’m missing something big, but I really can’t figure it out.
Every time I build I receive the following error:
Liquid Exception: Invalid syntax for include tag. File contains invalid characters or sequences: image-gallery.html folder='/photos/test' Valid syntax: {% include file.ext param='value' param2='value' %} in /_layouts/page.html
jekyll 3.9.3 | Error: Invalid syntax for include tag. File contains invalid characters or sequences:
image-gallery.html folder='/photos/test'
Valid syntax:
{% include file.ext param='value' param2='value' %}
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/jekyll-3.9.3/lib/jekyll/tags/include.rb:67:in `validate_file_name': Invalid syntax for include tag. File contains invalid characters or sequences: (ArgumentError)
image-gallery.html folder='/photos/test'
Valid syntax:
{% include file.ext param='value' param2='value' %}
/about-me.md
---
layout: page
title: About Me
nome: test
---
this is a test page
_includes/image-gallery.html
<style>
.image-gallery {overflow: auto; margin-left: -1%!important;}
.image-gallery li {float: left; display: block; margin: 0 0 1% 1%; width: 40%;}
.image-gallery li a {text-align: center; text-decoration: none!important; color: #777;}
.image-gallery li a span {display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; padding: 3px 0;}
.image-gallery li a img {width: 100%; display: block;}
</style>
<ul class="image-gallery">{% for file in site.static_files %}{% if file.path contains include.folder %}{% if file.extname == '.jpg' or file.extname == '.jpeg' or file.extname == '.JPG' or file.extname == '.JPEG' %}{% assign filenameparts = file.path | split: "/" %}{% assign filename = filenameparts | last | replace: file.extname,"" %}<li><a href="{{ file.path | relative_url }}" title="{{ filename }}"><img src="//images.weserv.nl/?url={{ site.url | replace: 'http://','' | replace: 'https://','' }}{{ file.path | relative_url }}&w=500&h=500&output=jpg&q=70&t=square" alt="{{ filename }}" title="{{ filename }}" /></a></li>{% endif %}{% endif %}{% endfor %}</ul>
<script type="text/javascript" src="/assets/js/lightbox.js"></script>
<link rel="stylesheet" href="/assets/css/lightbox.css">
_layouts/page.html
---
---
<header>
<h1>{{ site.title }}</h1>
</header>
{%-include menu_horizontal.html-%}
<h1>{{ page.title }}</h1>
{{ content }}
{% include image-gallery.html folder='/photos/{{ page.nome }}' %}