Squarespace Websites Importer advanced using

Blog

Check Out Useful Squarespace articles here

Squarespace Websites Importer advanced using

I believe you know about our SquarespaceWebsites Importer, which allows you to import/export different collections beetwen Squarespace websites. 

We added  sqsToolsDataHook into extension for advanced users. It fires after you get collection data and allows you to make different stuff.

Let's say you have a big gallery with over 250 images in it. There is a way to upload more than 250 items into gallery but there is no way for comfort editing them further. The problem is in Squarespace widget list query only 250 items for galleries and doesn't provide additional loading on scroll or something.

So probably the best way is converting such big gallery to blog collection, because Squarespace blogList widget supports loading more items on scroll. 

And this can be easily done with SquarespaceWebsites Importer. As result you'll have new collection with all images, categories, tags and descriptions but now as a blog.

So sqsToolsDataHook checks for a function sqsToolsDataHook and executes it if find in global window object. So the sqsToolsDataHook function need to be defined from console on top window, it takes collection data object and need to return it after custom modifying. 

The function for converting gallery collection to blog will be: 

window.sqsToolsDataHook = function (coll_data) {
    if (coll_data.sqstp_collection.typeName == 'gallery') {
        coll_data.sqstp_collection.typeName = 'blog';
        coll_data.sqstp_collection.typeLabel = 'blog';
        if (coll_data.sqstp_items.results.length) {
            coll_data.sqstp_items.results.forEach(function (result, i) {
                result.recordType = 1;
                result.recordTypeLabel = 'text';
                result.title = result.title || 'Item-' + i; // Leave original image title or auto name
            })
        }
    }
    return coll_data;
};

sqsToolsDataHook function defined

Now clone your gallery collection with Importer as usual and you will have new blog collection converted from gallery.

Michael Mashai