We use cookies to make your viewing experience better. By accepting you consent, you agree to our Cookie policy

Improve your Craft CMS skills

A Complete Guide: How To Use Craft CMS 3

10 min read
How To Use Craft CMS 3

Looking to build a customizable, content-focused website? Craft CMS provides a flexible, user-friendly content management system optimized for developers and designers. This complete guide covers everything you need to know to master Craft CMS, from installation and setup to managing content, customizing with plugins, integrating via API, and optimizing for SEO. Follow our practical advice to launch robust, scalable sites with this modern CMS platform.

Craft CMS provides a flexible content management system for developers to build customizable sites. Key features include customizable content modeling, template design with Twig, plugin extensions, headless APIs, and optimized administrative tools for managing content workflow, users, and production deployments. Craft enables full control over structured content and presentation.

Understanding How Craft CMS Works

Twig Templating System

Twig is the flexible, fast, and secure templating language that powers the front-end of Craft CMS. It enables designers and developers to cleanly separate content from presentation.

With Twig, you can display content pulled from Craft's back-end in whatever format you like. It allows for template inheritance, meaning you can define parent templates with common elements like headers and footers, and child templates that inherit those common elements.

Twig provides variables to represent content, logic like if statements and for loops to manipulate content, and filters to modify how variables are displayed. The syntax is easy to read and learn.

Overall, Twig provides complete control over how contentmanaged in Craft's back-end is rendered in the front-end templates.

Modular Plugin Ecosystem

One of Craft's major strengths is its extensive Craft CMS plugin ecosystem. Plugins extend Craft's functionality in limitless ways. There are over 500 plugins available to meet a wide range of needs.

The Plugin Store in the Craft control panel makes it easy to browse and search for plugins. You can sort and filter plugins by category, rating, compatibility, and more. Installation of plugins is a breeze - just a couple clicks and you are up and running.

Craft provides excellent tools for managing and configuring plugins. You can add plugins to Craft CMS. You can view which plugins are installed, update plugins, disable or uninstall them, and manage licensing.

For developers, Craft makes it straightforward to develop custom plugins. The documentation guides you through the process, and Craft's modular architecture means your plugins can introduce new components that integrate seamlessly into the control panel.

Flexible Content Modeling

Craft offers immense flexibility when it comes to modeling your content to match your requirements. It is built around the concept of content elements that you can define with custom fields.

For example, you may have an "Article" element with fields like "Title", "Body", "Author" etc. Fields can use native types like text or integers, or special field types like Tags, Categories, or Structures.

Tags let you relate content elements to keywords or tags. Creating categories provides a way to group content elements. Structures enable building nested content with complex relationships.

Overall, the field system coupled with relationships like Tags and Categories enables modeling content in Craft CMS in highly customized ways tailored to your needs. You get tremendous flexibility without the restrictions of rigid content modeling.

Installation and Environment Setup

System Requirements

Craft CMS has a few key requirements to function properly:

  • PHP 7.0 or greater

  • MySQL 5.5+ or MariaDB 5.5+

  • Apache or Nginx web server

  • At least 256MB memory allocated to PHP

Craft CMS is built on PHP and requires MySQL or MariaDB to store and query data, so having those installed is essential. The system requirements are otherwise flexible - Craft can run on shared hosting up to enterprise servers.

Some Craft plugins may have additional requirements like ImageMagick for image processing. Overall though, Craft aims to keep requirements low for accessibility.

Installation Options

There are a couple ways to install Craft CMS:

Locally, developers can use Composer to install Craft and manage dependencies. Composer handles downloading Craft core files, configuring directories, and installing plugins. This is the easiest way to install Craft for local development.

For remote servers, you'll manually upload Craft's files via FTP/SFTP to the document root directory. The index.php file will trigger Craft's web-based installer which handles configuring file permissions and creating the database.

During installation, you can select to either create a new database or use an existing one. The installer migrates Craft's tables and sample data for you.

No matter if installing locally or remotely, the process is straightforward. Craft's documentation provides step-by-step instructions for both installation methods.

Configuration and Settings

After installation, there are some key configurations and settings to review in the control panel:

General Settings - This includes your site name, language, timezone, error handling, and other defaults.

Users - Set up user accounts, roles and permissions for your team members.

Sites - Manage multi-site setups from one Craft CMS install.

Sections - Define the structure and content types for your site.

Asset Storage - Configure where files are stored locally or remotely like Amazon S3.

Security - Review security policies, generate new keys, and manage user sessions.

It's important to set these initial configurations properly as they impact the foundation of your site. Craft's settings provide flexibility to tune performance, security, and functionality as needed.

