If you’ve browsed our site you might be wondering: how can I spin up a simple blog fast? In this guide we replicate the same approach we use here— leveraging Laravel plus the olssonm/ampersand package— from install to your first published post.
Our “secret”
The olssonm/ampersand package lets us manage content without a database layer— posts are Markdown files. No schema design or CRUD scaffolding; just write. Trade‑off: you need basic Markdown (or HTML) knowledge— trivial for most developers.
Prerequisites
- PHP 7.4+
- Laravel 8+
- Composer
Implementation
1. Install the package
composer require olssonm/ampersand
2. Publish config
php artisan vendor:publish --provider="Olssonm\Ampersand\AmpersandServiceProvider"
Example config excerpt:
return [
'posts_path' => base_path('blog'),
'url' => 'blog',
'per_page' => 6,
'page_indicator' => 'page',
'register_routes' => false,
];
3. Controller & views
Generate a controller:
php artisan make:controller ArticleController
Then wire listing & detail (simplified example):
use Olssonm\Ampersand\Models\Post;
public function index()
{
$posts = Post::all()->reject(function ($item) {
return $item->is_draft || $item->date->lessThan(now());
});
return view('ampersand::index', [
'posts' => $posts->forPage(request('page', 1), config('ampersand.per_page'))
]);
}
public function show(Post $post)
{
return view('ampersand::show', compact('post'));
}
4. Routes
Route::name('ampersand.')->group(function () {
Route::get('blog', [ArticleController::class, 'index'])->name('index');
Route::get('blog/{post}', [ArticleController::class, 'show'])->name('show');
});
5. Styling
Theme the provided package views or publish/override them for full control.
6. Writing posts
Create Markdown files in the configured path using the pattern: YYYY-MM-DD.slug.md
Front matter example:
---
title: 'Building a simple blog in Laravel'
date: '2023-11-06 08:00:00'
cover: '/assets/img/blog/blog-markdown.webp'
summary: 'How to build a lightweight blog in Laravel using the olssonm/ampersand package and Markdown.'
tags: ['Laravel','Blog','Markdown','development']
draft: false
---
Draft posts (draft: true) are skipped.
Conclusion
With Laravel + ampersand you get a minimal, file‑backed blog fast— ideal for technical teams prioritising speed and low maintenance. Extend later with search, tagging UI, RSS or static build pipelines.