{"id":19316726,"url":"https://github.com/maxim/blogue","last_synced_at":"2025-04-22T17:30:26.108Z","repository":{"id":11313991,"uuid":"13733208","full_name":"maxim/blogue","owner":"maxim","description":"If it wasn't in BLOGUE, it wasn't in blogue","archived":false,"fork":false,"pushed_at":"2018-08-04T06:59:23.000Z","size":57,"stargazers_count":7,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T01:46:18.592Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-21T04:48:31.000Z","updated_at":"2018-08-04T06:59:25.000Z","dependencies_parsed_at":"2022-09-13T08:01:53.282Z","dependency_job_id":null,"html_url":"https://github.com/maxim/blogue","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxim%2Fblogue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxim%2Fblogue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxim%2Fblogue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxim%2Fblogue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxim","download_url":"https://codeload.github.com/maxim/blogue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250287337,"owners_count":21405588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T01:12:24.944Z","updated_at":"2025-04-22T17:30:25.790Z","avatar_url":"https://github.com/maxim.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blogue\n\n[![Build Status](https://api.travis-ci.org/maxim/blogue.png)](https://travis-ci.org/maxim/blogue)\n\nBlogue is a rails model for static blog posts, wrapped in an engine. It means that you can have blog posts as static files (kind of like views) inside your rails app, and hook up posts like any other resource. The only reason this is an engine and not just a class in a gem is because it also adds an asset path and a handler for .md views.\n\nCheck out my blogue article for some fun stuff it can do: [http://hakunin.com/blogue](http://hakunin.com/blogue)\n\n## What you get\n\n* A `Blogue::Post` model\n* Handler for \".md\" views ([kramdown](https://github.com/gettalong/kramdown/) by default)\n* Syntax highlighting for code blocks ([rouge](https://github.com/jneen/rouge) by default)\n\n## What you don't get\n\n* Mountable endpoint\n* Default controllers\n* Default views\n* Generators\n* Comments, tags or pretty much any functionality\n\nThere are thousands of gems that you can pick from to do that stuff.\n\n## Usage\n\n1. Generate a rails app (or use existing)\n2. Add all needed gems to Gemfile and bundle\n  ~~~ruby\n    gem 'kramdown'\n    gem 'rouge', '~\u003e 1.11.1' # 2.x and newer is not supported yet\n    gem 'blogue'\n  ~~~\n\n3. Create a model `app/models/post.rb` (the name 'Post' is chosen at random)\n  ~~~ruby\n    class Post \u003c Blogue::Post\n      # Here you can override inherited methods any way you like.\n      # See app/models/blogue/post.rb to see what you have\n    end\n  ~~~\n\n4. Create a controller `app/controllers/posts_controller.rb`\n  ~~~ruby\n    class PostsController \u003c ApplicationController\n      def index\n        @posts = Post.all\n      end\n\n      def show\n        @post = Post.find(params[:id]) ||\n          raise(ActionController::RoutingError.new('Not Found'))\n      end\n    end\n  ~~~\n\n5. Add a route to your `config/routes.rb` like this\n  ~~~ruby\n    root to: 'posts#index' # if you want an index page\n    get '/:id', to: 'posts#show'\n  ~~~\n\n6. Add `app/views/posts/index.html.erb` for your index page\n  ~~~erb\n    \u003c% @posts.each do |post| %\u003e\n    \u003cp\u003e\n      \u003c%= link_to post.title, post.id %\u003e\n\n      \u003c% if post.tldr %\u003e\n      \u003cblockquote\u003e\n        \u003c%= post.tldr %\u003e\n      \u003c/blockquote\u003e\n      \u003c% end %\u003e\n    \u003c/p\u003e\n    \u003c% end %\u003e\n  ~~~\n\n7. Add `app/views/posts/show.html.erb` for your post page\n  ~~~erb\n    \u003c%= link_to 'index', root_path %\u003e\n\n    \u003c%=raw render file: @post.path %\u003e\n\n    \u003c% if @post.date %\u003e\n    \u003cp\u003ePublished on \u003c%= @post.date.to_s(:long) %\u003e\u003c/p\u003e\n    \u003c% end %\u003e\n  ~~~\n\n8. Create a directory `app/posts` (that's default location of posts)\n9. Create a directory `app/posts/assets` (it's added to assets paths by default)\n10. Add a post like `app/posts/my-first-post.md`\n\n        # Yay my first post\n\n        This is some text.\n\n        ![picture](/assets/picture.jpg)\n\n        ~~~ruby\n        foo = 'foo' # a codeblock\n        ~~~\n\n        \u003c!--meta\n          date: 2013-10-21\n          tldr: Awesome\n        --\u003e\n\n11. Start server and go to http://localhost:3000/my-first-post\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxim%2Fblogue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxim%2Fblogue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxim%2Fblogue/lists"}