If you're on version 0.0.2 of the gem, there is a bug in deleting comments leading to deleting of the post. Please run bundle update personal_blog
to be on the version in which this issue is fixed (0.0.3)
PersonalBlog adds a responsive single-user blog to any Ruby on Rails application. It supports markdown and provides syntax highlighting with a clean, minimalistic design. It is a Ruby on Rails engine that is completely customizable, i.e, you can add CSS and JS to style the blog any way you want. It does not require a user model and is thus, very lightweight. Admin access to create, edit and delete posts is provided through an environment variable to check the password.
To see a live example of this gem being used, you can view my blog.
- Install this gem,
- Add
gem 'personal_blog'
to yourGemfile
and runbundle
. - You can also do
gem install personal_blog
.
- In your
config/routes.rb
, addmount PersonalBlog::Engine => "/blog"
- assuming you'd like it to be available like website.com/blog or localhost:3000/blog in development. - Run
bin/rake personal_blog:install:migrations
. This will copy all the migrations from the engine into your app. - Run
bin/rake db:migrate
. - You also need to set an environment variable called 'blog_password'. This is needed for letting only you have admin access to create, edit and delete blog posts.
- For local testing, you can do
export blog_password=<your_password>
in your~/.bash_profile
for bash and~/.zshrc
for zsh. Don't forget to dosource ~/.bash_profile
orsource ~/.zshrc
after this. - For heroku, you can do
heroku config:set blog_password=<your_password>
. This guide explains how environment variables work in heroku. - For nginx, add
env blog_password=<your_password>;
to your nginx.conf file. This goes outside of thehttp
andserver
blocks. If you're not sure where your file is, dosudo find / -name "nginx.conf"
. - For apache, have a look at the SetEnv directive.
If you're confused about how to use this gem, feel free to send me a tweet!
All the styles and javascripts can be easily overridden by adding files with the same name and at the same location as the engine. For example, if you'd like to override the CSS for posts create a file app/assets/stylesheets/personal_blog/posts.css
in your Rails app and add the necessary styles there. Similarly all the styles and javascripts, by overridding the files here.
Have a look at todo.md for a general idea. Improvements on front-end would be great. Also, I'd love it if someone would start writing some tests the application. Contact me at [email protected] if you're confused about how to contribute.
Basic instructions
- Fork it and then do
git clone https://github.com/<your_username>/personal-blog-gem
in your terminal to have it locally. - Make your changes in the local branch, commit and push to your fork.
- Go to github.com/your_username/personal-blog-gem and click the
Make Pull Request
button. - Add a helpful description about your changes and you're done. I'll have a look ASAP (ETA: 1 day).