The control panel makes settings easy to navigate and modify. Things like asset storage and security policies also have more advanced options accessible to developers. Overall, Craft CMS gives you the control to configure your site for optimal performance.

Creating Your First Craft CMS Website

Planning Site Structure

When starting a new Craft CMS project, it's important to plan out your site's architecture and content structure. This involves defining:

  • Sections - These represent different content types like Pages, Blog Posts, Events etc.

  • Entry Types - You can have multiple types of entries in a section, like News and Reviews in a Blog section.

  • Fields - Customize the fields for each entry type, like Title, Body, Image etc.

  • Taxonomies - Relate and categorize content with Tags, Categories and Relations.

Sections and entry types provide the framework for modeling your content. Planning these upfront ensures flexibility later as your content grows.

You can also plan site navigation and hierarchies using structures and entry types. Overall, planning your site's architecture is crucial for long-term flexibility with Craft CMS.

Adding Website Content

Once sections and entry types are defined, you can start adding concrete content to your Craft CMS site.

Blog posts, pages, news articles, and other entries are added in their respective sections. The custom fields defined for that entry type allow you to add formatted content.

For complex content, you can use Matrix blocks to create repeatable groups of fields. For example, an FAQ page might have multiple Question/Answer matrix blocks.

All content is securely stored and can be related using taxonomies. Entries can have authors assigned as well. It's easy to manage all website content from one intuitive control panel.

Craft CMS Templates

To display content to visitors, Craft uses Twig templates on the front-end. Templates contain a mix of Twig tags, HTML, and CSS.

Some common things in Craft CMS templates:

  • Variables - Display content using {{ variable }} tags

  • Template Inheritance - Extend parent templates to reuse code

  • Includes - Import and reuse Twig partials across templates

  • Filters - Format and modify how variables output

  • Functions - Reusable functions to abstract logic away

Twig gives full control over front-end presentation while keeping content separate. You can build a custom theme by creating template files for each page or section.

Templates combined with Craft's flexible content modeling enable you to build a customized front-end powered by a structured back-end content repository.

Managing Content in the Control Panel

Creating and Editing Content

The Craft CMS control panel provides a user-friendly interface for managing all your website content.

To create new content, navigate to the appropriate section, select the entry type, and fill in the custom fields. Craft saves drafts automatically so you can come back to finish.

The control panel shows all your existing content with options to edit, delete, or view history. When editing entries, changes are tracked so you can revert if needed.

Craft also supports multiple editors through a collaborative content workflow. Users get assigned roles that control permissions for creating, editing, reviewing and publishing.

Overall, the control panel makes it easy to safely create and update site content. Craft's flexible fields and entry modeling combine with intuitive editing and workflow.

Previewing and Publishing

Craft allows previewing content changes before going live. Within the control panel, toggle between Edit and Preview modes.

Preview mode shows your changes on the front-end as if they were live. However, regular site visitors won't see those changes yet.

This allows reviewing content in its published context before releasing. You can check for formatting, links, responsive design, and other issues.

When ready, use the Publish button to push the changes live. For large sites, you may publish in batches during off-hours.

The preview and publish workflow ensures a smooth roll-out of content changes. Site administrators can control which users have preview versus live publish permissions.

Assets and Media

The Assets section of the control panel manages all your media including images, documents, audio, and video.

You can upload files directly or connect remotely to services like Amazon S3. Craft organizes assets using folders and tags.

Once uploaded, you can edit EXIF data, crop images, rename files, and trigger other optimizations. Image transforms resize images for responsive delivery.

Entry fields can connect directly to Assets enabling intuitive image and file selection when authoring content.

Overall, Craft's asset manager combines organization, editing, and optimization to smoothly handle all your digital media. The integration with content modeling and authoring creates a streamlined workflow.

Users, Permissions and Access Control

User Accounts and Roles

Craft allows creating editable user accounts for content managers, editors, authors, and administrators.

By default, Craft comes with User, Editor, Author, and Admin roles. Users get assigned a role that defines what they can access.

The Admin role has full control over the CMS. The Author role can only create content in permitted sections. The Editor role can also edit others' content.

You can customize roles by modifying their preset permissions. Additional custom roles can be created to match your workflow like Marketing, Sales, HR and more.

Assigning restrictive roles bolsters content security. Users should only get the permissions their role needs. Never use an Admin role for normal content changes.

Permissions and Access Control

In Craft, permissions are attached to user roles and control what areas users can view or edit.

For example, you may allow Authors to create blog posts but not pages. Or reviewers may only edit existing content, not create new.

Granular settings allow assigning permissions for sections, entries, assets, plugins, user management and more.

