Building Jekyll-Pagination-v2 locally, push to GitHub

Hi, bundle exec jekyll serve is working. In the local build, I can see the files in my posts folder. The theme I am using–Phantom by Jami Gibbs–has employed the use of jekyll-pagination-v2. I understand that is probably because jekyll-pagination-v2 is not supported by github. I am determined to get my website working(link to repo: https://github.com/Sebastian-O-Rodriguez/Sebastian-O-Rodriguez.github.io).

This is my local website, showing a post.

Please check the link to my site to see how it looks through github sebastian-o-rodriguez.github.io
I am unsure if changing to pagination supported by github or using a local build and sending it to github-pages. If I were to do either option, I have no idea where to start. I have tried the former and cannot get jekyll-pagination to work. On the other hand, I have no experience in building and pushing built files to the repo.

I could really use some advice of what the next step for me is, and possibly a reference to get going. Thanks in advance!

Howdy Sebastian and welcome to the Jekyll forums.

As you’ve learned, you can’t use jekyll-paginate-v2 with Github Pages. You didn’t say in your post if you need the functionality of that plugin or if you could use the supported jekyll-paginate. If you can get by without jekyll-paginate-v2, that would be the easier option. All you’ll need to do is update your config file per the docs.

If you wish to keep the jekyll-paginate-v2 plugin, you’ll need to setup a local development environment. I’ve got a script in my dotfiles that you can reference for getting the built files published on your gh-pages branch.

On an unrelated note, you should get a .gitignore file set-up with at least the following:

_site
*-cache/
*.DS_Store

None of those files are needed in the repo.

Hey brad,

thanks for the welcome! After looking more into the matter, I do need jekyll-paginate-v2 after all. Your linked dotfile seems really useful, but I have some questions implementing it. As of now, I have updateed my .gitignore and added ghpages-deploy.sh to the master folder. How do I use this script to deploy a static build of the website (where non-whitelisted plugins will work)?

As a side note, I have also tried to use this to build my site and deploy it, to little avail.

Before you start, a disclaimer: I’ve never tested that deploy script on a Mac. For all I know it’ll burn your system to the ground. Now, with that out of the way…

You’ll probably want to move that script to your ~/bin directory so you can use it for more than just this project. Regardless, you’ll need to make it executable: chmod +x ghpages-deploy.sh. Before you run the script, you’ll need to make sure you have a gh-pages branch ( git branch gh-pages). After that you should be able to run ghpages-deploy.sh or ./ghpages-deploy.sh.

I have access to an ubuntu 16.04 machine. Would it be more powerful to switch over for a project like this?

I don’t think computing power is an issue is it? As far as compatibility, I’ve built Jekyll sites on Windows and Linux and worked with people who have built them on Mac. Your operating system shouldn’t matter. If you are getting errors, publish them here and we’ll try to work through them.

Well noted. I went ahead with the steps you instructed for mac, and ghpages-deploy.sh and ended with the following message.

I am unfamiliar with bash scripts like this, so I don’t if this worked as intended, how to fix if not, etc.

Is it imporant to go into settings and make gh-pages the source for the website or something of that sort?

It looks like everything worked except the files didn’t get pushed to Github. You created the branch locally but didn’t tell Github about it. Switch to your gh-pages branch (git checkout gh-pages). Type the code it shows there (git push --set-upstream origin gh-pages). Don’t forget to switch back to your master branch before making updates to the site.

Okay. I did the following:

git checkout gh-pages
git push --set-upstream origin gh-pages
git checkout master
ghpages-deploy.sh

and got this:

I think this means everything worked for the most part, but the website is still not showing the posts like it does when i had run bundle exec jekyll serve --watch before.

It’s not publishing to your gh-pages branch on GitHub. So let’s go through the deploy step-by-step.

  1. Switch to your gh-pages branch.
  2. Open your project directory in Finder and delete everything (including hidden files) execpt your .git directory. (Note, you can do this via the terminal but you can also burn everything to the ground in a hurry …so, Finder is probably best.)
  3. Switch back to the master branch.
  4. Remove temp directory from the previous build: rm -rf $HOME/.tmp/jekyll
  5. Recreate the temp directory to hold the build output: mkdir -p $HOME/.tmp/jekyll
  6. Build Jekyll and output to temp directory: JEKYLL_ENV=production jekyll build --destination $HOME/.tmp/jekyll
  7. Switch back to the gh-pages branch.
  8. Copy files from temp directory: cp -r $HOME/.tmp/jekyll/. .
  9. Add files to index and commit: git add . && git commit -m "Deploy changes"
  10. Push files to origin: git push

Brad,

I have done the exactly as you described, and I think it all went accordingly.

I believe that the necessary files were pushed to the gh-pages branch, but the website still hasn’t changed. it doesn’t seem to be (in my novice view) to be a problem with with the deploy script, but something else. What other steps could I take to fix the cause of this issue?

It looks like you’re pushing to the wrong place. In your first post you said we were working in the Sebastian-O-Rodriguez.github.io repository. In the screenshot you’ve added, you are pushing these built files to sebastianglobal.github.io.

You’ll need to change your upstream if this is the project you want to push to Sebastian-O-Rodriguez.github.io or cd into the correct project directory.

I am currently at a loss. Not that it should matter, but I have been using github desktop to switch from gh-pages to master, and vice versa. Another concern I have is, I tried to use octopress to build locally before you responded to my post, and had added a source branch, I deleted it using set branch -d source. I don’t know if this will affect things. After, I did the following from sebastian-o-rodriguez directory:

  1. Switch to your gh-pages branch.

git push --set-upstream origin gh-pages (just to make sure i did this in this correct directory)

  1. Open your project directory in Finder and delete everything (including hidden files) execpt your .git directory. (Note, you can do this via the terminal but you can also burn everything to the ground in a hurry …so, Finder is probably best.)
  2. Switch back to the master branch.
  3. Remove temp directory from the previous build: rm -rf $HOME/.tmp/jekyll
  4. Recreate the temp directory to hold the build output: mkdir -p $HOME/.tmp/jekyll
  5. Build Jekyll and output to temp directory: JEKYLL_ENV=production jekyll build --destination $HOME/.tmp/jekyll
  6. Switch back to the gh-pages branch.
  7. Copy files from temp directory: cp -r $HOME/.tmp/jekyll/. .
  8. Add files to index and commit: git add . && git commit -m "Deploy changes"
  9. Push files to origin: git push

here is my final output this time.

repo

here

i did not use sebastianglobal repo this time! However, I still have not gotten things to work. trying my best not to pull my hair out.

Looking at the gh-pages branch on GitHub it looks like everything worked. My guess now is your settings. Scroll down to GitHub Pages and check that your source branch set to gh-pages.

Brad,

I compelled to let you know how grateful I am for all your help. It’s truly been a pleasure, and a great learning experience it has been.

In terms of source branch set to gh-pages I find myself in a bit of a pickle. I created sebastian-o-rodriguez.github.io as a USER site instead of a project site. From what I understand, this means i either have to morph the workflow of this site so that gh-pages merges into the master, or (I guess) create a github pages as a PROJECT site in order to do this.

For further reference, this is what my “set source” looks like

Which option do you think would be best in this situation? If I were to create a workaround for this user site, how would I do so?

Brad,

long story short, your ghpages-deploy.sh is really amazing. Something clicked today and I have everything working (well, the deploy process works lol). I easily use ghpages-deploy.sh to update my launched site, and am now working through aesthetic bugs much more easily. Thanks again man.

-sebastian

I’m glad things are making more sense for the local build/deploy script.

As for the project vs user issue, that’s more of a personal preference. My Bradonomics repo is setup to publish with a custom domain from my user account. Building my personal site at the root doesn’t preclude me from building project sites. See my SimpleSheets Shopping Cart for example. I have helped others setup orginizational accounts to host sites on Pages. It’s all up to your work flow.

Brad,

I have decided that sebastian-o-rodriguez.github.io/about is just way too long, so I now have ownership over sebrod.com. According to documentation from github, I have gone to the settings and added ‘sebrod.com’ as a custom domain and saved it. On the website i bought from, namecheap.com, I added the following:
for TYPE, HOST, VALUE respectively
CNAME record , www , sebastian-o-rodriguez.github.io

I set the four A record , @ , and each ip address to the namecheap website as well.

I am not sure what steps I will need to take. As a reminder, the repository currently hosting my site is ‘about’. If I go to www.sebrod.com things are looking really messed up. Also, I added a CNAME file including “www.sebrod.com” to my repository.

What’s in your _config.yml for url:? My best guess is, you didn’t update that to point to the new domain.

Yeah, I just changed

url: www.sebrod.com
I also changed the repository to www.sebrod.com but i don’t know if i should have done this.

edit: I got it to work. You were spot on, as usual. Thanks!