Site Generator

Model Code / Markup

The Site Generator tab in Sleek CMS provides a powerful and flexible environment for managing the code and markup that drive your website’s structure and functionality. This tab serves as a central hub for configuring how the code for content models, pages, entries and blocks are written and rendered, enabling users to customize their site’s output with precision. By leveraging a combination of main templates, base templates, and build configurations, the Site Generator ensures a seamless integration of content with the site’s design and assets. Users can leverage EJS for crafting the code that powers their website, while utilizing Tailwind CSS to apply sophisticated and responsive styling, ensuring a seamless and visually appealing design.

Main Template

The main template is the core markup that processes each model, entry, or page as an item/current. This template dynamically interprets the content data, providing the structure that brings your site to life.

Base Template

The base template acts as a wrapper around the main template, offering a consistent framework that is typically shared across all pages. This ensures uniformity in layout and design throughout the website.

Template Context

The template context represents the data available within the templates, enabling dynamic content rendering based on the defined models and entries.

Item Preview

When previewing an item, only the specific page associated with that item is generated. Links to other pages may not function if no content has been added for those models. In such cases, placeholder or dummy content is utilized to generate the preview, ensuring a functional view during development.

Assets

Assets are treated as the public folder, with all content stored in this section being accessible at the root of the site when generated. Users can think of assets as the public-facing resources (e.g., images, CSS, or JavaScript files) that enhance the site. By linking to any JS or CSS file in your code with a root path starting with /, you can seamlessly incorporate these assets into your project, streamlining resource management.

Site Build Config

The Site Build Config section allows users to define and customize build settings to optimize their website’s deployment and performance. Key configurations include:

  1. Title - Used as Page Title When None Found: Specifies the default title applied when no page title is defined, also utilized for sitemaps and RSS feeds.
  2. Site Address - This is the Site Origin When Deployed at Some Domain: Defines the site origin when deployed on a domain, ensuring accurate sitemaps and RSS feeds are generated based on this provided origin.
  3. Sitemap - Enabling This Option to Auto Create a Site Map: Requires site address/origin to be provided for sitemap generation.
  4. Tailwind - Enabling This Config, Auto Compiles Optimized Tailwind CSS and Includes That in All the Pages in Your Site: No other include/links necessary, optimizing performance and consistency.
  5. Adding Libraries - Add Any JS/CSS URLs from CDNJS or Other Such Provider to Use Them in Your Code: Enhances functionality by incorporating external libraries.
  6. Inline Scripts - Add Include Script Such as Google Analytics Etc.: Allows integration of tracking or analytics scripts directly into the site.
  7. Inline Styles - Add Inline Styles / Style Overrides Here: Provides the ability to apply custom styles or overrides as needed.