How to use jekyll on an existing blog made with rails - ruby-on-rails

My situation is that I have just finished creating a blog using ruby on rails. I have been using localhost to see it display on my browser, but I want to deploy it online. I found out that rails apps can't be deployed on ghpages because it is not static. However, I searched online and read that if I used Jekyll, i could display it on ghpages. I have never used jekyll before, so my question is...
How could I use/integrate jekyll to my existing rails app so that it can be deployed and hosted through github pages?
Thank you!

You are trying to screw in a screw with a hammer.
Github pages is simple free hosting for static pages like a simple portfolio or the info page for a github project. You would use jekyll to generate simple static HTML pages for this.
If you want to deploy a Rails application there are several cloud hosting providers such as Heroku and Openshift that provide a free tier.
First determine what you are trying to build. Then select the right tool and hosting for the job.

You CANNOT host a rails blog app with databases on gh pages. you need a static site to be hosted on ghpages. jekyll is a static site generator that generates static HTML pages which can be served to users from gh-pages.
So you need to build new blog engine with jekyll
install jekyll: gem install jekyll
create new jekyll site: jekyll new your-github-username.github.io
cd to the new directory generated and test locally: jekyll serve (visit http://localhost:4000)
link to github articles on gh-pages with jekyll

Related

Ruby on Rails Project Hosted on GitHub

I'm trying to figure out how to display the home page of my ruby on rails hello world project. It's currently live but I'm getting the README.md file contents instead of the Hello World message, which, is in the application_controller.rb file a few directories in from the root. The README.md file that's showing is at the root. live project
You can only host a static website with Github pages.
If you want to deploy your rails app I suggest to use the Heroku free plan.
Read this if you want to understand the difference between static and dynamic websites.

How to deploy a middleman blog inside a rails app?

I have a rails app. I want to make a blog for it with middleman and in subdirectory. For example www.myapp.com/blog .
How can I do that?
MiddleMan's output is a static HTML/JS/CSS website. Just place the output of your MiddleMan project in the public/blog directory within your Rails app.

Getting a Rails App to Work with Git Pages to Create a Personal Blog

I created a git page -> https://github.com/username/username.github.io.git
I then created a workspace in Cloud9-IDE and cloned https://github.com/username/username.github.io.git
Then I installed Rails from the terminal gem install rails -v 5.0.1
and create a new Rails app rails _5.0.1_ new blog, I created a 'Hello World' home page and confirmed that it was working locally with Rails Server.
I then committed the changes and pushed successfully to GitHub, the commits are visible in the repo.
git add -A
git commit -m "message"
git push
However, when visiting https://username.github.io I do not see anything other than username.github.io from the README at the top of the page.
I'm afraid not. Rails is a dynamic system, meaning that the pages are generated from templates combined with data. Github Pages only servers static HTML, so even if you put static content into Rails, you would not be able to run the scripts that serve it.
If you really need Rails, use Heroku free plan.

Liquid error when trying to embed twitter feed on GitHub Jekyll page using plugin

I am trying to embed my twitter timeline on my Jekyll Blog hosted on Github.
This is the plugin I am trying to install: https://github.com/rob-murray/jekyll-twitter-plugin
These are instructions I am using to install plugins in general: https://jekyllrb.com/docs/plugins/
The site above includes the warning:
Plugins on GitHub Pages
GitHub Pages is powered by Jekyll. However, all Pages sites are generated using the --safe option to disable custom plugins for security reasons. Unfortunately, this means your plugins won’t work if you’re deploying to GitHub Pages.
You can still use GitHub Pages to publish your site, but you’ll need to convert the site locally and push the generated static files to your GitHub repository instead of the Jekyll source files."
Does this mean what I am trying to do is impossible, without building the site statically, since I am using Github pages? I am lead to believe not, because I encounter an error even when serving the site locally on my laptop.
However, I get the following error when I place the example {% twitter https://twitter.com/jekyllrb maxwidth=500 limit=5 %} into my index.md file. When I do jekyll serve --watch locally, it gives the error:
Liquid Exception: Liquid syntax error (line 7): Unknown tag 'twitter' in index.md
I do not know if the error is in my installing of the jekyll-twitter-plugin, or in the way I am using. For reference, to install the plug I did the following:
put jekyll-twitter-plugin in my _config.yml file under the gems: header
put gem 'jekyll-twitter-plugin' into my Gemfile
did sudo gem install jekyll-twitter-plugin locally on my own machine.
Can anyone help me figure out what I've done wrong?
That plugin is not supported by Github Pages, so it won't work there. The only possibility to use it is to build your site locally before pushing your site to Github Pages.
If you want to install it locally anyway, after adding the gem to Gemfile, Install the gems specified in that Gemfile:
bundle install
Then continue using the plugin tags in your posts.

How to set crowdsourcing platform in rails application

I am new as rails developer. I have crowdsourcing platform code which is on code for crowd sourcing platform
And want to put this on my rails application domain. From where I have to start and what I have to do for complete this task?
Thanks for reply in advance.
The crowdsourcing platform you mention - Selfstarter - is a rails app itself.
Here's what you need to get started:
Pull the code down to your computer from the github repo with the following command:
git clone https://github.com/lockitron/selfstarter.git
change directory into the cloned repo directory:
cd selfstarter
Create the database and the tables with the following command:
bundle install --without production
Start the rails server:
rails server
Access the client from the url http://localhost:3000
You will have the bare bones selfstarter app as shown in the image below:
All this is explained in the README of the selfstarter github repo.
To be able to understand how this was done, and to be able to customize the app for your specific needs, it would help if you learn the basics of Ruby on Rails. I would strongly recommend the freely available online Ruby on Rails Tutorial

Resources