How the _data Folder Powers Structured Content in Jekyll

As your Jekyll site grows, you will quickly notice patterns: repeated navigation menus, lists of team members, product catalogs, or FAQ sections. Hardcoding these items inside layouts or posts is possible but not scalable. That is where the _data folder becomes invaluable. This directory allows you to store structured data in formats like YAML, JSON, or CSV, and then call that data anywhere across your site using Liquid templating. In other words, the _data folder transforms your Jekyll site into a more dynamic system while still keeping it static and fast.

Questions This Guide Will Answer

What is the _data folder in Jekyll

The _data directory is a special folder where you can store structured information in files. These files can then be accessed from any layout, post, or page using Liquid. For example, you can create a navigation.yml file and store your site’s menu items there. Then, instead of hardcoding your navigation in every layout, you can loop through the data and generate it dynamically. This approach keeps your code cleaner and centralizes your data in one place.

Which file formats does the _data folder support

Jekyll supports multiple formats inside the _data folder:

  • YAML (.yml or .yaml) – The most common choice because of its readability.
  • JSON (.json) – Useful if you already work with APIs or external data sources.
  • CSV (.csv) – Convenient for tabular data that can be exported from spreadsheets.

All three formats work seamlessly. The choice depends on your preference and the type of data you are managing.

How do you access data inside your layouts and posts

To use data from the _data folder, you first create a file such as navigation.yml:

main:
  - title: "Home"
    url: "/"
  - title: "About"
    url: "/about"
  - title: "Blog"
    url: "/blog"

You can then access it in a layout like this:

{% raw %}{% for item in site.data.navigation.main %}
  <a href="{{ item.url }}">{{ item.title }}</a>
{% endfor %}{% endraw %}

This simple loop will automatically generate your navigation menu. If you add or remove links from navigation.yml, the changes will appear everywhere without touching your layouts.

What are some practical use cases for _data

Here are several scenarios where _data becomes extremely useful:

  • Navigation menus – Store menu items in one file and reuse them across layouts.
  • Team members – Keep a structured list of staff with names, roles, and photos.
  • Product catalogs – Manage product details without editing multiple posts.
  • FAQ sections – Store question-answer pairs for easy reuse across the site.
  • Translations – Use language-specific data files for multilingual sites.

These examples show how _data saves time and ensures consistency.

How can you organize and maintain large data files

When working with large projects, it is best to split your data into multiple files or subfolders. For instance, if you have many products, you can create a products subfolder inside _data and store individual files per category. This makes your data more manageable and avoids having one giant file that is hard to navigate. Additionally, keep your data consistent by using the same keys across items.

What mistakes should you avoid when using _data

Some common pitfalls include:

  • Incorrect indentation in YAML files, which leads to parsing errors.
  • Forgetting that keys are case-sensitive in JSON or YAML.
  • Overloading a single file with too much unrelated data instead of splitting it logically.
  • Using file extensions incorrectly (.yaml vs .yml both work, but consistency is key).

Paying attention to formatting and structure saves debugging time later.

Does structured content help with SEO

While the _data folder itself does not directly impact SEO, it makes it easier to maintain consistent site structures, navigation, and metadata. This indirectly benefits SEO by ensuring that search engines can crawl your site smoothly and that no sections are left outdated. For example, a consistently updated navigation makes it easier for crawlers to discover new pages. Similarly, structured FAQ sections can be paired with schema markup for better search visibility.

How can _data help scale large GitHub Pages sites

As your site grows, managing everything in layouts and posts becomes chaotic. By separating your content into _data files, you reduce duplication and centralize updates. For instance, a site with hundreds of blog posts can use a single data file to manage categories or authors. Updating one data file propagates across the site instantly, making it scalable without extra effort.

Final Thoughts

The _data folder is one of Jekyll’s hidden gems. It bridges the gap between static sites and dynamic functionality by allowing you to store and reuse structured content. Whether you are building a blog, a company site, or a documentation hub, mastering the _data directory gives you cleaner templates, faster updates, and a more professional workflow. Once you understand its potential, you will likely find yourself using it in almost every project.

What Should You Do Next

Start by creating a simple YAML file inside _data, perhaps for your site navigation. Replace your hardcoded menu in the layout with a loop through site.data. Once you see how easy it is to update, experiment with more complex data like team members or FAQs. From there, you will be ready to move into collections, which take Jekyll’s content management to the next level.