Best practices are to be as restrictive as possible. Limit sections and entries using lightswitch or limit settings. Steer clear of an open-ended "User can do everything" role.

Craft's permissions model enables building a tailored CMS workflow for any team structure. Roles combined with permissions provide deep access control.

Managing Users

The Users section of Craft's control panel enables managing users, groups, roles, permissions and settings.

User profiles store names, emails, passwords and settings like language and timezones. Users get assigned to one primary role but can join multiple user groups.

New roles are created from the Roles tab. Permissions are configured by toggling options for each content section, plugin, etc.

User groups allow collective management of permissions across users. Groups can also have their own permissions assigned.

Overall, Craft provides robust yet accessible user management. Secure access control starts with planning roles and permissions for your team's needs.

Front-end Development with Twig Templates

Displaying Content

Craft uses Twig templates to output content to the front-end of your website. Twig provides a powerful yet easy syntax for displaying content.

To show an entry, use {{ entry }} tags. You can display specific fields like {{ entry.title }}. For assets, use {{ asset }} or {{ asset.url }} for the file path.

Twig gives you total control over presentation. You can render content in HTML or customize it further with CSS and JavaScript. Twig also handles advanced logic like conditionals and for loops.

With a flexible content model built in Craft's back-end, Twig templates enable a customized display layer attuned to your brand. The separation of content and presentation is clear.

Twig Syntax and Functions

Twig introduces its own template language focused on displaying data. Some key components:

Variables - {{ variable }} displays values stored in variables.

Filters - {{ text|lower }} modifies variables, e.g. formatting text.

Functions - {{ get_author(entry) }} reusable functions for common logic.

Tags - {% if entry %} Executes logic like if statements and for loops.

