It doesn’t need solving if the final output works, you might find some go/html templating addons for vscode which would then understand it. It is the css style it doesn’t like, I have a template that adds a style and it flags it also.
I think step 6 has a mistake: Save the file in the ‘layouts/partials/shortcodes’ directory of your project >> it is instead: ‘layouts/shortcodes’ directory.
I also made a mistake; I didn’t put the .toml .yaml file in the data folder.
And images work only from the static folder (that’s might normal).
Now I am figuring out how to create another carousel in a different .md file. That would be great if you could give me a hint, but thanks for the help so far.
You are right on the shortcode folder, good spot.
Where it picks up the images from and the data file it uses suggests it was intended for one homepage slider.
Personally (if it is just for images) I’d change it to look up the data from the page’s frontmatter and have it pick up the images from the same page’s bundle or a folder inside it or maybe a folder in assets. I like my page folder to hold all the stuff I need for that page.
See how far you can get with that and I’ll try and help if required.
If the content_html: "1" parts of the data are just an index number then I wouldn’t bother with them.
I’d make your shortcode {{< carousel album="my_folder" >}}
and pick up the images like this:
{{- $album := .Get "album" }}
{{- $allimages := $.Page.Resources.Match (print $album "/*") }}
{{ range $allimages }}
/* create the slides here */
{{ end }}
I am glad you got it working.
The more you do with these templates the less scary it becomes.
Just for future reference I don’t think you need the more complex Scratch usage.
Also to finesse and for SEO maybe you can add alt tags from humanized filenames.
It should just be possible to do it like this: