forked from xolvio/md-blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
392 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
xolvio:md-blog | ||
============== | ||
|
||
This is the blog package currently used on The Meteor Testing Manual. It will give you a | ||
markdown powered blog on your site. | ||
|
||
* Full Markdown support | ||
* Syntax highlighting using [highlight.js](https://highlightjs.org/) | ||
* Customizable styling with the ability to add your own classes to elements! | ||
* Publish / Unpublish / Archive / Unarchive workflows | ||
|
||
[Try the demo site](http://mdblog.meteor.com) | ||
|
||
[See the demo site code](https://github.com/xolvio/md-blog) | ||
|
||
##Installation | ||
|
||
`> meteor add xolvio:md-blog` | ||
|
||
##Getting Started | ||
|
||
There are a couple of steps to carry out before you can start using this package. Don't worry | ||
it's very easy! | ||
|
||
### 1. Define Layouts | ||
First you need to define two templates that the blog in your app that look like this: | ||
|
||
```html | ||
<template name="blogListLayout"> | ||
{{> yield}} | ||
</template> | ||
|
||
<template name="blogPostLayout"> | ||
{{> yield}} | ||
</template> | ||
``` | ||
|
||
These are iron-router layouts that you be available at `<your site>/blog` and `<your site>/blog/:_id/:slug`. | ||
|
||
You may want to customize these template further like adding disqus for instance: | ||
|
||
```html | ||
<template name="blogPostLayout"> | ||
{{> yield}} | ||
{{> disqus}} | ||
</template> | ||
``` | ||
|
||
### 2. Setup Accounts & Roles | ||
You need to ensure you are using a Meteor accounts package like accounts-password, and that the | ||
user you are logged has 'roles' array with the element `mdblog-author`. Here's an example of a | ||
user object: | ||
|
||
```json | ||
{ | ||
"_id": "ixoreoJY5wzmNYMcY", | ||
"emails": [ { | ||
"address" : "[email protected]", | ||
"verified" : true | ||
} ], | ||
"profile": { "name" : "Sam Hatoum" }, | ||
"roles": [ "mdblog-author" ] | ||
} | ||
``` | ||
|
||
You can also the above pragmatically by calling | ||
`Roles.addUsersToRoles(user._id, ['mdblog-author']);` | ||
|
||
For more information about roles, have a look at the | ||
[alanning:roles](https://github.com/alanning/meteor-roles) package. | ||
|
||
|
||
You're ready to go! | ||
|
||
### 3. Customize | ||
|
||
This blog is designed to be fully customizable and as unopinionated as possible. Here are some of | ||
the ways you can configure it. | ||
|
||
####Styling | ||
|
||
To style the blog list and posts, apply css | ||
[just like in the demo app](https://github.com/xolvio/md-blog/blob/master/app/client/blog/blog.less). | ||
|
||
For syntax highlighting style, you need to add the hljs css file of your choice. | ||
[Pick a css template from here](https://highlightjs.org/static/demo/). You can see this in the | ||
demo app, | ||
[there is a file named hljs.css](https://github.com/xolvio/md-blog/tree/master/app/client/blog). | ||
|
||
####Custom Classes | ||
You can also add classes to any element of your choice! For this you need to use the settings.json | ||
file. Have a look at the settings.json file below. You can see there's a field named | ||
`element-classes`. The example above is adding the class | ||
`pure-img` to all `img` elements. This is very powerful as it allows you to use your CSS | ||
framework of your choice. | ||
|
||
####Sorting | ||
By default, the blog sorts your posts by date. You can change this by modifying the `sortBy` | ||
field in the settings file. | ||
|
||
####Settings File Example | ||
```json | ||
{ | ||
"public": { | ||
"blog": { | ||
"name": "The Xolv.io md-blog", | ||
"Description": "Get verbal on your websites.", | ||
"prettify": { | ||
"syntax-highlighting": true, | ||
"element-classes": [ | ||
{ | ||
"locator": "img", | ||
"classes": ["pure-img"] | ||
}, | ||
{ | ||
"locator": "button", | ||
"classes": ["pure-button"] | ||
} | ||
] | ||
}, | ||
"sortBy": {"date": -1} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
##Additional Info | ||
|
||
###URL Format | ||
The URL format of your blog will look lik this: | ||
|
||
`www.your-site.com/blog` | ||
|
||
`www.your-site.com/blog/7yh22/your-latest-blog-post` | ||
|
||
The format is `/:_id/:slug` | ||
|
||
The `:slug` is the title of the blog post with all the spaces replaced with dashes. It's believed | ||
this is good for SEO purposes. | ||
|
||
The `:_id` is a truncated version of the mongo id for the blog entry. This allows you to have | ||
multiple posts with the same title over time. | ||
|
||
|
||
##Contribution | ||
Yes please! | ||
|
||
Todo list: | ||
* [ ] Pagination | ||
* [ ] Auto draft saving + history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,5 +75,4 @@ useraccounts:[email protected] | |
[email protected] | ||
[email protected] | ||
xolvio:[email protected] | ||
xolvio:[email protected] | ||
yasinuslu:[email protected] | ||
xolvio:[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
<template name="instructions"> | ||
{{#unless currentUser}} | ||
<p id="instructions" class="blink"><a href="/sign-in">Sign In</a> or <a | ||
href="/sign-up">Register</a> to author posts</p> | ||
{{/unless}} | ||
</template> | ||
|
||
<template name="blogListLayout"> | ||
{{> header}} | ||
{{> instructions}} | ||
{{> yield}} | ||
</template> | ||
|
||
<template name="blogPostLayout"> | ||
{{> header}} | ||
{{> instructions}} | ||
{{> yield}} | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.