Running Jekyll on ONLY sub-directory of custom domain through GitHub - github

I'm trying to set up a personal website (with a custom domain and hosted on GitHub Pages) that would allow me to display the following:
username.com - custom domain with my own code (not through Jekyll)
username.com/blog - sub-directory blog (through Jekyll)
I'm not sure how I should go about this. I've tried other online tutorials, but most of them deal with sub-domains (not sub-directories), use the default github.io project domain (not custom domain), or just don't work. Any help would be greatly appreciated.

I ended up solving the issue myself: I figured out that the main problem I was having was that my username.com website was hosted as a Project Site and not a User/Organization Site. The fix was to create a User/Organization Site repository called username.github.io and then apply the CNAME/DNS changes redirecting to username.com.
(A little sad though, I was using username.github.io as a testing site.)
From there, all repositories that are published to gh-pages branch would show up as sub-directories of the User/Organization Site. If CNAME/DNS was left unchanged, a repository named blog would show as username.github.io/blog; since I changed CNAME/DNS settings, the repository named blog showed up as username.com/blog.
Hope that helps anyone else going through similar issues! Good luck all!

All you need to do is have the following in your Jekyll config file:
# _config.yml
url: "https://username.com"
baseurl: "/blog"
Then ensure that you use relative_url and absolute_url filters for your link refs. For example:
{{ page.title }}
Finally generate a production _site:
bundle exec jekyll build
# or if you don't have a Gemfile
jekyll build

Related

why jekyll tag not working on github give 404 erro but it works on localhost

I use this tutorial for create tags on jekyll its work correctly on localhost when I click on a tag link it take me to the /tags/tag_name page but when I push it to the github this directory (/tags/tag_name page) give me 404 error! how can i fix this problem?
If you site lives at http://example.com/mysite, you need to set baseurl: /mysite in _config.yml, and call you pages like this :
Tag
It seems that github disables custom plugins for security reasons, thus, the .rb file that this tutorial uses will not work. There does seem to be a workaround, however, which involves compiling your Jekyll source code to the _site directory before pushing to github server. See this post

disfunctional jekyll theme for GitHub project page blog --> gh-pages

When I use a dedicated GitHub page to host this blog the theme works, see here.
However, what I want to do is create this blog as a "Project Page", i.e. a subpage of an organization, in this way.
I've been following the tutorial on how to create a gh-pages branch, provided by GitHub themselves.
In conjunction with the "Host on GitHub in 3 Minutes" tutorial from Jekyll.
I can get it up and running with the basic out-of-the-box theme, but I want to use the "twitter theme", but when I followed the command to install it, i.e. rake theme:install git="https://github.com/jekyllbootstrap/theme-twitter.git" and then pushed to the gh-pages branch, it just completely stripped away all the formatting and now there is no theme at all, see here.
Why did that happen? How can I fix it?
As usual it's a baseurl problem. In _config.yml : set
baseurl: /Description-Logicians-of-EIS
or BASE_PATH if you use Jekyll Bootstrap
If you open up the console in your browser (ctrl + J), you can see the CSS fails to load with a 404.
Failed to load resource: the server responded with a status of 404 (Not Found)
http://eis-bonn.github.io/assets/themes/twitter/css/1.4.0/bootstrap.css
That's probably a good starting point. Where are your css files stored?
Spoiler Alert!
When I visit your repository, the directory pointed to in your header is missing. Instead I find Bootstrap in an entirely different directory.

Not able to see the webpage of the github repository

I am very new to github.
I pushed my repository into github.
And in settings page, they tell my site is published at
http://jerinzam.github.io/coi-site.
But that URL gives me a 404 page.
Can someone give some xplanation on this.
And also FYI my project uses MEAN stack
Thanks in advance
You have two problems:
GitHub won't run your site. It is only for static hosting, not Node.js hosting. It also doesn't support any databases, including MongoDB.
From the project pages documentation:
The gh-pages branch is used to build and publish Project Pages sites.
You have three branches, but none of them are called gh-pages:
gh-pa
gn-pages
master
This is exactly as above.
You can host your code repo on github, but the web link to that repo will literally be whatever it is in the browser.
Now if you are wanting to run your site, then try this - https://masteringmean.com/lessons/557-Setup-and-Getting-Started-Running-Your-Site
You will need to have the mongo server running before starting the server. Check this is running by typing $mongod
so just go to the directory then type $ node run.js

Deploying jekyll for github page blog

Followed the Jekyll documentation direction and pushed the folder directly under master branch and when that didn't work, also set up the gh-pages branch and pushed just the site folder contents under it. Still didn't work.
github: https://github.com/shinshinwu/shinshinwu.github.io
my _config.yml setting:
# Site settings
title: Anna's Chunky Bacon and Sweater House
description: Programming and all other random thoughts
baseurl: /myblog/ # the subpath of your site, e.g. /blog/
url: "http://localhost:4000" # the base hostname & protocol for your site
# Build settings
markdown: kramdown
Any tips would be helpful! Thanks a ton!
The reason is that your _config.yml is not at the root, with source and destination variables set.
But, the easiest way is to create a https://github.com/shinshinwu/myblog repository and put your jekyll blog in its gh-pages branch.
The url will still be shinshinwu.github.io/myblog and you avoid mixing Jekyll and non Jekyll things.

Using Github pages with Jekyll in a subdirectory

I recently wanted to publish my Jekyll site on Github pages, but it seems that putting everything in a subdirectory is giving some issues, even after I change the source to the correct directory.
My structure looks like this:
- site
- src (contains all Jekyll stuff)
- README.md
- GruntFile.js
- ...
Locally my site builds perfectly and when I go to http://localhost:4040 I can see it just nicely, but when I commit this to my Github and visit username.github.io I get a 404, if I go to username.github.io/src I can see part of my site, however all {% include %} are ignored.
In my _config.yml I updated the source: source: ./src, but that doesn't seem to help.
Is there a way to make Github Pages handle subdirectories properly? Basically I want to tell it that my Jekyll site is inside /src, and I want the url to just be username.github.io instead of username.github.io/src
I know i can use the pages branch and commit to there, but I would prefer if it could happen automaticly.
If it helps anyone, I attempted to run Jekyll on GH Pages from a subdir (and modified source) and was banging my head against the wall over these errors:
A file was included in subdir/index.html that is a symlink or does not exist in your _includes directory. For more information, see https://help.github.com/articles/page-build-failed-file-is-a-symlink.
After much searching on this, the definitive answer was right there in the docs:
Configuration Overrides
We override the following _config.yml values, which you are unable to
configure:
safe: true
lsi: false
source: your top-level directory
Keep in mind that if you change the source setting, your pages may not
build correctly. GitHub Pages only considers source files in the
top-level directory of a repository.
I contact Github support and they gave me 2 solutions.
Move all my Jekyll source files to my top-lever directory.
Use a different branch and update it manually each time.