Content Management System

The Content Management System, or CMS, is a powerful component that allows you to add custom pages and content to your website.

CMS consists of 3 sub-components. Pages, snippets and resources.

The content management system is still in its infancy. Although it is already an extremely flexible and powerful component, utilizing it to its full potential requires some basic web development skills.

TBA

Snippets are small pieces of content that can be re-used, or more easily modified compared to entire pages. It's generally a good idea to turn static content into manage-able snippets.

Snippets can be managed from the admin panel. Found under Settings -> Snippets.

Currently there are 2 types of snippets.

  • Rich Text: Use a WYSIWYG rich text editor to enter content.
  • Twig: For raw Twig HTML code, requires some web development skill.

After saving a snippet, it will be given a slug. This slug is what you will need to use your snippet in pages or other snippets.

You can use your snippets anywhere in Twig code, including CMS pages, or even nested in other snippets.

To use a snippet, use the snippet('snippet-slug') Twig function.

For example, if you created a snippet with the name "My Cool Snippet", the generated slug would be "my-cool-snippet". Then to use your snippet in a page:

{% extends '@Forumify/frontend/page.html.twig' %}
{% block body %}
    {{ snippet('my-cool-snippet') }}
{% endblock %}

While you could link to any resource, or upload your own assets to your website, the resource system makes it easy for your site admins to find and replace static assets.

Resources could be anything, images, downloads,...

Resources can be uploaded from the admin panel, they can be found under Settings -> Resources.

Simply supply a name and the file and press save. After saving your resource, it will be given a slug. Take note of it, this is what you will need to use the resource in pages and snippets.

Resources can be used in pages and snippets using the resource('resource-slug') Twig function

For the following examples, we've created a resource named "My Cool Resource". The slug that was generated for it is "my-cool-resource".

To display a resource as an image, use the <img> tag, with the resource in the src attribute.

<img src="{{ resource('my-cool-resource') }}">

To make the client download a resource, you can use an <a> tag, with the resource in the href attribute and setting the download attribute.

This example shows a download button.

<a class="btn-primary" href="{{ resource('my-cool-resource') }}" download>
    <i class="ph ph-download-simple"></i>
    Download
</a>