Statamic Collections and Entries Setup

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1 servicesAll 2065 services
Statamic Collections and Entries Setup
Simple
from 1 business day to 3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Statamic Collections and Entries Setup

Collections are the main organizational unit of content in Statamic. Analogous to Post Types in WordPress, but more flexible: defines URL structure, sort order, tree structure, and Blueprint for each content type.

Creating a Collection

php artisan statamic:make:collection blog
php artisan statamic:make:collection pages --structure

Collection config:

# content/collections/blog.yaml
title: Blog
template: blog/show
layout: layout
date: true
date_behavior:
  past: public
  future: private     # hide scheduled posts
sort_field: date
sort_direction: desc
paginate: 12
slugs: true
propagate: false
routes: '/blog/{slug}'

Structured Collections (pages)

# content/collections/pages.yaml
title: Pages
template: page
layout: layout
routes: '/{parent_uri}/{slug}'
structure:
  root: true           # root pages without parent
  max_depth: 3
  expects_root: true

Entry (Record) in File System

# content/collections/blog/2024-03-15.my-first-post.md
---
id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
title: My First Post
slug: my-first-post
date: 2024-03-15
template: blog/show
blueprint: post
published: true
categories:
  - key: web-development
featured_image: assets/images/hero.jpg
excerpt: Short description of the post
---
Content of the post in Markdown.

Querying Entries in Templates

{{# Basic query #}}
{{ collection:blog }}
    {{ title }} — {{ date format="d.m.Y" }}
{{ /collection:blog }}

{{# With filtering and sorting #}}
{{ collection:blog
   status:is="published"
   sort="date:desc"
   limit="6"
   taxonomy:categories="web-development"
}}
    {{ results }}
        {{ partial:blog/post-card :post="this" }}
    {{ /results }}
{{ /collection:blog }}

{{# Filter by custom field #}}
{{ collection:events
   where:event_date:gte="{ now }"
   sort="event_date:asc"
   limit="10"
}}

{{# Across multiple collections #}}
{{ collection from="blog|news|press-releases"
   sort="date:desc"
   limit="10"
}}

PHP Queries via API

use Statamic\Facades\Entry;
use Statamic\Facades\Collection;

// Get entries
$posts = Entry::query()
    ->where('collection', 'blog')
    ->where('status', 'published')
    ->orderBy('date', 'desc')
    ->limit(10)
    ->get();

// Single entry by slug
$post = Entry::query()
    ->where('collection', 'blog')
    ->where('slug', $slug)
    ->first();

// Entry by ID
$entry = Entry::find('a1b2c3d4-e5f6-7890');

Taxonomies: Categories and Tags

# content/taxonomies/categories.yaml
title: Categories
route: '/blog/category/{slug}'
collection:
  - blog
  - news
{{# List all categories with count #}}
{{ taxonomy:categories sort="title:asc" }}
    <a href="{{ url }}">{{ title }} ({{ entries_count }})</a>
{{ /taxonomy:categories }}

Setting up 3–5 collections with proper routes and taxonomies — 4–8 hours.