Code Monkey home page Code Monkey logo

catlog's Introduction

Catlog

Build Status Bitdeli Badge

Introduction

Catlog is a static site generator. It allow users to use markdown syntax to write blog article and publish it with html format. Catlog has a inner test server to allow you see your blog after write it. It also support for self theme and plugin definition.

Live demo blog.cattail.me

Quick-start

First install catlog with npm:

$ npm install -g catlogjs

This will install catlog globally on your system so that you can access the catlog command from anywhere. Once that you can view help:

$ catlog -h

it will tell you how to use catlog.

Create a directory for your website, get inside of it, and initialize an empty catlog project:

$ mkdir my-website
$ cd my-website
$ catlog init

This creates a skeleton site with a basic set of templates.

Want to create an new blog?

$ catlog publish

then you will need to provide some info for it.

write your article name: 文章名称
choose article category: 选择已创建类别,或者创建新的类别(这会给你在网站上添加一个新的导航项)
input new permalink title: 固定链接,为了美观,请尽量使用英文
input author name: 文章作者名

when done, you will have a subdirectory in contents folder: contents/category_name/permalink_title.There will be a index.md and a meta.json file. The index.md is where you write your article, and the meta.json file holds some info of your article.

The catlog blog structure contain the meta info of articles, do not change the directory structure without knowning what it means. publish command will handle this properly for you.

If you already have a lot of markdown article files and want to migrate them into catlog blog structure, run:

$ catlog migrate <path> 

It will prompt lost meta information needed for every markdown files.

When you finish writing article and want to preview it on local server, you should run:

$ catlog preview [-s] [-a] 
	
options:
	
	-s [port]: start local server on port,the default port is 8080.
	-a: watch for file change and auto update
	--server [port]: the same effect as -s [port]
	--auto: the same effect as -a

Then you can build your site.

$ catlog build 

This generates your site and places it in the build/ directory - all ready to be copied to your web server!

Theme

environment

site

  • source
  • destination
  • theme_path
  • plugin_path
  • permalink_style
  • base_url
  • port
  • author
  • site_title
  • site_url
  • destination
  • theme
  • plugins
  • categories
  • posts

post

  • src
  • title
  • category
  • date
  • time
  • author
  • year
  • month
  • day
  • permalink
  • heading
  • content could have self-defined variables

Plugin

Catlog itself bring with three plugins:

In your website root directory, change settings.json plugins field. Following is a example configuration file

{
  "source": ".contents",
  "destination": "build",
  "permalink_style": "date",
  "base_url": "/",
  "about_url": "http://about.me/cattail",
  "port": "8081",
  "author": "CatTail",
  "site_title": "Catblog",
  "site_url": "http://blog.cattail.me",
  "description": "",
  "theme": "came",
  "plugins": {
    "ga": {
      "trackingID": "UA-41494270-1",
      "domain": "cattail.me"
    },
    "disqus": {
      "disqus_shortname": "cattail"
    },
    "qudian": {
      "auth_key_id": "1362799309",
      "auth_key_secret": "44fc9ea58e1697c85506d305a20dbfea"
    }
  }
}

TODO

  • 修改migrate呈现形式
  • 增加about等特殊页面的支持
  • 编写测试
  • 增加示例
  • 相册

Contributors

Developed when working at ©Qudian Tech Inc.

catlog's People

Contributors

cattail avatar

Watchers

 avatar  avatar  avatar

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.