I really enjoy using Laravel and understand it well enough to want to build everything with it, including my blog. After iterating multiple times and using WordPress and Jekyll, I finally settled on Laravel and Canvas for the perfect personal blog setup.
Canvas has a bunch of great features built in that are included in an easy-to-install package for Laravel. It uses Laravel's optional auth package, and maintains the perfect mix of features to complexity ratio. Below are some of the features I love that are well implemented.
- SEO meta controls for each post
- A very sleek and usable post editor
- Built in simple analytics (won't replace a more complex service but good enough to see general trends and referrers)
- Post scheduling
This feature set is all I needed, and any other little features I've built in myself when my needs changed.
First, you'll need to install Laravel and then Laravel's auth package using the commands below:
composer require laravel/ui php artisan ui vue --auth npm install && npm run dev
After installing Laravel & its Laravel laravel/ui package, you will need to grab the Canvas package using Composer:
composer require cnvs/canvas
Once the package is installed, you will need to publish the package config and assets using the following command:
php artisan canvas:install
To get file uploads to work, a symbolic link needs to be created so files are accessible once uploaded:
php artisan storage:link
At this point, the default Canvas config will work. You can visit /canvas and you should be greeted with a login page.
This is where things get cool. Canvas only provides what is needed to manage a blog on the backend, which is the CMS part. You can now opt to install the Studio package (which is very similar to Medium), or build your own frontend.
Option 1: Studio
Studio is installed as a package just like Canvas. The install instructions for Studio can be found here.
Option 2: Custom Frontend
I opted to use the frontend I already had from my last experimental blog with Jekyll. Over time I updated many parts of my blog such as a move from Bootstrap to Tailwind and then the install of PurgeCSS when I realized how large my CSS file was with Laravel Mix.
It's tough to give guidance on this part, because there are so many variables, however below is my code that actually fetched my posts in my Controller and sent them to the frontend before I added some custom logic.
I use custom tags (a feature built into Canvas) to hide or pin certain posts nowadays, so my query is much more complex. I hope that sooner or later Canvas will incorporate these features in a simpler way so I don't need to make these little tweaks in my controllers.
As traffic grows I will be adding some caching and some other little tweaks, as well as contributing to Canvas to keep improving it. I love this little package, and I'm sure many others do too!