Pages & Entries
The two primary types of content in Statamic.
Every piece of content you create for your website is either a page or an entry. Let’s learn the difference between the two.
Pages
A page is intended to be a mostly static webpage. You may change the content within a page from time to time, but aside from cross-links in content and appearing in your site’s navigation, a page pretty much just lives where it lives.
Great examples of common uses for pages:
- Your Homepage
- About Us
- Contact Us
- Our Team
- Legal Pages
Pages are indicated by their filename.
They will either have no ordering mechanism (page.md
) or will use numbers as an ordering mechanism (1.about.md
).
The URL for a page named page.md
is the folder that that file lives in.
For example, _content/about/page.md
would be /about
on your website.
If you use a name other than page.md
, that filename also becomes part of the URL.
For example _content/about/team.md
would be /about/team
on your website.
Ordering Pages & Folders
Folders and pages can be given a specific order by putting an index number in front of them, followed by either a period (.
), hyphen (-
), or underscore (_
).
Ordering your site’s folders would have your content directory look something like this:
/
/1-blog
/2-services
/3-about
/4-contact
We’re discussing ordering folders because using page.md
within each folder will enable that folder to be a URL.
So having page.md
in 1-blog
from the example above will create http://example.com/blog
as a page on your site.
Ordering pages within folders works the same way.
/3-about
/1-overview.md
/2-team.md
/3-clients.md
Although pages are generally static things, this page-ordering becomes helpful when using the nav tag.
Entries
An entry is any other content that’s not a page. These are the “dynamic” bits of your content intended to be one post within a series of similar posts. Viewing an entry is essentially viewing a “detail page” from a bigger set of content. Some examples:
- a blog post
- a calendar event
- a product detail page
Sets of blog posts, for example, would probably make a pretty good list somewhere else on your site.
Ordering Entries
Entries can be ordered in three ways:
- Alphabetical ordering uses the alphabetical order of the filename, nothing additional is needed.
- Date- or date/time-based ordering is used when entries are prefixed with a date (plus an optional time).
To use date-based ordering, start your entry filenames with the date they apply to in the format
YYYY-MM-DD
. Date/time-based is similar, using the formatYYYY-MM-DD-HHMM
. - Index-based ordering is used when entries are prefixed with a number followed by a period (
.
).
No matter what ordering mechanism you use, Statamic will strip that part out for your URL.
So your _content/blog/2013-01-15-high-fiveathon.md
blog post is simply /blog/high-fiveathon
on your site.
Note: For best results, entries in the same folder should use the same ordering method, but which one you use is completely up to you. Learn more about when this comes into play when you use the entries tag.
A Tiny Overlap
You may have noticed that pages and entries have a small overlapping area: both can be ordered by using an index number. Because of this, you’ll want to make sure not to combine the two methods in one folder, or you’ll end up with unexpected results.
Our official recommendation: don’t use ordered-pages in the same folder that contains entries ordered by number. We think you’ll find that most of the time you didn’t need to do so anyway.