templating documentation version 1.1
Updated: March 7, 2021
First of all, Thank you so much for supporting the fleeksite templating initiative, you're helping build something great. You are awesome!
This documentation is to help you regarding each step of customization. Please go through the documentation carefully to understand how the templates are made and how to edit this properly. Basic HTML and CSS knowledge is required to customize this template. You may learn basics at: w3 Schools, Mozilla Developers and Shayhowe.
You will need the following to build and customize templates.
Be careful while editing the template. If not edited properly, the design layout may break completely.
No free support is provided for faulty customization.
The host of content distribution methods available on the FleekSite Website Development Platform
We take asset delivery pretty seriously, so we've tried various different companies for our image storage and even built our own custom solutions.
Right now we deliver images using:
Amazon Simple Storage Service
Amazon CloudFront CDN
FleekSite Image Server (Resize)
FleekSite Root Image API
FleekSite Imgix CDN
So there's no shortage of methods for getting your images delivery as fast as possible. So how do we use these images dynamically in liquid ?
You use the {{image_url}} variable, this will automatically fill in with FleekSites current preferred image delivery method to ensure you have the fastest loading images.
The plan is to allow users to choose their delivery methods eventually, but for now FleekSite will automatically choose it for you, saving you the thought.
How To Stop A Page From Being Rendered By Liquid
To do this simply start the page with
<%= no_render %>
A Shell To Implement A Custom Styled Pagination
{% if blogs.pagination.page > 1 %} {% for page in blogs.pagination.last_pages %} {% if page != blogs.pagination.page %} {{page}} {% endif %} {% endfor %} {% if blogs.pagination.more %} {{blogs.pagination.page}} {% for page in blogs.pagination.next_pages %} {% if page != blogs.pagination.page and page > blogs.pagination.page %} {{page}} {% endif %} {% endfor %} {% endif %} {% else %} {% if blogs.pagination.total_entries > blogs.pagination.page_size %} {% if blogs.pagination.more %} {{blogs.pagination.page}} {% endif %} {% for page in blogs.pagination.next_pages %} {% if page != blogs.pagination.page and page > blogs.pagination.page %} {{page}} {% endif %} {% endfor %} {% endif %} {% endif %}
How To Load Your Posts and Comments Using Javascript
How To Use Forms and the various options you can pass in.
An Image Resizer Comes Built In With The Fleeksite Templating Solution, Here's How It's Used
How To Make Single Page Templates
{% for image in media %} {{image.url}} {% endfor %}
A list of the fields available when templating for the site.
We'll be taking a look at the cool uses of bits in your code.
{% for bit in bit_list %} {% if bit.category == social %} {{bit.name}}: {{bit.value}} {% endif %} {% endfor %}
{{bits.social.facekook}}
{% for bit in bit_list.social %} {{bit.name}}: {{bit.value}} {% endfor %}
We'll be looking at all the fields available for posts as well as the use of extra fields.
Liquid is the templating engine that Fleeksite uses in order to render dynamic data into the templates. Eg. from the content section.
We'll be going through all the basics you'll need to know to build a full fledged website.
There are two main types of operators in liquid:
These are denoted by a curly brace and a percentage sign, eg.
{% collection blogs %}
In the example above, a request is being made to MMS (the platform fleeksite runs on) to get blog posts for the current site, the tag is called collection, so the format is {% valid_tag options %}.
We can add a little more detail to this as well:
{% collection blogs, limit: 7, order: desc title, tag: featured %}
In this example, we are filtering the blogs by only getting blogs with the tag featured, then we are ordering the blogs by title, then finally limiting the number of blogs we get to 7.
Pretty useful and simple right?
great!
There are a number of tags, if you enter an invalid tag, then nothing will happen.
These are denoted by a pipe or vertical bar |. eg.
{{ apple pie | split: }}
This little piece of code takes apple pie and splits it at the spaces, what you'd be left with is a list of two words, apple and pie.
We have just two custom tags here at Fleeksite:
See the Liquid Documentation at the links below for further guidance:
That's it!
That's all there is to adding a new template or uploading your site.
There's going to be a lot of pictures here to make it easy getting started, so here we go:
That's it! You're site is ready to be designed.
Lorem the It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.
How to leverage layouts
<html>
<body>
{{content}}
body>
html>
How to create and customise your login forms
For customising your email templates
{{token.value}}
https://{{site.domain}}/auth/confirm/{{token.value}}?success_url=/login&failure_url=/
https://{{site.domain}}/setpass?key={{token.value}}
https://{{site.domain}}/login?code={{token.value}}
We'll take a quick look at the functionalities of the for loop
{% collection pages, limit: 10, tag: fun, name: things %}
{% for thing in things.entries %}
{% if forloop.first %}
{{thing.name}}
{% elsif forloop.last %}
{{forloop.index}}
{% endif %}
{% endfor %}
{%for i in array.items limit: 3 %}
{{i}}
{%endfor%}
next
{%for i in array.items offset:continue limit: 3 %}
{{i}}
{%endfor%}
next
{%for i in array.items offset:continue limit: 3 %}
{{i}}
{%endfor%}
{%for i in array.items offset:continue limit:3 %}
{{i}}
{%endfor%}
The partial tag is denoted by
{% partial %}
A partial tag is used to put one page or partial into another page, the name of the partial is the name of the page that you want to pull. eg.
{% partial menu %}
This example would look for the template with the title menu and replace the partial block on the page, with whatever is in the menu template.
A Quick Look At Conditional Tags
{% if 4 > 5 %} less is greater {% elsif 3 == 2 %} 3 is 2 {% else %} neither {% endif %} {% if 'apples' like 'apple' %} true {% else %} false {% endif %} {% if 'apples' contains 'apple' %} true {% else %} false {% endif %}
{% unless name == PearOrAvacado %} {{role}} {% else %} {{other_role}} {% endunless %}
{% case a.size %} {% when 1 %} Small {% when 2 %} Big {% endcase %}
{% collection %}
{% collection blogs, name: featured_blogs %}
{% collection products, tag: special %} {% for product in products.entries %} {{product.title}} {% endfor %}
{% collection users, limit: 4 %} {% for user in users.entries %} Hi! {{user.first_name}} {{user.last_name}} {{user.tags}} : {{ user.tags | contains: 'tag' }} {% assign random_tag = user.tags | random %} {{random_tag}} {% endfor %}
{% collection landings, order: inserted_at desc %}
{% collection pages, limit: 5 %}
{% collection pictures, override_page: true %}
{% collection blogs, starred: true %}
{% collection blogs, user_sub: true %}
{% collection blogs, label: tech %}
{% collection blogs, status: Draft %}
{% collection blogs, starred: true %}
{% collection blogs, user: 230 %}