Comments - {# Comment text #} Leaves non-visible notes in templates.

Twig syntax is easy to pick up but enables complex template logic. Developers can create custom Twig functions and filters tailored for your project.

Caching, Security and Best Practices

To optimize performance, enable Twig caching so templates don't recompile on every page load.

Use {% cache %} tags to cache blocks. Cache entire templates by enabling caching in settings.

For security, beware of outputting unvalidated user content and use {% verbatim %} tags when outputting Twig syntax.

Other best practices are enabling devMode for debugging, using strict variables, self-closing HTML tags, and avoiding spelling out long variable names.

Overall, Twig empowers developers to build secure, fast front-ends driven by clean templates connected to Craft's content API.

Customizing Craft CMS with Plugins

Types of Plugins

One of Craft's biggest strengths is its vibrant plugin ecosystem. There are a few types of plugins:

Free Plugins - Many free plugins are available from the official plugin store and developers. Great for basic utilities.

Paid Plugins - Premium plugins that offer extended features and support. Worth the cost for complex needs.

1st Party Plugins - Maintained by Craft CMS for core functionality like redactor, commerce, etc.

3rd Party Plugins - Plugins created by the community and other developers. Can be free or paid.

Custom Plugins - Have developers build custom plugins tailored to your project's needs.

This diversity enables finding plugins for practically any requirement while keeping Craft's core lightweight. Paid plugins offer more specialized capabilities while custom development provides unlimited flexibility.

Finding and Installing Plugins

The official Craft Plugin Store hosts over 500 plugins to browse and search. You can filter by category, rating, compatibility and other attributes.

When evaluating plugins, check the developer's reputation, quality of support, documentation, ongoing maintenance, and if it fits your specific needs.

Installing plugins from the control panel is straightforward - upload a zip file or paste in a Composer package name. Craft handles dependencies, database changes, and configuration.

Searching the store and installing right from the CMS streamlines enhancing your site with plugins. Beselective about which plugins you add to avoid bloat.

Managing and Updating Plugins

Craft allows managing installed plugins from the control panel. You can check versions, enable/disable, access support info, and configure settings.

Updating plugins ensures you have the latest versions with new features, security fixes and compatibility updates. It's good practice to review plugin updates regularly.

Some management best practices are to disable unused plugins, watch for conflicting plugins, test updates on dev sites first, and remove outdated plugins you no longer need.

Cleanup up old plugins helps sustain performance and prevent security issues. The control panel provides excellent tools for staying on top of your plugins.

Integrations and Headless Craft CMS


Craft CMS provides a complete REST API for retrieving and manipulating content from external applications.

The API enables pulling content and assets into native mobile apps, integrating with ecommerce platforms, connecting to single sign-on services, and more.

For example, you can have a mobile app fetch blog posts from Craft's API. Or sync products to an ecommerce store. The API provides a flexible bridge to extend Craft's content capabilities.

Documentation for Craft's REST API covers endpoint references, authentication, examples in JavaScript, PHP, and other languages. Whether you need read, write or admin access, the REST API has you covered.

Headless Craft CMS

Craft CMS works excellently as a headless or decoupled CMS. This separates the content back-end from the presentation front-end.

Craft acts as the content repository and API provider. Front-ends can then consume content through API requests and render it via popular frameworks like React, Vue, and Angular.

Benefits of headless Craft include freedom to use any front-end stack, scalability to distribute load, and flexibility to feed content to multiple channels.

Overall, Craft offers an ideal headless CMS solution thanks to its clean content modeling, structured data, and robust APIs for delivery.

GraphQL Integrations

GraphQL provides an alternative to REST APIs for connecting Craft to JavaScript front-ends and static site generators.

Popular integrations include:

  • Next.js - Server-side rendered React framework

  • Gatsby - Static site generator for React

  • Vue - Progressive JavaScript framework

  • CraftQL - Native GraphQL for Craft CMS

These leverage GraphQL's ability to aggregate data and declare structure while eliminating over/under-fetching issues in REST.

Craft's flexible content schema maps nicely to GraphQL for a headless implementation. Look to GraphQL for fast, efficient front-end integrations.

SEO Optimization with Craft CMS

Metadata and Sitemaps

Optimizing metadata is crucial for good SEO with Craft CMS. Dynamic page titles, descriptions, images, and other metadata improve how pages are indexed.

In templates, customize titles and meta tags for each page or section. Avoid duplicating or missing titles that can confuse search engines.

An XML sitemap helps search engines discover all pages on a site. The Sitemap plugin generates a sitemap.xml file automatically.

Use a robots.txt file to guide crawler behavior. Indicate any protected, staging, or non-production pages to avoid indexing.

Overall, optimizing the Craft CMS SEO plugin for sitemap creation and metadata helps search engines understand your site's content and structure for better rankings.

URL Structure

Craft provides tools to create clean, logical URL structures that are SEO and user friendly.

For example, blog post URLs like example.com/blog/post-title are preferable to example.com?p=123.

Enable "human-readable" URLs globally and set up redirects for changing URLs. Avoid excessive dynamic parameters.

Per-template URI settings give control over post, page, and other URLs. Set logical trailing slashes, categories, dates, etc.

Modifying the site structure also changes URLs so plan ahead. Follow best practices for a crawlable site.

Analytics and SEO Plugins

Integrating analytics like Google Analytics is crucial for tracking website traffic and performance. Many SEO plugins integrate with analytics.

Tools like SEOmatic help optimize pages, generate sitemaps, and analyze content. The Yoast SEO plugin provides readability analysis and XML sitemaps as well.

There are plugins for social media integration, security enhancements, speed optimization, and more. Expand Craft's SEO capabilities with purpose-built plugins.

Stay on top of analytics trends, leverage SEO-focused plugins, and regularly revisit best practices to maximize search ranking with Craft CMS.

Managing Live Craft CMS Websites

Version Control and Deployment

Use Git or SVN to version control your Craft system files, config, and templates. Commit changes as you develop locally.

Push commits to remote repositories on dev and staging servers to preview changes. When approved, deploy to production by pulling the vetted code.

Services like DeployBot integrate with Git and Craft to automate deployments. Webhooks can trigger builds on code changes.

Version control and continuous deployment streamlines managing code changes across environments. Keep all servers in sync and minimize errors.

Backups and Restores

Regular backups are vital for live Craft sites. Use the built-in tool or plugins to backup the database and assets.

Download backups locally or to external services like Dropbox or Amazon S3. Schedule daily or weekly automated backups.

To restore, import the database and assets archive via the control panel. Test restores on staging environments first. Only restore production from recent backups.

Offsite backups ensure you can recover from data loss, corruption, or disasters. Test redundancy by restoring on dev servers.

Updates, Security and Monitoring

Check for Craft and plugin updates regularly to patch bugs and security flaws. Review release notes before updating production.

Follow security best practices like limiting Admin access, strong passwords, secure asset storage permissions, and monitoring logs.

Monitor uptime and performance with external tools. Get alerts for unexpected outages, traffic spikes, or response slowdowns that need investigating.

Stay vigilant about updates, security, and monitoring to sustain robust live sites. Maintenance like backups and tuning keeps production humming.

Shape April 2022 HR 202
Andy Golpys
- Author

Andy has scaled multiple businesses and is a big believer in Craft CMS as a tool that benefits both Designer, Developer and Client. 

Show us some love
Email Us
We usually reply within 72 hours
Agency Directory
Submit your agency
Affiliate Partners
Let's chat