3
votes

I've inherited a process that converts markdown content into html using jekyll.

If I remove the yaml front matter between ---, by client request to simplify the process for editors,

---
product: Product Name
capability: testing
infotype: Overview
audience:

---

# Testing file 2

This is another testing file.

The jekyll build doesn't convert the file.

# Testing file 2

This is another testing file.

When I have the front matter in the testing 2 file I see the following in the log when running build --verbose

Rendering: user-administration/testing-file-2.md
Pre-Render Hooks: user-administration/testing-file-2.md
Rendering Markup: user-administration/testing-file-2.md
Rendering Layout: user-administration/testing-file-2.md

but without the front matter there is no message in the log related to testing-file-2.md

This testing-file-2.md is part of a collection of other files that have metadata. They are render into an html website but not the testing-file-2.md when the metadata is removed.

Is there a way for jekyll to build and render files without front matter?

2

2 Answers

4
votes

Jekyll does not ignore any files. Rather, for each file, it decides whether the file is:

  • a static file, which can be copied as-is to the output folder (_site), or
  • a file to be processed first.

Markdown files (.md) are processed by kramdown and Liquid if they start with YAML frontmatter:

---
---

otherwise they are treated as static files, and copied to _site with no processing.

There is a workaround that might work for you using include_relative; but it may cause more trouble for your client's editors than it's worth, depending how they work.

You can include a static file inside a file to be processed. Your static file might be plain-text.md:

# Static text file

This is a file with no YAML frontmatter.

Then, separately, you create a markdown file with frontmatter that will include the plain-text file inside it. Say, processed-text.md:

---
---
{% include_relative plaintext.md %}

Then your plain text will be processed and appear on your site as /processed-text. Think of the file processed-text.md as a kind of template for holding plain-text.md.

You'll want to see the docs on include_relative, especially the fact that the file to be included can't be above the including file in the file system.

1
votes

I've read that it's a requirement to have at minimum at empty front matter or jekyll will ignore the file

---
---