Why is my Jekyll blog not on my Github page? - github

http://leongaban.github.io/leongaban-10/ (<- displaying the default github page theme)
Here is my repo with a jekyll blog that works 100% locally, I did create the gh-pages branch. Below is a screenshot of what the blog should look like on my github page:
Do I need to change anything here in my _config.yml?
Site settings
title: Leon Gaban
email: leongaban#gmail.com
description: "Leon Gaban"# this means to ignore newlines until "baseurl:"
baseurl: "" # the subpath of your site, e.g. /blog
url: "http://leongaban.com" # the base hostname & protocol for your site
twitter_username: leongaban
github_username: leongaban
# Build settings
markdown: kramdown

The name of your repository must end in github.com/github.io i.e. rename your https://github.com/leongaban/leongaban-10/ repo to: https://github.com/leongaban/leongaban.github.io

Add this to your _config.yml:
kramdown:
input: GFM
in order to keep the same markdown GitHub will use.
Also, if it is your user website username.github.io it's better move it to a master branch. gh-pages branch is supposed to be applied to project websites only.
Your _site folder is not supposed to be there. It contains the site already build. Normally it's useful for local preview and when you're hosting with a service that doesn't build Jekyll automatically, like an Apache server. Also when you use Jekyll plugins that are not allowed by GitHub, so you choose building the site locally and uploading the static site only to GH.
I see two approaches: weather you remove the _site folder and move your project to the master branch, or you remove the rest of the content and upload to your repo only the content of the _site folder (not the folder itself).
Hope to have helped!

Related

How to publish docusaurus website at username.github.io

I have been learning how to use Docusaurus to make markdown documentation websites recently.
My exact questions are:
How do I have to name the repository
What do I have to change in this config: https://i.stack.imgur.com/4WAhY.png
What branch do I need for what?
My goal is to create a site at ruixey.github.io, not at ruixey.github.io/REPO_NAME/
Thanks in advance for any help
Docusaurus side
Everything I can see looks correct according to the documentation Docusaurus provides:
Deploying to GitHub Pages | Docusaurus.
It states the following about which branch is used:
GitHub Pages picks up files from the default branch (master/main) or the gh-pages branch ...
and for deploying to the GH Page:
We provide a docusaurus deploy command
GitHub Pages side
Regarding your repository name, I recommend you to read the documentation that GitHub provides on Pages, which goes over the naming conventions when setting up a self-titled GitHub Pages deployment: Creating a GitHub Pages site
These docs say the following about choosing a repository name:
If you're creating a user site, your repository must be named <user>.github.io ...
If your user name contains uppercase letters, you must lowercase
the letters.
Source: Creating a repository for your site
Have you tried to deploy with your current configuration file? I don't see a reason why it should fail.
What do I have to change in this config
Assuming your repo URI is something like: git#github.com:Ruixey/roblox.git
organizationName: 'Ruixey', // Usually your GitHub org/user name.
projectName: 'roblox', // Usually your repo name.
// git#github.com:Ruixey/roblox.git <-- your ssh URI
// ^ ^
// organizationName projectName
What branch do I need for what?
main for your source, when you deploy, docusaurus will push to gh-pages branch, if the branch does not exist, this creates it.
$ USE_SSH=true yarn deploy

why everytime readme file is being published?

I am struggling to figure out why the only thing I see on github page is the read me file.
I followed the instructions to publish to a github page here :
https://abhiverma04.github.io/dummycv/
my repo
https://github.com/abhiverma04/dummycv
Looks like readme.md takes priority over index.html.
You can either make orphan gh-page branch and put all your files (except readme.md) to this branch. Or create /docs folder and copy all your files to the /docs folder except of readme.md. And after this action enable the relevant sourcesetting in GitHub pages as it is described in the GitHub documentation

How to use node_modules on Github Pages, without uploading to repo

