meddle0x53 / blogit

OTP application for generating blog posts from a Git repository containing markdown files.
MIT License
41 stars 7 forks source link

Blogit

Blogit is a blog engine back-end written in Elixir. It turns a repository (by default git repository), containing markdown files into streams of blog posts, which can be queried. Blogit supports blog configuration in YAML, including blog title, path to custom styles and images, etc.

There is a front-end implementation in Phoenix, which uses Blogit - BlogitWeb. It can be forked and configured to use any repository to build custom blog.

The blog for the Sofia University Elixir course runs on Blogit.

Installation

It is available in Hex, so the package can be installed:

  1. Add blogit to your list of dependencies in mix.exs:

      def deps do
        [{:blogit, "~> 1.2"}]
      end
  2. Ensure blogit is started before your application:

      def application do
        [applications: [:blogit]]
      end

Configuration

An example configuration for blogit is:

config :blogit,
  repository_url: "https://github.com/ElixirCourse/blog.git",
  polling: true, poll_interval: 300, languages: ~w(en bg de)

Possible settings are:

Using these settings a custom blog can be created from whatever repository. It is not hard to write FTP repository provider or Ecto repository provider.

Usage

Blogit has a public interface which can be used to build a blog similar to BlogitWeb. When the application is configured and started, the following functions can be called:

License

The license is standard MIT license, feel free to fork Blogit and do whatever you want with it. You can also contribute to it.

Contributions

Just fork the Blogit repository and create a PR. You can also create issues with features you wish we support. You can propose style changes on the code and additional tests.

All kinds of contributions are welcome!

How to create your own blog?

Blogit has a simple Phoenix front-end application : BlogitWeb.

Follow these steps to create your own blog (read more at BlogitWeb's README):

  1. Fork BlogitWeb project.

  2. Modify its config/prod.exs configuration:

      config :blogit,
        repository_url: "<path-to-a-git-repository-with-your-posts>",
        polling: true, poll_interval: 300
  3. Recompile the dependencies, so the configuration is updated:

      mix deps.get
      mix deps.clean
      mix deps.compile
  4. Deploy it somewhere.

    BlogitWeb depends on distillery and has a little bash script in its root, called build_release.sh. Just run it and it will build a release. You can also run it like this : ./build_release.sh --upgrade in order to create updated release. Follow distillery's notes when deploying.'

    BlogitWeb has a Dockerfile.build file which can be used to make a build in Docker if you don't have Elixir installed. It has a Dockerfile too so you can try it locally.

    There is a template edeliver configuration too.

  5. When it is deployed just add new markdown posts to your repository specified in the configuration and it will be published automatically.

Features to be implemented

Contact me

I'm Nikolay Tsvetinov (meddle) from elixir-lang.bg.

You can find me at: