# Controlling what counts as a page/post

**URL:** https://talk.jekyllrb.com/t/controlling-what-counts-as-a-page-post/9748
**Category:** Help
**Created:** [March 1, 2025, 8:17am UTC](https://talk.jekyllrb.com/t/controlling-what-counts-as-a-page-post/9748 "2025-03-01T08:17:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Corlio5994](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/corlio5994/32/6246_2.png) [@Corlio5994](https://talk.jekyllrb.com/u/Corlio5994)
#### Post date: [March 1, 2025, 8:17am UTC](https://talk.jekyllrb.com/t/controlling-what-counts-as-a-page-post/9748/1 "2025-03-01T08:17:46Z")

</div>

Hi everyone, I’m new to the Jekyll forum so please let me know if I’ve done something incorrectly with formatting/structure of my post : )

I’m getting started with my blog and have been working on setting up a top navigation bar for the site. I learnt how to use Liquid to iterate over the pages and posts on my site, and this works great for finding every page I would like to list! However, I’m finding that I also end up with links to things I _don’t_ want to count, like the feed.xml file created for setting up the rss feed and a css file on my site.

Below is my code which is finding the pages:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/jekyllrb/original/2X/2/25afa14b701c32257c3271c7168051e63f240bea.png)

I’ve been trying to find information on this elsewhere on the forum and I think this is happening because Jekyll treats these files as having empty frontmatter, so they are given the ‘post’ type. Is there a way I can prevent this from happening?

I would like a solution that doesn’t involve fiddling with my project heirarchy if possible, the .xml is created when building the site so I think having it be visible to Liquid code is expected behaviour. Rewriting my css file in sass would probably hide this particular file, but I can imagine running into this issue with future files and would like to be able to handle it then. If it’s just poor practice to iterate over pages/posts that would be an acceptable answer too.

---

<div class="post-metadata">

### Author: ![george-gca](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/george-gca/32/5301_2.png) [@george-gca](https://talk.jekyllrb.com/u/george-gca)
#### Post date: [March 2, 2025, 12:28am UTC](https://talk.jekyllrb.com/t/controlling-what-counts-as-a-page-post/9748/2 "2025-03-02T00:28:34Z")

</div>

How is this xml file created? Jekyll comes with [sass support](https://jekyllrb.com/docs/assets/), so you should use it. For rss I use [jekyll-feed](https://github.com/jekyll/jekyll-feed), so I don’t have this kind of problem.

Now, it is weird for jekyll to list these files under `site.pages` or `site.posts`. Any file without [front matter](https://jekyllrb.com/docs/front-matter/) is listed via [site.static\_files](https://jekyllrb.com/docs/static-files/). Are you using any front matter in these files?

One possible solution for your specific case (that shouldn’t be happening I think) is to check for if the file extension is not one that it shouldn’t. You can get the file extension with `{% assign ext = page.path | split: "." | last %}`.

---

<div class="post-metadata">

### Author: ![chuckhoupt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/chuckhoupt/32/523_2.png) [@chuckhoupt](https://talk.jekyllrb.com/u/chuckhoupt)
#### Post date: [March 2, 2025, 5:50pm UTC](https://talk.jekyllrb.com/t/controlling-what-counts-as-a-page-post/9748/3 "2025-03-02T17:50:25Z")

</div>

Jekyll’s default theme Minima has an automatically populated `<nav>` element. It only displays pages from `site.pages` that have a `title` field – that presumably filters out untitled RSS, CSS, etc. pages. Here’s the code: [minima/\_includes/header.html at master · jekyll/minima · GitHub](https://github.com/jekyll/minima/blob/master/_includes/header.html)
