mirror of
https://github.com/adulau/brouilleursdeblanc.git
synced 2024-11-23 10:37:10 +00:00
Merge branch 'master' into develop
# By Nerian # Via Michael Rose (2) and Nerian (1) * master: Automate post creation
This commit is contained in:
commit
e8a7412d1e
3 changed files with 58 additions and 18 deletions
2
Gemfile
2
Gemfile
|
@ -4,3 +4,5 @@ gem 'jekyll'
|
|||
gem 'jekyll-minibundle'
|
||||
gem 'coderay'
|
||||
gem 'rake'
|
||||
gem 'thor'
|
||||
gem 'activesupport'
|
10
README.md
10
README.md
|
@ -263,6 +263,16 @@ To make things easier I use LESS to build So Simple Theme's stylesheets. If you
|
|||
|
||||
---
|
||||
|
||||
## Creating a new Post
|
||||
|
||||
You can create a new post like this:
|
||||
|
||||
```bash
|
||||
$ thor post:new 'My cool post'
|
||||
create _posts/2013-08-21-my-cool-post
|
||||
```
|
||||
---
|
||||
|
||||
## Questions?
|
||||
|
||||
Having a problem getting something to work or want to know why I setup something in a certain way? Ping me on Twitter [@mmistakes](http://twitter.com/mmistakes) or [file a GitHub Issue](https://github.com/mmistakes/so-simple-theme/issues/new).
|
||||
|
|
28
post.thor
Normal file
28
post.thor
Normal file
|
@ -0,0 +1,28 @@
|
|||
require 'active_support/all'
|
||||
|
||||
class Post < Thor
|
||||
include Thor::Actions
|
||||
|
||||
desc "new", "Creates a new post"
|
||||
argument :title
|
||||
def new
|
||||
date = Time.now.strftime("%Y-%m-%d")
|
||||
create_file "_posts/#{(date + '-' + title).parameterize}.md", <<-eos
|
||||
---
|
||||
layout: post
|
||||
title: #{title}
|
||||
description: A description
|
||||
modified: #{date}
|
||||
category: articles
|
||||
tags: []
|
||||
image:
|
||||
credit:
|
||||
creditlink:
|
||||
feature:
|
||||
comments: true
|
||||
---
|
||||
|
||||
eos
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue