This “topic” is different than “Ideal-Image-Slider w/ Includes Implementation” where this post deals with image sliders in post excerpts.
While the ideal-image-slider (iis) is working on a collections.projects post, as in the post “losPinos-jekylliis”, it is not working in excerpts on projects’ home page. When I say projects, I mean my projects collection, not my website as a whole project.
The slider_scripts.html looks for image_sliders on each page and pages where image_sliders_load_all yaml frontmatter is set to true, then, puts all the image_sliders into an array called iis_slider_array. If iis_slider_array is not empty iis javacripts are called and a selector iterates over the iis_slider_array.
I declare these variables multiple times in the slider_scripts.html to see if they contain data, and as you can see in chrome dev tools, they do. Yet when the slider_scripts.html include is called on the projects’ home page, it throws off an unexpected token error on line 199 and even though work.md has the yaml frontmatter image_sliders_load_all set to true someway, somehow, slider.selector turns up null or undefined, and I don’t know why.
I’m looking for help in this matter, and any is much appreciated.
ok, I think I am following about 75% of what you are doing but it is a little confusing as you have a lot going on - the slider include is referencing data from a data file that then uses stuff in a collection file.
It works on a page where you display a collection item, but the same exact thing does not work on a page where you show a list of collection excerpts?
It may be that the excerpt doesn’t have access to the data file? I am not sure. But if you think about all the different things jekyll is doing, the order in which they are done can influence what you can do - ie maybe when you are using an excerpt the system doesn’t loop thru the data files? not sure that makes sense though as it is still a page where you are doing this.
As someone trying to help it would be easier to have a simpler example - like it is hard to go look at a page and then see that the code is really in a layout, and then that layout is being processed thru another layout and then including another file. The more of it you can put in one place the better when it comes to troubleshooting.
Based on your post above and now that I see the var is supposed to be set by liquid, and that liquid code is referencing something from site.data I think you need to investigate that more.
What you are trying to do is interesting - include images in the excerpt and then load those into an image slider. Not sure I have seen that before. At a glance the code seems overly complicated though maybe that is needed, no idea.
I would put everything into one page - with the layout only doing html things not loading js. Then work backwards from hardcoding the whole thing, then using it as a collection, then if that works try the excerpts. I guess you have already done the first 2.
I’m aware I’m not being as thorough and clear as I can be, but the only thing I’m actually trying to do is to implement this repo. I know there are a lot of different pieces of code in different locations and you have to go take a look at them individually and it’s annoying, it is, I know
Yet, that’s what the repo tells me to do, so I’m only trying to follow the instructions. Anyhow, thank you for sticking around, I’m going to give this task a rest for now and focus on other parts.
Alright updated to Jekyll ~>4.2 and things are working the way I want. Didn’t do anything differently other than upgrading and employing this github action to deploy a Jekyll website to github pages, but yea would have been nice if gh-pages supported jekyll 4.0+ already… Here is the site for now…