Jonathan DEKHTIAR
Jonathan DEKHTIAR

Reputation: 3536

Jekyll - How to use a markdown file in a parent folder

I have a github repository with a Github Page website activated structured as followed:

/
|__README.md
|__docs/
   |__ _config.yml
   |__ stylesheets
   |__ javascripts
   |__ images
   |__ index.md

The files docs/index.md and README.md are stricly identical. How could I set README.md file as the "index" file with Jekyll ? Or at least make index.md include README.md ?

I tried the following and it does not work:

# First try
{% include ../README.md %}

# Second attempt
{% include_relative ../README.md %}

For the record, I use the theme: jekyll-theme-architect

Upvotes: 3

Views: 710

Answers (2)

rlaures
rlaures

Reputation: 335

On my side, I tried in the index.markdown file to add {% include_relative README.md %} and it worked perfectly. The file has only that by the way:

---
# Feel free to add content and custom Front Matter to this file.
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults

layout: home
---
{% include_relative README.md %}

Upvotes: 1

David Zhang
David Zhang

Reputation: 468

You may set permalink by front matter in README.md to generate as index.html:

---
permalink: index.html
---

Upvotes: 1

Related Questions