Download the PHP package maccath/baun-categories without Composer
On this page you can find all versions of the php package maccath/baun-categories. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maccath/baun-categories
More information about maccath/baun-categories
Files in maccath/baun-categories
Package baun-categories
Short Description A categories plugin for BaunCMS
License MIT
Informations about the package baun-categories
Baun Categories Plugin
A categories plugin for BaunCMS
Installation Instructions
Using Composer
Install using composer on the commandline:
composer require maccath/baun-categories
Or in composer.json
:
"require": {
"maccath/baun-categories": "1.*",
},
Configuration
Add the following line to your config/plugins.php
file:
'BaunPlugin\Categories\Categories',
Run the following command inside your project directory:
php baun publish:config maccath/baun-categories
This will create config files inside the config/plugins/maccath/baun-categories
directory, which you may then edit to
your liking.
The following configuration options are available:
title
the title used on the categories list page and in the navigationcategory_url
the path used to access your blog categories, no leading slashexclude_from_nav
(boolean) whether or not to exclude the categories page from the navigation
Usage Instructions
Adding categories to posts
To add categories to your posts, simply add categories: categoryOne, categoryTwo
to the top of your blog post files.
For example, the following file will create a post with the categories 'volutpat' and 'consectetur':
title: Post 1
categories: consectetur, volutpat
----
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ut vehicula erat. Morbi volutpat posuere auctor.
Vivamus condimentum, purus nec tempus euismod, enim massa blandit est, vel elementum lacus nulla ut sem. Integer
orci libero, rutrum id nisl et, euismod auctor augue.
Viewing all posts in a category
By default, posts for categories will appear at the following path: /categories/categoryName
. The path used to display
categories can be configured in the configuration file found at config/plugins/maccath/baun-categories/categories.php
Editing the categories page template
Inside your themes directory (typically public/themes/themeName/
), create categories.html
. This file can be
customised to display a list of categories however you like. The following example is the default file contents, which
simply displays an unordered list of categories:
{% extends "layout.html" %}
{% block content %}
<h1>{{ categories_title }}</h1>
<ul>
{% for category in categories %}
<li><a href="{{ category.link }}">{{ category.name }}</a></li>
{% endfor %}
</ul>
{% endblock %}