Reputation: 1406
I have an existing Github pages site with content on it. I want to add Jekyll blogging functionality to this site but I don't want to get rid of the content I already have on the site. Ideally I'd like to keep my index.html file the way it is and add a subdomain for the Jekyll blog.
Here is my site as is. Here is the Githu repo for the site.
I installed Jekyll just fine, created a new blog via Jekyll/terminal, and that blog is located in the Github repo's blog folder. This folder appears to have everything needed to launch a Jekyll blog and I can view it via localhost:4000 and it diplays the Jekyll welcome screen.
My question is how do I get this Jekyll blog to work with the Github pages site I already have? All the tutorials I find online show how to start an empty Github Pages site and use Jekyll as the main page. I can't find a single tutorial on how to add Jekyll to an existing Github Pages site and get it to work.
Is this a matter of configuring a CNAME or config.yml file?
Upvotes: 0
Views: 1039
Reputation: 1
Adding to what @DC.Azndj said, you can add Jekyll as part of the subdirectory (e. g. username.github.io/blog
) adding baseurl: "/blog"
in _config.yml
.
Here is a more detailed description by Kilt and Code.
Upvotes: 0
Reputation: 53
This post helped me figure out what was wrong with my setup, and I was able to get it working.
Posting it here in case it helps anyone else: https://ellatronic.com/blog/blog/2015/12/2/setting-up-a-custom-subdomain-with-github-user-pages-and-namecheap
Upvotes: 0
Reputation: 1396
Just to make sure I'm understanding you correctly, your site is nicknyr.github.io
and you said you wanted your blog as a subdomain, (something like blog.nicknyr.github.io
).
You need to put your Jekyll blog in a separate repo from the nicknyr.github.io
repo. In the Jekyll repo, put a CNAME
file at the root directory with the contents being the name of the url you want it to have blog.nicknyr.github.io
. It's important to leave out the http(s)://
part!
Then, in your repo settings under "Options"->"GitHub Pages", set the custom domain to blog.nicknyr.github.io
.
If you meant that your blog would be a subdirectory nicknyr.github.io/blog
, I don't think that's possible without funky redirects and a custom subdomain. The repo serving the domain nicknyr.github.io
is responsible for serving all subdirectories of that domain. It's possible, but takes a lot more manual manipulation. At that point, you might be better off putting the blog in the same repo and setting the Jekyll output into a specific folder to be displayed on the frontend.
Upvotes: 0