I'm hosting a site on Github pages, and using Jekyll to generate it.
I added Angular and Lodash to my project using npm, but didn't want to upload 200 odd files to GitHub so I added node_modules to my .gitignore file and just made sure they were added as dependencies within package.json. The problem then becomes that GitHub pages/Jekyll doesn't auto-install the packages when it (Jekyll) generates.
So my question is, how can I use NPM on GitHub pages without actually uploading my node_modules folder into my GitHub repository?
You have two options:
build your site locally
Just generate your static files locally and then upload the final website to Github pages (Github can host non Jekyll websites)
use CI
Implement a script that after uploading your files to the master branch (in Travies for example), it builds your site and push the changes to the gp-pages branch.
According to the GitHub, you can add a _config.yml file to tell Jekyll to "include" the "node_modules" and "vendors" directories.
See:
https://help.github.com/en/articles/configuring-jekyll

Can Jekyll use a config file from a different repo

I'm using Jekyll and GitHub Pages to create documentation for projects that live in separate repos that are part of an organization account in GitHub. My team has decided it makes the most sense for the docs to live in each repo alongside the code, so we'll be using a gh-pages branch in each repo.
I will also be setting up a separate gh-pages repo from the organization account to serve as a landing page. I'd like to have all of my jekyll config items live in this repo. What do I need to put in the config file in each of the repos to successfully pull all of the layouts, css/scss, etc. from this central location? Is this even possible?
Here's a visual representation
In a nutshell, I'm trying to have one place where I can make changes to the website formatting files instead of 6.
On Github pages, you can use resources from another repository by using git submodules.
This works well for _layouts and _sass, but sadly not for _includes. This due to the fact that, in Jekyll 2.x, you cannot configure _includes folder path. This has been committed in the current master and will be available as soon as Jekyll 3 is out and used by github pages.
Edit: With Jekyll 3, you can now configure includes_dir: _mydir. See documentation for Jekyll configuration.
An interim solution can be to merge includes in layouts until you're able to configure _includes path. Not so clean, but, as your templates a centralized, it will be easy to refactor.
Howto
1 - create a resources repository
Adding your organization repository as a submodule will pull both resources, post and pages. Not a good way to go because posts and pages will be present in your project blogs.
The better way is to hosts your resources (_includes, _layouts, _sass, css) in a dedicated repository at github.com/userName/resources.
In your _layouts/default.html, dont forget to call you css with :
<link rel="stylesheet" href="{{ "/resources/css/main.css" | prepend: site.baseurl }}">
2 - Project blog Setup
Create a project blog without resources files and add the resources submodule.
git submodule add https://github.com/userName/resources.git
This creates a resources folder in you repository.
Edit your _config.yml and add:
layouts: /resources/_layouts
sass:
sass_dir: /resources/_sass
You can now jekyll serve, it works.
3 - Resources workflow
As your resources are in a submodule, changes in a template or sass file will not be reflected in your blog automatically.
In order to refresh your blog you will have to do this for all your blogs.
git submodule update --remote
git commit -a -m 'resources update'
git push origin gh-pages
After getting feedback from my team, I ended up doing the following:
create new repo that will be the source of the GH-Pages site
add the individual project repos as submodules of this repo
add a script that tells jekyll to pull content from specific folders in the submodules and place them in a temp dir, then use that temp dir as the build source
#remove docs-build-temp folder if it exists
rm -rf ./docs-build-temp
#make temp-content folder
mkdir ./docs-build-temp
#copy content from doc folder in submodules into temp-content folder
cp -R ./submodule1/doc ./docs-build-temp/newdir1
cp -R ./submodule2/doc ./docs-build-temp/newdir2
#tell jekyll the content source
bundle exec jekyll build -s ./docs-build-temp
The script works when run locally and in Travis CI*.
*I set up ssh authentication between my user acct in github and each of the repos in travis to get around the fact that all of them are private. Seems to be working out ok so far.

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.