Jump to content

MarkDG

Member
  • Posts

    6
  • Joined

  • Last visited

Posts posted by MarkDG

  1. Site URL: https://bartlett-schenk.squarespace.com/

    Hey,  I seem to be having an issue appending HTML into a blog section using Post Blog Item Code Injection.  What I have done is fetched the data and was looking to loop through each post and create a class to render onto the page but when I look on the console logs, it seems I am getting errors but had no issue getting the data previously.

    This is the code which is also inserted in the code injection section for the main website


     

    <script>  
    
    	fetch("https://bartlett-schenk.squarespace.com/insights?format=json-pretty")
      		.then( response => response.json() )
      		.then((data) => {
          		let output = '';
          		Object.values(data.items).forEach( (post) => {
        			output += 
                      	`
    						<div class="insight" style="background-image: url(${post.filename})">
    						<h1>${post.categories[0]}</h1>
    						<h3>${post.title}</h3>
    						</div>
    					`	
        		})
          		document.getElementsByClassName("BlogList").innerHTML = output;
            })
      
    </script>

     

    I have also attached the logs.

     

    Screen Shot 2021-06-01 at 13.23.40.png

  2. Site URL: https://andy-rantell.squarespace.com/

    Hi, I seem to be having an issue with the testimonial carousel.  I added a Jquery package called slick slider to add some animation to the slider which works until I try to append the arrows that are currently there into the package or use the arrows that come with the package.  The only other way I was thinking of getting around this issue was create a custom HTML block and inject the JS in but I am not sure how to access the collections I am looking for.  Would anyone be able to help point me in the right direction please.

    Kind Regards.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.