A simple and extensible blogging plugin for OctoberCMS.
- Features
- Installation & Setup
- Installation
- Managing posts
- Components
- Blogpost
- Blogposts
- Available languages
- Support
- You can create and edit posts easily using the WYSISYG editor (What You See Is What You Get)
- You can assign an author and a category to each post
- You can assign multiple tags to each post for better organization
- You can schedule a post for a given date and time
- This plugin is Open Source: Everyone can contribute to this plugin using GitHub
- There's a lot of documentation so you can easily find everything you want to know
Follow these steps to get this blogging plugin up and running.
Follow these steps to install this plugin.
- Login to your OctoberCMS Admin Area
- Navigate to Settings > Updates & Plugins
- Click Install plugins
- Search for "JeroenvanRensen Blog"
- Click at the first result to install
- Wait for the installation to complete
Now you see at the top-level navigation an item named Blog. Click on it and you will see all your posts. Here you can create new posts, edit and delete posts, and manage categories.
Some field elements are described below:
- Slug: A URL-friendly version of the title (only lowercase letters (a-z), numbers (0-9) and dashes (-))
- Featured image: The primary image of the post, used on the post list page
- Excerpt: A small version of the main content, also used on the post list page
- Tags: Labels to organize posts
You can use these components:
blogPost
: Shows a single postblogPosts
: Shows a list of blog posts
Please take a look at the Components section for further details.
All components and their documentation.
Shows a single post.
[blogPost]
format = "html"
==
{% component 'blogPost' %}
The component will search in the database for a post with the same slug as given in the URL. If it couldn't find one, a 404 error will be returned.
If the component should return JSON, the full post will be returned in JSON format. If not, the post will be returned using the default markup.
Name | Type | Default value | Description |
---|---|---|---|
format |
dropdown | html | Select if you want to get HTML or JSON as response |
{% set post = __SELF__.post %}
<h2>{{ post.title }}</h2>
<p>
{{ 'jeroenvanrensen.blog::lang.components.blogpost.html.posted' | trans }}
{{ 'jeroenvanrensen.blog::lang.components.blogpost.html.on_date' | trans }} <b>{{ post.published_at | date('jeroenvanrensen.blog::lang.components.blogpost.html.date_format' | trans) }}</b>
{{ 'jeroenvanrensen.blog::lang.components.blogpost.html.at_time' | trans }} <b>{{ post.published_at | date('jeroenvanrensen.blog::lang.components.blogpost.html.time_format' | trans) }}</b>
{{ 'jeroenvanrensen.blog::lang.components.blogpost.html.by_author' | trans }} <b>{{ post.user.getFullNameAttribute() }}</b>
{% if post.category_id > 0 %}
{{ 'jeroenvanrensen.blog::lang.components.blogpost.html.in_category' | trans }} <b>{{ post.category.name }}</b>
{% endif %}
</p>
<p>
<b>{{ 'jeroenvanrensen.blog::lang.components.blogpost.html.tags' | trans }} :</b>
{% for tag in post.tags %}
{{ tag.name }},
{% endfor %}
</p>
{% if post.featured_image %}
<img style="max-width: 100%;" src="{{ post.featured_image.path }}" alt="{{ post.title }}" /><br /><br />
{% endif %}
{{ post.body|raw }}
Shows a list of blog posts.
[blogPosts]
postOrder = "published_at desc"
postPage = "blog/blog-post"
categoryFilter = "{{ :category }}"
tagFilter = "{{ :tag }}"
format = "html"
==
{% component 'blogPosts' %}
If there is no tag given, all published posts will be fetched from the database. If there is a tag given, all published posts will be fetched from the database according to that tag.
If there is a category filter, the category will be searched by slug. If not found, a 404 error will be returned. Else the posts will be filtered by the category.
Last, the posts will be ordered according to the given settings. If JSON should be returned, it will return all posts in JSON format. Else all posts will be returned in the default HTML markup.
Name | Type | Default value | Description |
---|---|---|---|
postOrder |
dropdown | published_at desc | The way posts should be ordered |
postPage |
dropdown | blog/post | The page where the blogposts component should link to |
categoryFilter |
string | {{ :category }} | Provide the url section for the category filter. If empty all posts will be returned. |
tagFilter |
string | {{ :tag }} | Provide the url section for the tag filter. If empty all posts will be returned. |
format |
dropdown | html | Select if you want to get HTML or JSON as response |
{% for post in __SELF__.posts %}
<li>
<h3><a href="{{ __SELF__.postPage|page({ slug: post.slug }) }}">{{ post.title }}</a></h3>
<p>
{{ 'jeroenvanrensen.blog::lang.components.blogposts.html.posted' | trans }}
{{ 'jeroenvanrensen.blog::lang.components.blogposts.html.on_date' | trans }} <b>{{ post.published_at|date('jeroenvanrensen.blog::lang.components.blogposts.html.date_format' | trans) }}</b>
{{ 'jeroenvanrensen.blog::lang.components.blogposts.html.at_time' | trans }} <b>{{ post.published_at|date('jeroenvanrensen.blog::lang.components.blogposts.html.time_format' | trans) }}</b>
{{ 'jeroenvanrensen.blog::lang.components.blogposts.html.by_author' | trans }} <b>{{ post.user.getFullNameAttribute() }}</b>
{% if post.category_id > 0 %}
{{ 'jeroenvanrensen.blog::lang.components.blogposts.html.in_category' | trans }} <b>{{ post.category.name }}</b>
{% endif %}
</p>
<p>{{ post.excerpt }}</p>
</li>
{% else %}
{{ 'jeroenvanrensen.blog::lang.components.blogposts.html.no_posts_found' | trans }}
{% endfor %}
This plugin is currently available in these languages:
- English (en)
- Dutch (nl)
If you have some questions, found a bug, or have a feature request, please create a new Issue at GitHub.