# How Jekyll knows what files are posts/pages/etc?

**URL:** https://talk.jekyllrb.com/t/how-jekyll-knows-what-files-are-posts-pages-etc/8154
**Category:** Help
**Created:** [April 10, 2023, 6:58am UTC](https://talk.jekyllrb.com/t/how-jekyll-knows-what-files-are-posts-pages-etc/8154 "2023-04-10T06:58:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![filomena](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@filomena](https://talk.jekyllrb.com/u/filomena)
#### Post date: [April 10, 2023, 6:58am UTC](https://talk.jekyllrb.com/t/how-jekyll-knows-what-files-are-posts-pages-etc/8154/1 "2023-04-10T06:58:12Z")

</div>

In the [Front Matter Defaults](https://jekyllrb.com/docs/configuration/front-matter-defaults/) documentation, there is written:

> Since the path is set as an empty string, it will apply to **all files** in your project. You probably don’t want to set a layout on every file in your project - like css files, for example - so you can also specify a `type` value under the `scope` key.

So we specify a file `type`.

Later on, we put the following in our `_config.yml`:

```auto
defaults:
  [...]
  -
    scope:
      path: "projects"
      type: "pages" # previously `page` in Jekyll 2.2.
    values:
      layout: "project" # overrides previous default layout
      author: "Mr. Hyde"

```

So we apply this default to file of type `pages`.

But what is a “page” to begin with? How does a file acquire the type of “page”?

I thought a “page” was a HTML or MD file residing under `_pages` (see the step-by-step tutorial).

But that is not the case, since in this case they reside under “projects”.

how does jekyll tell which file in “projects” is of a “page” type?

> Any html files that exist in the `projects/` folder will use the `project` layout, if it exists.

So any HTML file under `projects` will use the `project` layout.

So a `page` is any HTML file. So what is a `post`? Is it not a HTML also?

---

<div class="post-metadata">

### Author: ![filomena](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@filomena](https://talk.jekyllrb.com/u/filomena)
#### Post date: [April 10, 2023, 7:30am UTC](https://talk.jekyllrb.com/t/how-jekyll-knows-what-files-are-posts-pages-etc/8154/2 "2023-04-10T07:30:47Z")

</div>

There is even more confusion as the [Front Matter doc](https://jekyllrb.com/docs/front-matter/#predefined-global-variables) specify a new, undefined, type: “document”

> Starting from version 3.5.0, using `none` in a post/document will produce a file without using a layout file regardless of front matter defaults.

---

<div class="post-metadata">

### Author: ![ashmaroli](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@ashmaroli](https://talk.jekyllrb.com/u/ashmaroli)
#### Post date: [April 10, 2023, 3:44pm UTC](https://talk.jekyllrb.com/t/how-jekyll-knows-what-files-are-posts-pages-etc/8154/3 "2023-04-10T15:44:30Z")

</div>

Hello @filomena,  
Jekyll assigns `type` based on whether it is part of a collection and whether it contains front matter (even if empty front matter).  
Files with front matter inside a collection are of type akin to the collection. i.e., inside collection `_posts`, the file is of type `posts`, but if inside collection `_projects`, then the type is `projects`, etc. Files with front matter but not in a collection is of type `pages`. Confusion arises when a user creates a collection out of `_pages`. Jekyll now considers both as `pages`.  
Files without front matter anywhere in the site has a `null` type.

---

<div class="post-metadata">

### Author: ![filomena](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@filomena](https://talk.jekyllrb.com/u/filomena)
#### Post date: [May 27, 2023, 6:41am UTC](https://talk.jekyllrb.com/t/how-jekyll-knows-what-files-are-posts-pages-etc/8154/4 "2023-05-27T06:41:11Z")

</div>

That’s clear. THanks
