Customised Squarespace Template

This page assumes you have programming knowledge about Squarespace development. Squarespace's developer quick start documentation can be found here.

Prerequisites

  1. Create a Squarespace site with a template that can have access to developer mode.

  2. Set up your Squarespace development environment.

  3. To publish your site at a later date, you will need a Business or a Commerce plan in order to keep the custom code.

The following documentation assumes a simple site with one site.region file.

Installing Widgets

Each widget comes with a Javascript and CSS file. To add a widget to your website, you will need to add its corresponding Javascript and CSS in the head tag of your site.region file.

Copy and paste the code below into the code snippet box.

<!-- connect widget -->
<script async src="https://connect.manifoldxyz.dev/2.0.13/connect.umd.min.js"></script>
<link rel="stylesheet" href="https://connect.manifoldxyz.dev/2.0.13/connect.css" />
<!-- marketplace widget -->
<script async src="https://marketplace.manifoldxyz.dev/latest/marketplace.umd.min.js"></script>
<link rel="stylesheet" href="https://marketplace.manifoldxyz.dev/latest/marketplace.css" />

The uri for the Javascript and CSS for each widget is as follows:

https://<WIDGET_NAME>.manifoldxyz.dev/<WIDGET_VERSION>/<WIDGET_NAME>.umd.min.js
https://<WIDGET_NAME>.manifoldxyz.dev/<WIDGET_VERSION>/<WIDGET_NAME>.css

If you always want the latest version, use latest for the <WIDGET_VERSION>. However, due to the changing nature of the codebase, it is possible that the "newer" latest is no longer compatible with the "previous" latest used to develop the app. It is thus recommended that you use a specific version of a widget for consistent results.

You can find a list of widgets, versions and links here.

Using Widgets

For more detailed examples, see the Manifold templates repository.

Through HTML

Use widgets as you would through regular HTML by providing a div the necessary data-attributes of the widget you'd like to inject. Place these div blocks in the *.block files of your Squarespace template.

Through Squarespace's editor

You can include and display Manifold Gallery listings in a specific way in predefined Squarespace collections through the CMS.

To do so, you have to:

  1. define your custom Manifold Gallery listing type;

  2. add/modify the collection's configuration file to accept the new, custom type;

  3. add/modify the collection's .item and/or .list template(s) to display what you want to display by using the custom type's information.

This leverages Squarespace's custom post types.

1 - Define a custom Manifold Gallery listing type

In template.conf, add the following type definition in the customTypes array:

{
  "title": "Manifold Gallery Listing", // CMS display name
  "name": "manifoldGalleryListing",
  "base": "image",
  "fields": [
    {
      "name": "listingId",
      "title": "Listing ID",
      "type": "text"
    },
    {
      "name": "network",
      "title": "Network",
      "type": "text"
    },
    {
      "name": "version",
      "title": "Marketplace Version",
      "type": "text"
    },
    {
      "name": "useListingName",
      "title": "Use On-Chain Listing Name",
      "type": "checkbox"
    },
    {
      "name": "useListingDescription",
      "title": "Use On-Chain Listing Description",
      "type": "checkbox"
    }
  ]
}

2 - Add/Modify the collection's configuration

Add manifoldGalleryListing to the list of accepted types in the .conf file of the collection you want to modify.

// gallery.conf
{
  "title" : "Gallery",
  "ordering" : "user-orderable",
  "pageSize" : 9999,
  "addText" : "Add Images or Videos",
  "icon" : "gallery",
  "acceptTypes" : [ "image", "video", "manifoldGalleryListing" ]
}

3 - Add/Modify the collection's template file(s)

In the .item and/or the .list template file(s), use the custom properties to display the custom post type the way you want.

<!-- gallery.list -->
<!-- ... -->
<div id="slideshow">
  {.repeated section items}
    <div class="slide" data-slide-id="{id}" data-slide-url="{urlId}">
      {.equal? customContent.customType "manifoldGalleryListing"}
        {.section customContent}
          <div data-widget="m-listing-image-expandable" data-id="{@.listingId}" data-network="{@.network}" data-version="{@.version}"></div>
        {.end}
      {.or}
        {.image?}
          <img {@|image-meta} data-load="false"/>
          <noscript><img src="{assetUrl}?format=1500w"></noscript>
        {.end}
        {.video?}{@|video}{.end}
      {.end}
    </div>
  {.end}
</div>
<!-- ... -->

Styling

Widgets are styled using standard CSS. As Less is supported by Squarespace, you can also write styles using Less.

Tweaks are also integrable with Manifold widget code as long as they are properly defined. You can find more about Squarespace tweaks here.

See the Manifold templates repository for examples on how to include custom Manifold widget styling.

Examples

Examples of commonly used features can be found here. Please feel free to use this as a starting point to building your own dApp.

Last updated