Pages

Pages represent the ways your platform data is displayed to your users. Pages have the following settings available:

  • Title: A friendly label for your page
  • Description: A description of your page
  • Page URL: The URL your front end design is hosted on
  • Friendly Route: The URL the authenticated Tangram hosted version of your page will be accessible at

How Pages Work

Pages created in Tangram require a corresponding custom front end to function. When you connect a custom front end, two versions of the page will exist: the front end version hosted by your front end provider (we will assume Webflow going forward, as this is the most common option for Tangram users), and the authenticated version hosted by Tangram. The Webflow version of your page is generally the one you want indexed by search engines and used by unauthenticated users. The Tangram version of the page pulls its source code directly from the webflow version and must be used if you're implementing custom nav bars or any other functionality that requires server side authentication.

The Global Script Tag

Each Tangram platform has a global script tag that can be copied from the pages menu. This script tag should be implemented such that it renders in the head of all of your front end pages. If you're using webflow, you should place it in the project settings level header. Adding the global script tag is like giving your Webflow site a brain--it tells your front end pages what data to load and where to put it.

Sections

Sections determine what content should appear on a page and how it should render. Each section can have field groups attached to it, which determine what data is returned when the page data is requested. A section can also have filters attached to it, which allows you to dynamically pull select field values from the tangram app and render them on your front end for dropdown based search and filtering.

Connected Field Groups

Field groups added to the connected field groups menu on the section settings for a page will be sent in the payload for that page when loaded. This allows you to control what data is shown on what front ends.

Pushed Fields

Pushed fields determine which fields are sent for each of your connected field groups. When a page is rendered, pushed fields are iterated through for each connected field group. If a record from one of your connected field groups has a value matching a pushed field, that value will be sent to the page. One nuance to be aware of is that pushed fields are checked for all connected field groups. If, for example, your users and listings both have a location and location is added to your pushed fields menu, location for both listings and users will be sent to your page.

Pushed Filters

Pushed filters allow you to send payloads for your filters to the page, which can then be used to populate dynamic dropdowns on your front end for filtering that are based on what values are used in your Tangram app.

Semantic Structure

Tangram data is rendered on custom front ends via custom attribute replacement. In order for data to render on a Tangram powered page, you need the following things:

  • A global script tag
  • An element with the id of each section you want to render.
  • An element with tg-import-type set to the type of data you're rendering. This will usually be either user, listing, review, or the id of a custom field group
  • An element with the field id of the piece of data you want to replace.

Here is an example of what the front end code for a basic page might look like:

<html>
             <head>
              <script src = "your global script url"></script>
             </head>
             <body>
              <section tg-section-id="your section id">
               <div tg-import-type = "user">
                <p tg-user-value = "display_name"></p>
                <div tg-import-type = "listing">
                 <p tg-listing-value = "title"></p>
                </div>
               </div>
              </section>
             </body>
            </html>
            

Here's a breakdown element by element of the important parts:

  • <script src = "your global script url">: your platform's global script tag
  • <section tg-section-id="your section id">: a div with the friendly id of the section you want to render the data from
  • <div tg-import-type = "user">: tells the script that further elements in this container should be rendered in the context of a piece of user data
  • <p tg-user-value = "display_name">: tells the script to replace the contents of this element with the corresponding user's display name
  • <div tg-import-type = "listing">: tells the script that further elements in this container should be rendered in the context of a piece of listing data
  • <p tg-listing-value = "title">: tells the script to replace the contents of this element with the corresponding listing's title

Script Manager

The script manager determines what scripts are loaded in via your global script tag. Tangram manages this automatically for the most part, but you may need to make changes to it if you're a power user. Any script added to this menu will be loaded in wherever on the page your global script tag has been added, usually the head of the document.

Import Types

Import types are attributes you apply to a div wrapped outside the elements pulling into field data. E.g. the attribute tg-import-type = user must be around all elements with user attributes.

<div tg-import-type = user>
              <p tg-attribute = display_name>Full Name</p>
              <p tg-attribute = email>Email<p>
            </div>

Note: you can nest import types if you want both user and listing data on a page. On a listing details page you may want to also display some info about the user who created the listing.

<div tg-import-type = listing>
              <p tg-attribute = TG_title_text-field>Listing Title</p>
              <img tg-attribute = photo></img>
              <p tg-attribute = [field_id]>Insert any custom field tied to listings</p>
              
              /*You can nest import types within each other*/
              <div tg-import-type = user>
                <p tg-attribute = display_name>Full Name</p>
                <p tg-attribute = [field_id]>Insert any custom field tied to users</p>
              </div>
            </div>