greystash
greystash

Reputation: 337

Can you change the root directory in jekyll

I've been trying to change the root directory of my Jekyll site to another folder but I can't seem to find a way to do this and was wondering if it's possible?

What I want is for all of my html pages to be in a folder named _pages, and for my website to load index.html from this folder. Currently I can only get this working by changing the baseurl and accessing the website by www.domain.com/pages/index.html. Can I have it so the html files remain in this folder, and have jekyll render the site so that I can access index.html from www.domain.com/?

Thank you

Upvotes: 2

Views: 2165

Answers (1)

Brad West
Brad West

Reputation: 969

In your _config.yml file you'll need to include the directory where your HTML pages live like this:

include: [_pages]

In your _pages/index.html file include a permalink in the frontmatter like this:

---
permalink: /
---

Run your Jekyll build command again. If I understand your question correctly, this will output your homepage without needing to have or adjust your baseurl.

Upvotes: 4

Related Questions