website logo
⌘K
Introduction
PORTAL
Agency Whitelabelling
PAGES
Pages - Accessing Page Data
Pagination Layouts
Page Templates
FORMS
Form Confirmation Pages
Adding a Progress Bar
Adding Custom CSS To Show Form Submit Process
Dynamic Content in Workflow and Autoresponder Emails
How to output Custom Field Set fields in a Form's Custom Layout
Custom JavaScript Validation for Forms
File Upload Previews
FAQ
CATEGORIES
Filtering WebApps and Modules by Categories
Outputting Categories on WebApp / Module / eCommerce Layouts
Outputting Category Fields in any Location
Category Detail Layouts
FAQ
COMPANY INFORMATION
Company Information
SITE SEARCH
Site Search
PUBLIC API/ZAPIER
Zapier - Formatting arrays correctly
Public API/Zapier Changelog
MODULES
Module Marketplace
Building Custom Modules
Siteglide Modules
Front-end Submit Modules
DATA STRUCTURES
Automations
Creating WebApps from the CLI
Field Types
WEBAPPS
Front-end Submit WebApps
Layouts
Search and Filtering
Understanding Custom Field Names and IDs
FAQ
CRM
User Details
User Secure Zones
Storing User's Favourite WebApp / Module Items
User's Form Submissions (Cases)
How Users Edit their Email and Password Front End
Editing a User's CRM record Front End with Custom Field Sets
CLI
Introducing Siteglide CLI
CLI Changelog
Secure Zones with CLI
Page Templates with Siteglide CLI
Pages with Siteglide CLI
Includes with Siteglide CLI
Managing Email Templates
Migrate - Manual Form setup
Migrate - Convert existing Forms
Liquid
Accessing Assets
Liquid Dot Notation
Using WebApp Collections- Tutorial
Using the current_user object with Secure Zones
Preventing Duplicate Content with Query Parameters- Canonical URL and Robots.txt
FAQ
GraphQL
Tutorial Overview
About GraphQL
Tutorial 1- Your First Query
Tutorial 2 - Pagination
Tutorial 3 - Filtering the Results
Tutorial 3 - Answers to the First Filtering Challenge
Tutorial 4 - Advanced Filtering
Tutorial 4 - Challenge Answers
Tutorial 5 - Using Liquid to run GraphQL queries on your Site
Tutorial 6 - Variables
Tutorial 6 - Answers to the Variables Challenge
Tutorial 7 - Sorting
Tutorial 8 - Building a Liquid API GET Endpoint Page powered by GraphQL queries
Best Practice and Performance
Module/WebApp Caching
Getting Started with Liquid Caching - to Reduce Server Response time and Improve Performance
Includes
ecommerce/checkout_standard
Frequently Asked Questions
Using Liquid Logic to Check if a field exists, or is empty on the Front End
How do I learn more about Liquid?
How to setup a multi domain start page
Docs powered by archbee 
15min

2. Create Folder Structure

A Module can contain any code that will run on Siteglide, but that code does need to be split into the relevant folders (notifications, views, etc.) and folder structures. Below, we'll take a look at how to do just that along with all the various options available to you, depending on what you would like to build.

<module_name>

The Module name is written in the following format: module_<vanity_id> . Replace vanity_id with the Vanity ID generated in your Module listing in Portal.

For example, with our Siteglide Theme Demo Module this would generate a name of module_76. Your module name (based on your generated Vanity ID) should be used anywhere the tag <module_name> is referenced in this documentation.

Create Your Staging Site

Create a new staging site within your agency to build your module on. Ideally you'll want to use a blank site, so pick the "Build a Custom Site" option on creation. Only you will see what your site is called, so you can call it anything you like.

Document image

Once you have successfully created your staging site, create a project folder on your machine to work within, connect to your site via CLI and then pull the site down onto your local machine so that you are ready to begin building your module.

Top Level Folders

When you begin building a Module, there are two top level folders that should be created alongside the marketplace_builder folder of your staging site. The top level module folders are:

  • modules/<module_name>/private
  • modules/<module_name>/public



Any information that is stored in the private folder will not be accessible to users within the Siteglide Site Admin, CLI and GraphQL. Here you should store any logic that you don’t want anyone to be able to see or edit. If you are following our example Siteglide Theme Demo Module, as it is a theme we do not have any private files and so this folder can be ignored.

Any information stored in the public folder will be accessible to users within the Siteglide Site Admin, CLI, and GraphQL. This folder should be used for any content that you would like to be visible and editable to the user.

Sub Level Folders

Under each top level folder you have the option to create any relevant folders for the information you are wanting to create and use, such as assets , views , notifications etc.

Full Folder Structure
|

You can view and download this full folder structure from the example directory-structure Git Repo. Alternatively, run the init command in CLI to automatically create the structure within the marketplace_builder folder and then move them into your module.

https://documentation.platformos.com/developer-guide/platformos-workflow/codebase

Directory/file

Explanation

Learn more

Assets

Used to store any assets (Images, Files, CSS etc) that you would like to ensure are accessible when your module is installed.



Views

Contains all layouts/partials/pages/templates visible from Admin & Front-end of a site the module is installed on.



Notifications

Email and API notifications



GraphQL

GraphQL Queries and other data handling









Module Setup Files

Beyond the standard site files that will be in your Module (GraphQL, Liquid, partials etc), the Module installation process will look for 3 other files in the root folder of your Module Project (alongside /modules/).

Folder Structure Example
|

setup.json

The setup.json file contains information about your module, including any tables (data) you want to create when installing your Module to a site. You can view an example of this file here.

Files generated from this JSON file:

  • Model - <module_name>.yml stored at modules/<module_name>/public/custom_model_types/modules/<module_name>.yml
  • Form Configuration - <module_name>.liquid stored at modules/<module_name>/public/form_configurations/modules/<module_name>.liquid
  • Detail Page (if applicable) - <module_name>.liquid stored at modules/<module_name>/public/views/pages/modules/<module_name>.liquid

You can find details on field types in this document

ignore-on-update.json

This file should contain a list of files you don’t want to be overwritten on sites when updating to a new version of your Module. Typically these would be any layout or asset files in your Module that a user will have edited in the last version.

Each array’s key should be the version they are created at. For example, if you want a file to be ignored when updating to any version above 1.0.0, set the key as 1.0.0.

You can see an example structure here

In this example, an update above 1.0.1 will ignore all 6 files in the list.

install-process.json

The install process file will run a Siteglide created process while the module is installed on the site. A list of all of the scripts that are relevant for each module type can be found here ::create and link::

In this example we will need a page to be set as the homepage of the site after installing the module. This is done using the set_homepage process. We will create a file with the version number of our module and set_homepage as our process as seen here.

Updated 22 Mar 2022
Did this page help you?
Yes
No
UP NEXT
3. Submit Module For Approval
Docs powered by archbee 
TABLE OF CONTENTS
<module_name>
Create Your Staging Site
Top Level Folders
Sub Level Folders
Module Setup Files
setup.json
ignore-on-update.json
install-process.json