Git Product home page Git Product logo

asciidoc-blog's Introduction

Asciidoc Blog

Simple blog generator for hosting on GitHub Pages using Node and Asciidoctor.js.

Introduction

This is a Jeykll/Hyde/Hugo copycat. It’s not nearly as extensible as Jekyll (yet!) or as fast as Hugo (yet!). But if you don’t need a million themes to choose from and you just want to deploy asciidoc to GitHub Pages as fast and easily as possible, then this is the project for you. No adding front matter to your posts that messes up your syntax highlighter, no learning Ruby or Go to understand what’s going on if you’re just a humble Javascript/Node.js developer; just npm install blitzrk/ asciidoc-blog and you’re half way to a blog!

Installation

No longer is creating and asciidoc-blog tied to forking this repo. The process has been streamlined for easier install and updating.

$ npm install -g blitzrk/asciidoc-blog
$ mkdir blog
$ cd blog
$ ablog init
$ ablog server
Webserver started at http://0.0.0.0:8000

ablog may also be installed locally and used either through npm scripts or at ./node_modules/.bin/ablog.

{
  "scripts": {
    "start": "ablog server",
    "build": "ablog build",
    "ablog": "ablog"
  }
}

Then

$ npm run ablog -- init
$ npm start
Webserver started at http://0.0.0.0:8000
^C
$ npm run build
...

Usage

Now that that’s out of the way, you can create posts in _posts. Posts are just normal asciidoc documents. Be sure to give it a proper header, though. To run a test server, run ablog server and to build for production, run ablog build, which will output your static site at dist/.

Example header

The header doesn’t have anything special added to it from the official specification.

= Title: Still Part of Title: Subtitle
Author Name <author@email.com>
v1.0.3, 1970-01-01 00:00: Comment
:toc:
:toc-title: Table of Doom
:toc-placement: preamble

A title, author name, and date are all required, but adding the rest won’t break anything.

Configuration

Currently there are two locations for configuring your site. Most options may be found in config.json. Colors, however, are located in _assets/sass/_constants.scss. Colors can be changed and will automatically update if you’re running the test server (just refresh your page).

HTTPS

If "https" is set to true, then a provided script will be automatically run that redirects users to the https version of your site. (This must be set up separately. I will write a future post about it.) For testing purposes, it will only redirect if the host has no subdomain or a subdomain of www. This allows unsecure running of a test server with something like ngrok without messing up your configuration. To override this behavior, set "httpsSubdomain" to true.

Deploying Your Site

There are a few options for deloying your site. However, my suggestion is to use Travis CI. That way you can even edit or create posts directly on Github.com and see them up on your site just a minute later without even opening up a terminal.

Travis CI

Obviously, the first step is to set up a Travis CI account. Then you’ll want to turn on builds for your fork of blitzrk/asciidoc-blog. Next, you’ll modify .travis.yml. This is pretty self-explanatory, except for the secure: line. This is where you provide Travis with an encrypted version of your Github API key.

So generate a new Github API key here with the permissions for only public_repo. Then encrypt it with the travis CLI tool.

$ cd /path/to/blog
$ gem install travis
$ travis encrypt GH_TOKEN=<paste token from browser> --add

This has already added it to your .travis.yml file, so just commit, push, and it will be built!

Further Configuration

TODO: CNAME file, changing repo name

Manual Method

All that Travis does is run a simple script with some environment variables set. You can do this, too! Either follow the steps in run/travis.sh, skipping where appropriate (e.g. if you already installed/inited asciidoc-blog), or run

$ GH_NAME="<your name/Travis CI>" GH_EMAIL="<email>" GH_REF="github.com/<username>/<project>.git" GH_BRANCH="<gh-pages/master>" GH_TOKEN="<unecrypted token>" ./run/deploy.sh

To Do

  • ✓ Bemoan GitHub’s Asciidoc styling

  • ✓ Sidebar with responsive design

  • ✓ Sidebar static links

  • ✓ Links from Home to posts

  • ✓ Upgrade script to HTTPS

  • ✓ All posts page

  • ✓ Add favicon

  • ✓ Sidebar configuration

  • ✓ Deploy with Travis CI

  • ✓ Write first post

  • ❏ Make into self-contained package

asciidoc-blog's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

flippii askagirl

asciidoc-blog's Issues

Overrideable files

Make some files overrideable for easier updates. e.g. index.adoc and stylesheets.

Limit Preview Size

If an article has no sections, it could go indefinitely long. allow ~10 sentences.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.