Skip to content
This repository has been archived by the owner on Sep 10, 2019. It is now read-only.

Commit

Permalink
Last work for first release
Browse files Browse the repository at this point in the history
  • Loading branch information
rathesDot committed Nov 2, 2017
1 parent 04e2e05 commit d4cadb8
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 3 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
CHANGELOG
===

This changelog contains all notable change of the mozhi package
This changelog contains all notable change of the mozhi package

0.1.0: Initial release
---

This is the first release just having the basic feature implemented:

1. Catch all routes and render the appropriate template.
67 changes: 65 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,90 @@
Mozhi
===

The package provides a simple way to add a static files based CMS to your Laravel project. It uses Markdown files as the content provider and uses Laravel's Blade for templating.

Installation
---
You can install the package via composer:

```bash
composer require // add code here
composer require aheenam/mozhi
```

If you are using Laravel in a version < 5.5, the service provider must be registered as a next step:

```php
<?php

// config/app.php
'providers' => [
...
// add code here
Aheenam\Mozhi\MozhiServiceProvider::class
];
```

Configuration
---

Mozhi comes with a set of configuration possibilities, so make sure to check the config file's content:

```php
<?php

return [

/**
* The name of the disk Laravel's filesystem should use to search
* for the content files. Mozhi expects a content directory inside of
* the disk where the contents a located
*
* Default is set to local, that means storage_path('app/')
* will be used to look for a contents directory
*/
'content_disk' => env('MOZHI_CONTENT_DISK', 'local'),

/**
* the path where the themes are located, must be relative to the
* base_path
*/
'theme_path' => env('MOZHI_THEME_PATH', 'resources/themes/'),

/**
* The name of the theme that should be used to render the views
*/
'theme' => env('MOZHI_THEME', 'default'),

/**
* The name of the template that should be used if no template was defined
* in the page's markdown file
*/
'default_template' => env('MOZHI_DEFAULT_TEMPLATE', 'page'),

];
```

All the keys are commented well enough, so the usage should not be too tough. If there is something not that clear, feel free to post an issue.

As you see all the config variables can be set using the env file, but if you want, you can also publish them to change the values.

```bash
$ php artisan vendor:publish --provider="Aheenam\Mozhi\MozhiServiceProvider"
```

Usage
---

After the setup all of your routes will be caught by Mozhi and the package will try to find the appropriate content file for it.

Consider the config as above and then a call to `/blog/awesome-blog`. Now Mozhi will look for a file in `storage/contents/blog/` that is named `awesome-blog.md`.

If it is found, it will render the specified template of the currenty theme and pass the content and the header of the markdown file.

The MarkDown files are parsed using Spatie's awesome package called [YAML Front Matter](https://github.com/spatie/yaml-front-matter) before parsing the markdown, so you can (and should decorate) your markdown files.

So in your template file you can use the `$content` and the `$meta` variables. First is the html of the content file and `$meta` is an array of all header data specified in the Markdown file.

> Note: If no template was specified it will fallback to the `default_theme` specified in the config.
Changelog
---
Expand Down

0 comments on commit d4cadb8

Please sign in to comment.